feat: import services and standardize Go 1.26.5

This commit is contained in:
2026-08-09 10:43:45 +08:00
parent 689c74b28f
commit 86024fa81d
1456 changed files with 220765 additions and 2 deletions

View File

@@ -0,0 +1,542 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.8
// protoc (unknown)
// source: check.proto
package initial
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Crc struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Crc) Reset() {
*x = Crc{}
mi := &file_check_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Crc) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Crc) ProtoMessage() {}
func (x *Crc) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Crc.ProtoReflect.Descriptor instead.
func (*Crc) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{0}
}
func (x *Crc) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
type StatusReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 状态码
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 状态说明
Details string `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"` // 数据
Timeseq int64 `protobuf:"varint,4,opt,name=timeseq,proto3" json:"timeseq,omitempty"` // 响应时间序列
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StatusReply) Reset() {
*x = StatusReply{}
mi := &file_check_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StatusReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatusReply) ProtoMessage() {}
func (x *StatusReply) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.
func (*StatusReply) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{1}
}
func (x *StatusReply) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
func (x *StatusReply) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *StatusReply) GetDetails() string {
if x != nil {
return x.Details
}
return ""
}
func (x *StatusReply) GetTimeseq() int64 {
if x != nil {
return x.Timeseq
}
return 0
}
type ConfigRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
App string `protobuf:"bytes,1,opt,name=app,proto3" json:"app,omitempty"` // 应用程序名称 <必填>
Os string `protobuf:"bytes,2,opt,name=os,proto3" json:"os,omitempty"` // 操作系统 <必填>
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ConfigRequest) Reset() {
*x = ConfigRequest{}
mi := &file_check_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ConfigRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigRequest) ProtoMessage() {}
func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ConfigRequest.ProtoReflect.Descriptor instead.
func (*ConfigRequest) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{2}
}
func (x *ConfigRequest) GetApp() string {
if x != nil {
return x.App
}
return ""
}
func (x *ConfigRequest) GetOs() string {
if x != nil {
return x.Os
}
return ""
}
type ConfigReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data []*ConfigItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` // 配置参数列表
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ConfigReply) Reset() {
*x = ConfigReply{}
mi := &file_check_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ConfigReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigReply) ProtoMessage() {}
func (x *ConfigReply) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ConfigReply.ProtoReflect.Descriptor instead.
func (*ConfigReply) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{3}
}
func (x *ConfigReply) GetData() []*ConfigItem {
if x != nil {
return x.Data
}
return nil
}
type ConfigItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Identity string `protobuf:"bytes,1,opt,name=Identity,proto3" json:"Identity,omitempty"` //唯一标识
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` //配置键
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` //配置值
Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` //版本号
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ConfigItem) Reset() {
*x = ConfigItem{}
mi := &file_check_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ConfigItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigItem) ProtoMessage() {}
func (x *ConfigItem) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ConfigItem.ProtoReflect.Descriptor instead.
func (*ConfigItem) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{4}
}
func (x *ConfigItem) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *ConfigItem) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *ConfigItem) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *ConfigItem) GetVersion() int64 {
if x != nil {
return x.Version
}
return 0
}
type CheckForUpdatesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
App string `protobuf:"bytes,1,opt,name=app,proto3" json:"app,omitempty"` // 应用程序名称 <必填>
Os string `protobuf:"bytes,2,opt,name=os,proto3" json:"os,omitempty"` // 操作系统 <必填>
Arch string `protobuf:"bytes,3,opt,name=arch,proto3" json:"arch,omitempty"` // 构架名称 <必填>
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` // 版本号 <必填>
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckForUpdatesRequest) Reset() {
*x = CheckForUpdatesRequest{}
mi := &file_check_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckForUpdatesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckForUpdatesRequest) ProtoMessage() {}
func (x *CheckForUpdatesRequest) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckForUpdatesRequest.ProtoReflect.Descriptor instead.
func (*CheckForUpdatesRequest) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{5}
}
func (x *CheckForUpdatesRequest) GetApp() string {
if x != nil {
return x.App
}
return ""
}
func (x *CheckForUpdatesRequest) GetOs() string {
if x != nil {
return x.Os
}
return ""
}
func (x *CheckForUpdatesRequest) GetArch() string {
if x != nil {
return x.Arch
}
return ""
}
func (x *CheckForUpdatesRequest) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
type CheckForUpdatesReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一码
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // 版本号
Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"` // 更析说明
Files string `protobuf:"bytes,4,opt,name=files,proto3" json:"files,omitempty"` // 更新文件以及文件hash
Pubdate string `protobuf:"bytes,5,opt,name=pubdate,proto3" json:"pubdate,omitempty"` // 发布时间
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CheckForUpdatesReply) Reset() {
*x = CheckForUpdatesReply{}
mi := &file_check_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CheckForUpdatesReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckForUpdatesReply) ProtoMessage() {}
func (x *CheckForUpdatesReply) ProtoReflect() protoreflect.Message {
mi := &file_check_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckForUpdatesReply.ProtoReflect.Descriptor instead.
func (*CheckForUpdatesReply) Descriptor() ([]byte, []int) {
return file_check_proto_rawDescGZIP(), []int{6}
}
func (x *CheckForUpdatesReply) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *CheckForUpdatesReply) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
func (x *CheckForUpdatesReply) GetSummary() string {
if x != nil {
return x.Summary
}
return ""
}
func (x *CheckForUpdatesReply) GetFiles() string {
if x != nil {
return x.Files
}
return ""
}
func (x *CheckForUpdatesReply) GetPubdate() string {
if x != nil {
return x.Pubdate
}
return ""
}
var File_check_proto protoreflect.FileDescriptor
const file_check_proto_rawDesc = "" +
"\n" +
"\x18base/initial/check.proto\x12\ainitial\"\x19\n" +
"\x03Crc\x12\x12\n" +
"\x04code\x18\x01 \x01(\tR\x04code\"o\n" +
"\vStatusReply\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12\x18\n" +
"\adetails\x18\x03 \x01(\tR\adetails\x12\x18\n" +
"\atimeseq\x18\x04 \x01(\x03R\atimeseq\"1\n" +
"\rConfigRequest\x12\x10\n" +
"\x03app\x18\x01 \x01(\tR\x03app\x12\x0e\n" +
"\x02os\x18\x02 \x01(\tR\x02os\"6\n" +
"\vConfigReply\x12'\n" +
"\x04data\x18\x01 \x03(\v2\x13.initial.ConfigItemR\x04data\"j\n" +
"\n" +
"ConfigItem\x12\x1a\n" +
"\bIdentity\x18\x01 \x01(\tR\bIdentity\x12\x10\n" +
"\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x03 \x01(\tR\x05value\x12\x18\n" +
"\aversion\x18\x04 \x01(\x03R\aversion\"h\n" +
"\x16CheckForUpdatesRequest\x12\x10\n" +
"\x03app\x18\x01 \x01(\tR\x03app\x12\x0e\n" +
"\x02os\x18\x02 \x01(\tR\x02os\x12\x12\n" +
"\x04arch\x18\x03 \x01(\tR\x04arch\x12\x18\n" +
"\aversion\x18\x04 \x01(\tR\aversion\"\x96\x01\n" +
"\x14CheckForUpdatesReply\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\x12\x18\n" +
"\aversion\x18\x02 \x01(\tR\aversion\x12\x18\n" +
"\asummary\x18\x03 \x01(\tR\asummary\x12\x14\n" +
"\x05files\x18\x04 \x01(\tR\x05files\x12\x18\n" +
"\apubdate\x18\x05 \x01(\tR\apubdate2\xbd\x01\n" +
"\x05Check\x12-\n" +
"\x05Hello\x12\f.initial.Crc\x1a\x14.initial.StatusReply\"\x00\x128\n" +
"\x06Config\x12\x16.initial.ConfigRequest\x1a\x14.initial.ConfigReply\"\x00\x12K\n" +
"\aUpdates\x12\x1f.initial.CheckForUpdatesRequest\x1a\x1d.initial.CheckForUpdatesReply\"\x00B\vZ\t.;initialb\x06proto3"
var (
file_check_proto_rawDescOnce sync.Once
file_check_proto_rawDescData []byte
)
func file_check_proto_rawDescGZIP() []byte {
file_check_proto_rawDescOnce.Do(func() {
file_check_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_check_proto_rawDesc), len(file_check_proto_rawDesc)))
})
return file_check_proto_rawDescData
}
var file_check_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_check_proto_goTypes = []any{
(*Crc)(nil), // 0: initial.Crc
(*StatusReply)(nil), // 1: initial.StatusReply
(*ConfigRequest)(nil), // 2: initial.ConfigRequest
(*ConfigReply)(nil), // 3: initial.ConfigReply
(*ConfigItem)(nil), // 4: initial.ConfigItem
(*CheckForUpdatesRequest)(nil), // 5: initial.CheckForUpdatesRequest
(*CheckForUpdatesReply)(nil), // 6: initial.CheckForUpdatesReply
}
var file_check_proto_depIdxs = []int32{
4, // 0: initial.ConfigReply.data:type_name -> initial.ConfigItem
0, // 1: initial.Check.Hello:input_type -> initial.Crc
2, // 2: initial.Check.Config:input_type -> initial.ConfigRequest
5, // 3: initial.Check.Updates:input_type -> initial.CheckForUpdatesRequest
1, // 4: initial.Check.Hello:output_type -> initial.StatusReply
3, // 5: initial.Check.Config:output_type -> initial.ConfigReply
6, // 6: initial.Check.Updates:output_type -> initial.CheckForUpdatesReply
4, // [4:7] is the sub-list for method output_type
1, // [1:4] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_check_proto_init() }
func file_check_proto_init() {
if File_check_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_check_proto_rawDesc), len(file_check_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_check_proto_goTypes,
DependencyIndexes: file_check_proto_depIdxs,
MessageInfos: file_check_proto_msgTypes,
}.Build()
File_check_proto = out.File
file_check_proto_goTypes = nil
file_check_proto_depIdxs = nil
}

View File

@@ -0,0 +1,289 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: check.proto
/*
Package initial is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package initial
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Check_Hello_0(ctx context.Context, marshaler runtime.Marshaler, client CheckClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Crc
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Hello(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Check_Hello_0(ctx context.Context, marshaler runtime.Marshaler, server CheckServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Crc
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Hello(ctx, &protoReq)
return msg, metadata, err
}
func request_Check_Config_0(ctx context.Context, marshaler runtime.Marshaler, client CheckClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ConfigRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Config(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Check_Config_0(ctx context.Context, marshaler runtime.Marshaler, server CheckServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ConfigRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Config(ctx, &protoReq)
return msg, metadata, err
}
func request_Check_Updates_0(ctx context.Context, marshaler runtime.Marshaler, client CheckClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CheckForUpdatesRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Updates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Check_Updates_0(ctx context.Context, marshaler runtime.Marshaler, server CheckServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CheckForUpdatesRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Updates(ctx, &protoReq)
return msg, metadata, err
}
// RegisterCheckHandlerServer registers the http handlers for service Check to "mux".
// UnaryRPC :call CheckServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCheckHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterCheckHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CheckServer) error {
mux.Handle(http.MethodPost, pattern_Check_Hello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/initial.Check/Hello", runtime.WithHTTPPathPattern("/initial.Check/Hello"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Check_Hello_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Check_Hello_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Check_Config_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/initial.Check/Config", runtime.WithHTTPPathPattern("/initial.Check/Config"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Check_Config_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Check_Config_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Check_Updates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/initial.Check/Updates", runtime.WithHTTPPathPattern("/initial.Check/Updates"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Check_Updates_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Check_Updates_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterCheckHandlerFromEndpoint is same as RegisterCheckHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterCheckHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterCheckHandler(ctx, mux, conn)
}
// RegisterCheckHandler registers the http handlers for service Check to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterCheckHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterCheckHandlerClient(ctx, mux, NewCheckClient(conn))
}
// RegisterCheckHandlerClient registers the http handlers for service Check
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CheckClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CheckClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "CheckClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterCheckHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CheckClient) error {
mux.Handle(http.MethodPost, pattern_Check_Hello_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/initial.Check/Hello", runtime.WithHTTPPathPattern("/initial.Check/Hello"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Check_Hello_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Check_Hello_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Check_Config_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/initial.Check/Config", runtime.WithHTTPPathPattern("/initial.Check/Config"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Check_Config_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Check_Config_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Check_Updates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/initial.Check/Updates", runtime.WithHTTPPathPattern("/initial.Check/Updates"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Check_Updates_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Check_Updates_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Check_Hello_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"initial.Check", "Hello"}, ""))
pattern_Check_Config_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"initial.Check", "Config"}, ""))
pattern_Check_Updates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"initial.Check", "Updates"}, ""))
)
var (
forward_Check_Hello_0 = runtime.ForwardResponseMessage
forward_Check_Config_0 = runtime.ForwardResponseMessage
forward_Check_Updates_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,207 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: check.proto
package initial
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Check_Hello_FullMethodName = "/initial.Check/Hello"
Check_Config_FullMethodName = "/initial.Check/Config"
Check_Updates_FullMethodName = "/initial.Check/Updates"
)
// CheckClient is the client API for Check service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// initial-检测是否有新版或新的配置
type CheckClient interface {
// HELLO
Hello(ctx context.Context, in *Crc, opts ...grpc.CallOption) (*StatusReply, error)
// 获取应用的相关配置信息
Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigReply, error)
// 检查更新
Updates(ctx context.Context, in *CheckForUpdatesRequest, opts ...grpc.CallOption) (*CheckForUpdatesReply, error)
}
type checkClient struct {
cc grpc.ClientConnInterface
}
func NewCheckClient(cc grpc.ClientConnInterface) CheckClient {
return &checkClient{cc}
}
func (c *checkClient) Hello(ctx context.Context, in *Crc, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Check_Hello_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *checkClient) Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ConfigReply)
err := c.cc.Invoke(ctx, Check_Config_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *checkClient) Updates(ctx context.Context, in *CheckForUpdatesRequest, opts ...grpc.CallOption) (*CheckForUpdatesReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckForUpdatesReply)
err := c.cc.Invoke(ctx, Check_Updates_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// CheckServer is the server API for Check service.
// All implementations must embed UnimplementedCheckServer
// for forward compatibility.
//
// initial-检测是否有新版或新的配置
type CheckServer interface {
// HELLO
Hello(context.Context, *Crc) (*StatusReply, error)
// 获取应用的相关配置信息
Config(context.Context, *ConfigRequest) (*ConfigReply, error)
// 检查更新
Updates(context.Context, *CheckForUpdatesRequest) (*CheckForUpdatesReply, error)
mustEmbedUnimplementedCheckServer()
}
// UnimplementedCheckServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedCheckServer struct{}
func (UnimplementedCheckServer) Hello(context.Context, *Crc) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented")
}
func (UnimplementedCheckServer) Config(context.Context, *ConfigRequest) (*ConfigReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Config not implemented")
}
func (UnimplementedCheckServer) Updates(context.Context, *CheckForUpdatesRequest) (*CheckForUpdatesReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Updates not implemented")
}
func (UnimplementedCheckServer) mustEmbedUnimplementedCheckServer() {}
func (UnimplementedCheckServer) testEmbeddedByValue() {}
// UnsafeCheckServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CheckServer will
// result in compilation errors.
type UnsafeCheckServer interface {
mustEmbedUnimplementedCheckServer()
}
func RegisterCheckServer(s grpc.ServiceRegistrar, srv CheckServer) {
// If the following call pancis, it indicates UnimplementedCheckServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Check_ServiceDesc, srv)
}
func _Check_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Crc)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CheckServer).Hello(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Check_Hello_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CheckServer).Hello(ctx, req.(*Crc))
}
return interceptor(ctx, in, info, handler)
}
func _Check_Config_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CheckServer).Config(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Check_Config_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CheckServer).Config(ctx, req.(*ConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Check_Updates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckForUpdatesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CheckServer).Updates(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Check_Updates_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CheckServer).Updates(ctx, req.(*CheckForUpdatesRequest))
}
return interceptor(ctx, in, info, handler)
}
// Check_ServiceDesc is the grpc.ServiceDesc for Check service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Check_ServiceDesc = grpc.ServiceDesc{
ServiceName: "initial.Check",
HandlerType: (*CheckServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Hello",
Handler: _Check_Hello_Handler,
},
{
MethodName: "Config",
Handler: _Check_Config_Handler,
},
{
MethodName: "Updates",
Handler: _Check_Updates_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "check.proto",
}

View File

@@ -0,0 +1,709 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.8
// protoc (unknown)
// source: data.proto
package initial
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Empty struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Empty) Reset() {
*x = Empty{}
mi := &file_data_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{0}
}
type CountryReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Countries []*CountryItem `protobuf:"bytes,1,rep,name=countries,proto3" json:"countries,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CountryReply) Reset() {
*x = CountryReply{}
mi := &file_data_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CountryReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CountryReply) ProtoMessage() {}
func (x *CountryReply) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CountryReply.ProtoReflect.Descriptor instead.
func (*CountryReply) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{1}
}
func (x *CountryReply) GetCountries() []*CountryItem {
if x != nil {
return x.Countries
}
return nil
}
type CountryItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Iso2 string `protobuf:"bytes,2,opt,name=Iso2,proto3" json:"Iso2,omitempty"`
Iso3 string `protobuf:"bytes,3,opt,name=Iso3,proto3" json:"Iso3,omitempty"`
NumCode string `protobuf:"bytes,4,opt,name=num_code,json=numCode,proto3" json:"num_code,omitempty"`
PhoneCode string `protobuf:"bytes,5,opt,name=phone_code,json=phoneCode,proto3" json:"phone_code,omitempty"`
Currency string `protobuf:"bytes,6,opt,name=currency,proto3" json:"currency,omitempty"`
CurrencySymbol string `protobuf:"bytes,7,opt,name=currency_symbol,json=currencySymbol,proto3" json:"currency_symbol,omitempty"`
Region string `protobuf:"bytes,8,opt,name=region,proto3" json:"region,omitempty"`
Timezones string `protobuf:"bytes,9,opt,name=timezones,proto3" json:"timezones,omitempty"`
Translations string `protobuf:"bytes,10,opt,name=translations,proto3" json:"translations,omitempty"`
Name string `protobuf:"bytes,11,opt,name=name,proto3" json:"name,omitempty"`
LocalName string `protobuf:"bytes,12,opt,name=local_name,json=localName,proto3" json:"local_name,omitempty"`
Enabled bool `protobuf:"varint,13,opt,name=enabled,proto3" json:"enabled,omitempty"`
SortOrder int32 `protobuf:"varint,14,opt,name=sort_order,json=sortOrder,proto3" json:"sort_order,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CountryItem) Reset() {
*x = CountryItem{}
mi := &file_data_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CountryItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CountryItem) ProtoMessage() {}
func (x *CountryItem) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CountryItem.ProtoReflect.Descriptor instead.
func (*CountryItem) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{2}
}
func (x *CountryItem) GetId() uint32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CountryItem) GetIso2() string {
if x != nil {
return x.Iso2
}
return ""
}
func (x *CountryItem) GetIso3() string {
if x != nil {
return x.Iso3
}
return ""
}
func (x *CountryItem) GetNumCode() string {
if x != nil {
return x.NumCode
}
return ""
}
func (x *CountryItem) GetPhoneCode() string {
if x != nil {
return x.PhoneCode
}
return ""
}
func (x *CountryItem) GetCurrency() string {
if x != nil {
return x.Currency
}
return ""
}
func (x *CountryItem) GetCurrencySymbol() string {
if x != nil {
return x.CurrencySymbol
}
return ""
}
func (x *CountryItem) GetRegion() string {
if x != nil {
return x.Region
}
return ""
}
func (x *CountryItem) GetTimezones() string {
if x != nil {
return x.Timezones
}
return ""
}
func (x *CountryItem) GetTranslations() string {
if x != nil {
return x.Translations
}
return ""
}
func (x *CountryItem) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CountryItem) GetLocalName() string {
if x != nil {
return x.LocalName
}
return ""
}
func (x *CountryItem) GetEnabled() bool {
if x != nil {
return x.Enabled
}
return false
}
func (x *CountryItem) GetSortOrder() int32 {
if x != nil {
return x.SortOrder
}
return 0
}
type AreasRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// 国家ID默认中国 1
CountryId int32 `protobuf:"varint,1,opt,name=country_id,json=countryId,proto3" json:"country_id,omitempty"`
// 国家代码,默认:中国 CN
CountryCode string `protobuf:"bytes,2,opt,name=country_code,json=countryCode,proto3" json:"country_code,omitempty"`
// 是否输出乡镇,默认:市级
ShowTown bool `protobuf:"varint,3,opt,name=show_town,json=showTown,proto3" json:"show_town,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AreasRequest) Reset() {
*x = AreasRequest{}
mi := &file_data_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AreasRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AreasRequest) ProtoMessage() {}
func (x *AreasRequest) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AreasRequest.ProtoReflect.Descriptor instead.
func (*AreasRequest) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{3}
}
func (x *AreasRequest) GetCountryId() int32 {
if x != nil {
return x.CountryId
}
return 0
}
func (x *AreasRequest) GetCountryCode() string {
if x != nil {
return x.CountryCode
}
return ""
}
func (x *AreasRequest) GetShowTown() bool {
if x != nil {
return x.ShowTown
}
return false
}
type AreasReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Areas []*AreasItem `protobuf:"bytes,1,rep,name=areas,proto3" json:"areas,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AreasReply) Reset() {
*x = AreasReply{}
mi := &file_data_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AreasReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AreasReply) ProtoMessage() {}
func (x *AreasReply) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AreasReply.ProtoReflect.Descriptor instead.
func (*AreasReply) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{4}
}
func (x *AreasReply) GetAreas() []*AreasItem {
if x != nil {
return x.Areas
}
return nil
}
type AreasItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Pid string `protobuf:"bytes,2,opt,name=pid,proto3" json:"pid,omitempty"`
Deep int32 `protobuf:"varint,3,opt,name=deep,proto3" json:"deep,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
PinyinPrefix string `protobuf:"bytes,5,opt,name=pinyin_prefix,json=pinyinPrefix,proto3" json:"pinyin_prefix,omitempty"`
Pinyin string `protobuf:"bytes,6,opt,name=pinyin,proto3" json:"pinyin,omitempty"`
ExtId string `protobuf:"bytes,7,opt,name=ext_id,json=extId,proto3" json:"ext_id,omitempty"`
ExtName string `protobuf:"bytes,8,opt,name=ext_name,json=extName,proto3" json:"ext_name,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AreasItem) Reset() {
*x = AreasItem{}
mi := &file_data_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AreasItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AreasItem) ProtoMessage() {}
func (x *AreasItem) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AreasItem.ProtoReflect.Descriptor instead.
func (*AreasItem) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{5}
}
func (x *AreasItem) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *AreasItem) GetPid() string {
if x != nil {
return x.Pid
}
return ""
}
func (x *AreasItem) GetDeep() int32 {
if x != nil {
return x.Deep
}
return 0
}
func (x *AreasItem) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *AreasItem) GetPinyinPrefix() string {
if x != nil {
return x.PinyinPrefix
}
return ""
}
func (x *AreasItem) GetPinyin() string {
if x != nil {
return x.Pinyin
}
return ""
}
func (x *AreasItem) GetExtId() string {
if x != nil {
return x.ExtId
}
return ""
}
func (x *AreasItem) GetExtName() string {
if x != nil {
return x.ExtName
}
return ""
}
type DatasReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Datas []*DatasItem `protobuf:"bytes,1,rep,name=datas,proto3" json:"datas,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DatasReply) Reset() {
*x = DatasReply{}
mi := &file_data_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DatasReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DatasReply) ProtoMessage() {}
func (x *DatasReply) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DatasReply.ProtoReflect.Descriptor instead.
func (*DatasReply) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{6}
}
func (x *DatasReply) GetDatas() []*DatasItem {
if x != nil {
return x.Datas
}
return nil
}
type DatasItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
DataType string `protobuf:"bytes,2,opt,name=data_type,json=dataType,proto3" json:"data_type,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`
Remark string `protobuf:"bytes,5,opt,name=remark,proto3" json:"remark,omitempty"`
Icon string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DatasItem) Reset() {
*x = DatasItem{}
mi := &file_data_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DatasItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DatasItem) ProtoMessage() {}
func (x *DatasItem) ProtoReflect() protoreflect.Message {
mi := &file_data_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DatasItem.ProtoReflect.Descriptor instead.
func (*DatasItem) Descriptor() ([]byte, []int) {
return file_data_proto_rawDescGZIP(), []int{7}
}
func (x *DatasItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *DatasItem) GetDataType() string {
if x != nil {
return x.DataType
}
return ""
}
func (x *DatasItem) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *DatasItem) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *DatasItem) GetRemark() string {
if x != nil {
return x.Remark
}
return ""
}
func (x *DatasItem) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
var File_data_proto protoreflect.FileDescriptor
const file_data_proto_rawDesc = "" +
"\n" +
"\x17" +
"base/initial/data.proto\x12\ainitial\"\a\n" +
"\x05Empty\"B\n" +
"\fCountryReply\x122\n" +
"\tcountries\x18\x01 \x03(\v2\x14.initial.CountryItemR\tcountries\"\x8a\x03\n" +
"\vCountryItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\rR\x02id\x12\x12\n" +
"\x04Iso2\x18\x02 \x01(\tR\x04Iso2\x12\x12\n" +
"\x04Iso3\x18\x03 \x01(\tR\x04Iso3\x12\x19\n" +
"\bnum_code\x18\x04 \x01(\tR\anumCode\x12\x1d\n" +
"\n" +
"phone_code\x18\x05 \x01(\tR\tphoneCode\x12\x1a\n" +
"\bcurrency\x18\x06 \x01(\tR\bcurrency\x12'\n" +
"\x0fcurrency_symbol\x18\a \x01(\tR\x0ecurrencySymbol\x12\x16\n" +
"\x06region\x18\b \x01(\tR\x06region\x12\x1c\n" +
"\ttimezones\x18\t \x01(\tR\ttimezones\x12\"\n" +
"\ftranslations\x18\n" +
" \x01(\tR\ftranslations\x12\x12\n" +
"\x04name\x18\v \x01(\tR\x04name\x12\x1d\n" +
"\n" +
"local_name\x18\f \x01(\tR\tlocalName\x12\x18\n" +
"\aenabled\x18\r \x01(\bR\aenabled\x12\x1d\n" +
"\n" +
"sort_order\x18\x0e \x01(\x05R\tsortOrder\"m\n" +
"\fAreasRequest\x12\x1d\n" +
"\n" +
"country_id\x18\x01 \x01(\x05R\tcountryId\x12!\n" +
"\fcountry_code\x18\x02 \x01(\tR\vcountryCode\x12\x1b\n" +
"\tshow_town\x18\x03 \x01(\bR\bshowTown\"6\n" +
"\n" +
"AreasReply\x12(\n" +
"\x05areas\x18\x01 \x03(\v2\x12.initial.AreasItemR\x05areas\"\xc4\x01\n" +
"\tAreasItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\x12\x10\n" +
"\x03pid\x18\x02 \x01(\tR\x03pid\x12\x12\n" +
"\x04deep\x18\x03 \x01(\x05R\x04deep\x12\x12\n" +
"\x04name\x18\x04 \x01(\tR\x04name\x12#\n" +
"\rpinyin_prefix\x18\x05 \x01(\tR\fpinyinPrefix\x12\x16\n" +
"\x06pinyin\x18\x06 \x01(\tR\x06pinyin\x12\x15\n" +
"\x06ext_id\x18\a \x01(\tR\x05extId\x12\x19\n" +
"\bext_name\x18\b \x01(\tR\aextName\"6\n" +
"\n" +
"DatasReply\x12(\n" +
"\x05datas\x18\x01 \x03(\v2\x12.initial.DatasItemR\x05datas\"\x8c\x01\n" +
"\tDatasItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1b\n" +
"\tdata_type\x18\x02 \x01(\tR\bdataType\x12\x10\n" +
"\x03key\x18\x03 \x01(\tR\x03key\x12\x14\n" +
"\x05title\x18\x04 \x01(\tR\x05title\x12\x16\n" +
"\x06remark\x18\x05 \x01(\tR\x06remark\x12\x12\n" +
"\x04icon\x18\x06 \x01(\tR\x04icon2\xa1\x01\n" +
"\x04Data\x122\n" +
"\aCountry\x12\x0e.initial.Empty\x1a\x15.initial.CountryReply\"\x00\x125\n" +
"\x05Areas\x12\x15.initial.AreasRequest\x1a\x13.initial.AreasReply\"\x00\x12.\n" +
"\x05Datas\x12\x0e.initial.Empty\x1a\x13.initial.DatasReply\"\x00B\vZ\t.;initialb\x06proto3"
var (
file_data_proto_rawDescOnce sync.Once
file_data_proto_rawDescData []byte
)
func file_data_proto_rawDescGZIP() []byte {
file_data_proto_rawDescOnce.Do(func() {
file_data_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_data_proto_rawDesc), len(file_data_proto_rawDesc)))
})
return file_data_proto_rawDescData
}
var file_data_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_data_proto_goTypes = []any{
(*Empty)(nil), // 0: initial.Empty
(*CountryReply)(nil), // 1: initial.CountryReply
(*CountryItem)(nil), // 2: initial.CountryItem
(*AreasRequest)(nil), // 3: initial.AreasRequest
(*AreasReply)(nil), // 4: initial.AreasReply
(*AreasItem)(nil), // 5: initial.AreasItem
(*DatasReply)(nil), // 6: initial.DatasReply
(*DatasItem)(nil), // 7: initial.DatasItem
}
var file_data_proto_depIdxs = []int32{
2, // 0: initial.CountryReply.countries:type_name -> initial.CountryItem
5, // 1: initial.AreasReply.areas:type_name -> initial.AreasItem
7, // 2: initial.DatasReply.datas:type_name -> initial.DatasItem
0, // 3: initial.Data.Country:input_type -> initial.Empty
3, // 4: initial.Data.Areas:input_type -> initial.AreasRequest
0, // 5: initial.Data.Datas:input_type -> initial.Empty
1, // 6: initial.Data.Country:output_type -> initial.CountryReply
4, // 7: initial.Data.Areas:output_type -> initial.AreasReply
6, // 8: initial.Data.Datas:output_type -> initial.DatasReply
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_data_proto_init() }
func file_data_proto_init() {
if File_data_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_data_proto_rawDesc), len(file_data_proto_rawDesc)),
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_data_proto_goTypes,
DependencyIndexes: file_data_proto_depIdxs,
MessageInfos: file_data_proto_msgTypes,
}.Build()
File_data_proto = out.File
file_data_proto_goTypes = nil
file_data_proto_depIdxs = nil
}

View File

@@ -0,0 +1,289 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: data.proto
/*
Package initial is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package initial
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Data_Country_0(ctx context.Context, marshaler runtime.Marshaler, client DataClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Country(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Data_Country_0(ctx context.Context, marshaler runtime.Marshaler, server DataServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Country(ctx, &protoReq)
return msg, metadata, err
}
func request_Data_Areas_0(ctx context.Context, marshaler runtime.Marshaler, client DataClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq AreasRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Areas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Data_Areas_0(ctx context.Context, marshaler runtime.Marshaler, server DataServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq AreasRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Areas(ctx, &protoReq)
return msg, metadata, err
}
func request_Data_Datas_0(ctx context.Context, marshaler runtime.Marshaler, client DataClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Datas(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Data_Datas_0(ctx context.Context, marshaler runtime.Marshaler, server DataServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Datas(ctx, &protoReq)
return msg, metadata, err
}
// RegisterDataHandlerServer registers the http handlers for service Data to "mux".
// UnaryRPC :call DataServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDataHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterDataHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DataServer) error {
mux.Handle(http.MethodPost, pattern_Data_Country_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/initial.Data/Country", runtime.WithHTTPPathPattern("/initial.Data/Country"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Data_Country_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Data_Country_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Data_Areas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/initial.Data/Areas", runtime.WithHTTPPathPattern("/initial.Data/Areas"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Data_Areas_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Data_Areas_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Data_Datas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/initial.Data/Datas", runtime.WithHTTPPathPattern("/initial.Data/Datas"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Data_Datas_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Data_Datas_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterDataHandlerFromEndpoint is same as RegisterDataHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDataHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterDataHandler(ctx, mux, conn)
}
// RegisterDataHandler registers the http handlers for service Data to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterDataHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterDataHandlerClient(ctx, mux, NewDataClient(conn))
}
// RegisterDataHandlerClient registers the http handlers for service Data
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DataClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DataClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "DataClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterDataHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DataClient) error {
mux.Handle(http.MethodPost, pattern_Data_Country_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/initial.Data/Country", runtime.WithHTTPPathPattern("/initial.Data/Country"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Data_Country_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Data_Country_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Data_Areas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/initial.Data/Areas", runtime.WithHTTPPathPattern("/initial.Data/Areas"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Data_Areas_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Data_Areas_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Data_Datas_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/initial.Data/Datas", runtime.WithHTTPPathPattern("/initial.Data/Datas"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Data_Datas_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Data_Datas_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Data_Country_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"initial.Data", "Country"}, ""))
pattern_Data_Areas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"initial.Data", "Areas"}, ""))
pattern_Data_Datas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"initial.Data", "Datas"}, ""))
)
var (
forward_Data_Country_0 = runtime.ForwardResponseMessage
forward_Data_Areas_0 = runtime.ForwardResponseMessage
forward_Data_Datas_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,205 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: data.proto
package initial
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Data_Country_FullMethodName = "/initial.Data/Country"
Data_Areas_FullMethodName = "/initial.Data/Areas"
Data_Datas_FullMethodName = "/initial.Data/Datas"
)
// DataClient is the client API for Data service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// initial-数据
type DataClient interface {
Country(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CountryReply, error)
// 系统区域数据,默认级别:市
Areas(ctx context.Context, in *AreasRequest, opts ...grpc.CallOption) (*AreasReply, error)
// 系统数据
Datas(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*DatasReply, error)
}
type dataClient struct {
cc grpc.ClientConnInterface
}
func NewDataClient(cc grpc.ClientConnInterface) DataClient {
return &dataClient{cc}
}
func (c *dataClient) Country(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CountryReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CountryReply)
err := c.cc.Invoke(ctx, Data_Country_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *dataClient) Areas(ctx context.Context, in *AreasRequest, opts ...grpc.CallOption) (*AreasReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AreasReply)
err := c.cc.Invoke(ctx, Data_Areas_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *dataClient) Datas(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*DatasReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DatasReply)
err := c.cc.Invoke(ctx, Data_Datas_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// DataServer is the server API for Data service.
// All implementations must embed UnimplementedDataServer
// for forward compatibility.
//
// initial-数据
type DataServer interface {
Country(context.Context, *Empty) (*CountryReply, error)
// 系统区域数据,默认级别:市
Areas(context.Context, *AreasRequest) (*AreasReply, error)
// 系统数据
Datas(context.Context, *Empty) (*DatasReply, error)
mustEmbedUnimplementedDataServer()
}
// UnimplementedDataServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedDataServer struct{}
func (UnimplementedDataServer) Country(context.Context, *Empty) (*CountryReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Country not implemented")
}
func (UnimplementedDataServer) Areas(context.Context, *AreasRequest) (*AreasReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Areas not implemented")
}
func (UnimplementedDataServer) Datas(context.Context, *Empty) (*DatasReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Datas not implemented")
}
func (UnimplementedDataServer) mustEmbedUnimplementedDataServer() {}
func (UnimplementedDataServer) testEmbeddedByValue() {}
// UnsafeDataServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DataServer will
// result in compilation errors.
type UnsafeDataServer interface {
mustEmbedUnimplementedDataServer()
}
func RegisterDataServer(s grpc.ServiceRegistrar, srv DataServer) {
// If the following call pancis, it indicates UnimplementedDataServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Data_ServiceDesc, srv)
}
func _Data_Country_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DataServer).Country(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Data_Country_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DataServer).Country(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Data_Areas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AreasRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DataServer).Areas(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Data_Areas_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DataServer).Areas(ctx, req.(*AreasRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Data_Datas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DataServer).Datas(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Data_Datas_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DataServer).Datas(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
// Data_ServiceDesc is the grpc.ServiceDesc for Data service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Data_ServiceDesc = grpc.ServiceDesc{
ServiceName: "initial.Data",
HandlerType: (*DataServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Country",
Handler: _Data_Country_Handler,
},
{
MethodName: "Areas",
Handler: _Data_Areas_Handler,
},
{
MethodName: "Datas",
Handler: _Data_Datas_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "data.proto",
}