修复:为 user-svc 添加健康检查和启动顺序控制
This commit is contained in:
8
backend/shared/go.mod
Normal file
8
backend/shared/go.mod
Normal file
@@ -0,0 +1,8 @@
|
||||
module shared
|
||||
|
||||
go 1.25.8
|
||||
|
||||
require (
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/lib/pq v1.10.9
|
||||
)
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"backend/shared/pkg/logger"
|
||||
"shared/pkg/logger"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
||||
572
backend/shared/proto/common/common.pb.go
Normal file
572
backend/shared/proto/common/common.pb.go
Normal file
@@ -0,0 +1,572 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.31.1
|
||||
// source: shared/proto/common/common.proto
|
||||
|
||||
package common
|
||||
|
||||
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 Response 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"`
|
||||
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Response) Reset() {
|
||||
*x = Response{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Response) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Response) ProtoMessage() {}
|
||||
|
||||
func (x *Response) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 Response.ProtoReflect.Descriptor instead.
|
||||
func (*Response) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Response) GetCode() int32 {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Response) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Response) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 分页请求
|
||||
type PaginationRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PaginationRequest) Reset() {
|
||||
*x = PaginationRequest{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PaginationRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PaginationRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PaginationRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 PaginationRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PaginationRequest) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PaginationRequest) GetPage() int32 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PaginationRequest) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 分页响应
|
||||
type PaginationResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
|
||||
Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
|
||||
PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
TotalPages int32 `protobuf:"varint,4,opt,name=total_pages,json=totalPages,proto3" json:"total_pages,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PaginationResponse) Reset() {
|
||||
*x = PaginationResponse{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PaginationResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PaginationResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PaginationResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 PaginationResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PaginationResponse) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *PaginationResponse) GetTotal() int32 {
|
||||
if x != nil {
|
||||
return x.Total
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PaginationResponse) GetPage() int32 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PaginationResponse) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PaginationResponse) GetTotalPages() int32 {
|
||||
if x != nil {
|
||||
return x.TotalPages
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 错误信息
|
||||
type Error 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"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Error) Reset() {
|
||||
*x = Error{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Error) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Error) ProtoMessage() {}
|
||||
|
||||
func (x *Error) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 Error.ProtoReflect.Descriptor instead.
|
||||
func (*Error) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *Error) GetCode() int32 {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Error) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Error) GetDetails() string {
|
||||
if x != nil {
|
||||
return x.Details
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 空请求
|
||||
type EmptyRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *EmptyRequest) Reset() {
|
||||
*x = EmptyRequest{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *EmptyRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EmptyRequest) ProtoMessage() {}
|
||||
|
||||
func (x *EmptyRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 EmptyRequest.ProtoReflect.Descriptor instead.
|
||||
func (*EmptyRequest) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
// 空响应
|
||||
type EmptyResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *EmptyResponse) Reset() {
|
||||
*x = EmptyResponse{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *EmptyResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EmptyResponse) ProtoMessage() {}
|
||||
|
||||
func (x *EmptyResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 EmptyResponse.ProtoReflect.Descriptor instead.
|
||||
func (*EmptyResponse) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
// ID 请求
|
||||
type IDRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IDRequest) Reset() {
|
||||
*x = IDRequest{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IDRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IDRequest) ProtoMessage() {}
|
||||
|
||||
func (x *IDRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 IDRequest.ProtoReflect.Descriptor instead.
|
||||
func (*IDRequest) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *IDRequest) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ID 响应
|
||||
type IDResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IDResponse) Reset() {
|
||||
*x = IDResponse{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IDResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IDResponse) ProtoMessage() {}
|
||||
|
||||
func (x *IDResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_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 IDResponse.ProtoReflect.Descriptor instead.
|
||||
func (*IDResponse) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *IDResponse) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 状态响应
|
||||
type StatusResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *StatusResponse) Reset() {
|
||||
*x = StatusResponse{}
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *StatusResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StatusResponse) ProtoMessage() {}
|
||||
|
||||
func (x *StatusResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_common_common_proto_msgTypes[8]
|
||||
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 StatusResponse.ProtoReflect.Descriptor instead.
|
||||
func (*StatusResponse) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_common_common_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *StatusResponse) GetSuccess() bool {
|
||||
if x != nil {
|
||||
return x.Success
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *StatusResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_shared_proto_common_common_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_shared_proto_common_common_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" shared/proto/common/common.proto\x12\x06common\"L\n" +
|
||||
"\bResponse\x12\x12\n" +
|
||||
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
|
||||
"\amessage\x18\x02 \x01(\tR\amessage\x12\x12\n" +
|
||||
"\x04data\x18\x03 \x01(\fR\x04data\"D\n" +
|
||||
"\x11PaginationRequest\x12\x12\n" +
|
||||
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x1b\n" +
|
||||
"\tpage_size\x18\x02 \x01(\x05R\bpageSize\"|\n" +
|
||||
"\x12PaginationResponse\x12\x14\n" +
|
||||
"\x05total\x18\x01 \x01(\x05R\x05total\x12\x12\n" +
|
||||
"\x04page\x18\x02 \x01(\x05R\x04page\x12\x1b\n" +
|
||||
"\tpage_size\x18\x03 \x01(\x05R\bpageSize\x12\x1f\n" +
|
||||
"\vtotal_pages\x18\x04 \x01(\x05R\n" +
|
||||
"totalPages\"O\n" +
|
||||
"\x05Error\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\"\x0e\n" +
|
||||
"\fEmptyRequest\"\x0f\n" +
|
||||
"\rEmptyResponse\"\x1b\n" +
|
||||
"\tIDRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\"\x1c\n" +
|
||||
"\n" +
|
||||
"IDResponse\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\"D\n" +
|
||||
"\x0eStatusResponse\x12\x18\n" +
|
||||
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" +
|
||||
"\amessage\x18\x02 \x01(\tR\amessageB\x15Z\x13shared/proto/commonb\x06proto3"
|
||||
|
||||
var (
|
||||
file_shared_proto_common_common_proto_rawDescOnce sync.Once
|
||||
file_shared_proto_common_common_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_shared_proto_common_common_proto_rawDescGZIP() []byte {
|
||||
file_shared_proto_common_common_proto_rawDescOnce.Do(func() {
|
||||
file_shared_proto_common_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_shared_proto_common_common_proto_rawDesc), len(file_shared_proto_common_common_proto_rawDesc)))
|
||||
})
|
||||
return file_shared_proto_common_common_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_shared_proto_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_shared_proto_common_common_proto_goTypes = []any{
|
||||
(*Response)(nil), // 0: common.Response
|
||||
(*PaginationRequest)(nil), // 1: common.PaginationRequest
|
||||
(*PaginationResponse)(nil), // 2: common.PaginationResponse
|
||||
(*Error)(nil), // 3: common.Error
|
||||
(*EmptyRequest)(nil), // 4: common.EmptyRequest
|
||||
(*EmptyResponse)(nil), // 5: common.EmptyResponse
|
||||
(*IDRequest)(nil), // 6: common.IDRequest
|
||||
(*IDResponse)(nil), // 7: common.IDResponse
|
||||
(*StatusResponse)(nil), // 8: common.StatusResponse
|
||||
}
|
||||
var file_shared_proto_common_common_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_shared_proto_common_common_proto_init() }
|
||||
func file_shared_proto_common_common_proto_init() {
|
||||
if File_shared_proto_common_common_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_shared_proto_common_common_proto_rawDesc), len(file_shared_proto_common_common_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_shared_proto_common_common_proto_goTypes,
|
||||
DependencyIndexes: file_shared_proto_common_common_proto_depIdxs,
|
||||
MessageInfos: file_shared_proto_common_common_proto_msgTypes,
|
||||
}.Build()
|
||||
File_shared_proto_common_common_proto = out.File
|
||||
file_shared_proto_common_common_proto_goTypes = nil
|
||||
file_shared_proto_common_common_proto_depIdxs = nil
|
||||
}
|
||||
@@ -2,6 +2,8 @@ syntax = "proto3";
|
||||
|
||||
package common;
|
||||
|
||||
option go_package = "shared/proto/common";
|
||||
|
||||
// 通用响应结构
|
||||
message Response {
|
||||
int32 code = 1;
|
||||
|
||||
323
backend/shared/proto/user/user.pb.go
Normal file
323
backend/shared/proto/user/user.pb.go
Normal file
@@ -0,0 +1,323 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.31.1
|
||||
// source: shared/proto/user/user.proto
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
common "shared/proto/common"
|
||||
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 RegisterRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) Reset() {
|
||||
*x = RegisterRequest{}
|
||||
mi := &file_shared_proto_user_user_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RegisterRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RegisterRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_user_user_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 RegisterRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RegisterRequest) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_user_user_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) GetAccount() string {
|
||||
if x != nil {
|
||||
return x.Account
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterRequest) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 注册响应
|
||||
type RegisterResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
|
||||
Response *common.Response `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) Reset() {
|
||||
*x = RegisterResponse{}
|
||||
mi := &file_shared_proto_user_user_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RegisterResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RegisterResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_user_user_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 RegisterResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RegisterResponse) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_user_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) GetAccount() string {
|
||||
if x != nil {
|
||||
return x.Account
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RegisterResponse) GetResponse() *common.Response {
|
||||
if x != nil {
|
||||
return x.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取用户信息请求
|
||||
type GetUserByAccountRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Account string `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountRequest) Reset() {
|
||||
*x = GetUserByAccountRequest{}
|
||||
mi := &file_shared_proto_user_user_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserByAccountRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserByAccountRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_user_user_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 GetUserByAccountRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserByAccountRequest) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_user_user_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountRequest) GetAccount() string {
|
||||
if x != nil {
|
||||
return x.Account
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 获取用户信息响应
|
||||
type GetUserByAccountResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"`
|
||||
Response *common.Response `protobuf:"bytes,3,opt,name=response,proto3" json:"response,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountResponse) Reset() {
|
||||
*x = GetUserByAccountResponse{}
|
||||
mi := &file_shared_proto_user_user_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserByAccountResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserByAccountResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_shared_proto_user_user_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 GetUserByAccountResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserByAccountResponse) Descriptor() ([]byte, []int) {
|
||||
return file_shared_proto_user_user_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountResponse) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountResponse) GetAccount() string {
|
||||
if x != nil {
|
||||
return x.Account
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetUserByAccountResponse) GetResponse() *common.Response {
|
||||
if x != nil {
|
||||
return x.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_shared_proto_user_user_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_shared_proto_user_user_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1cshared/proto/user/user.proto\x12\x04user\x1a shared/proto/common/common.proto\"G\n" +
|
||||
"\x0fRegisterRequest\x12\x18\n" +
|
||||
"\aaccount\x18\x01 \x01(\tR\aaccount\x12\x1a\n" +
|
||||
"\bpassword\x18\x02 \x01(\tR\bpassword\"s\n" +
|
||||
"\x10RegisterResponse\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\tR\x06userId\x12\x18\n" +
|
||||
"\aaccount\x18\x02 \x01(\tR\aaccount\x12,\n" +
|
||||
"\bresponse\x18\x03 \x01(\v2\x10.common.ResponseR\bresponse\"3\n" +
|
||||
"\x17GetUserByAccountRequest\x12\x18\n" +
|
||||
"\aaccount\x18\x01 \x01(\tR\aaccount\"{\n" +
|
||||
"\x18GetUserByAccountResponse\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\tR\x06userId\x12\x18\n" +
|
||||
"\aaccount\x18\x02 \x01(\tR\aaccount\x12,\n" +
|
||||
"\bresponse\x18\x03 \x01(\v2\x10.common.ResponseR\bresponse2\x9b\x01\n" +
|
||||
"\vUserService\x129\n" +
|
||||
"\bRegister\x12\x15.user.RegisterRequest\x1a\x16.user.RegisterResponse\x12Q\n" +
|
||||
"\x10GetUserByAccount\x12\x1d.user.GetUserByAccountRequest\x1a\x1e.user.GetUserByAccountResponseB\x13Z\x11shared/proto/userb\x06proto3"
|
||||
|
||||
var (
|
||||
file_shared_proto_user_user_proto_rawDescOnce sync.Once
|
||||
file_shared_proto_user_user_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_shared_proto_user_user_proto_rawDescGZIP() []byte {
|
||||
file_shared_proto_user_user_proto_rawDescOnce.Do(func() {
|
||||
file_shared_proto_user_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_shared_proto_user_user_proto_rawDesc), len(file_shared_proto_user_user_proto_rawDesc)))
|
||||
})
|
||||
return file_shared_proto_user_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_shared_proto_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_shared_proto_user_user_proto_goTypes = []any{
|
||||
(*RegisterRequest)(nil), // 0: user.RegisterRequest
|
||||
(*RegisterResponse)(nil), // 1: user.RegisterResponse
|
||||
(*GetUserByAccountRequest)(nil), // 2: user.GetUserByAccountRequest
|
||||
(*GetUserByAccountResponse)(nil), // 3: user.GetUserByAccountResponse
|
||||
(*common.Response)(nil), // 4: common.Response
|
||||
}
|
||||
var file_shared_proto_user_user_proto_depIdxs = []int32{
|
||||
4, // 0: user.RegisterResponse.response:type_name -> common.Response
|
||||
4, // 1: user.GetUserByAccountResponse.response:type_name -> common.Response
|
||||
0, // 2: user.UserService.Register:input_type -> user.RegisterRequest
|
||||
2, // 3: user.UserService.GetUserByAccount:input_type -> user.GetUserByAccountRequest
|
||||
1, // 4: user.UserService.Register:output_type -> user.RegisterResponse
|
||||
3, // 5: user.UserService.GetUserByAccount:output_type -> user.GetUserByAccountResponse
|
||||
4, // [4:6] is the sub-list for method output_type
|
||||
2, // [2:4] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_shared_proto_user_user_proto_init() }
|
||||
func file_shared_proto_user_user_proto_init() {
|
||||
if File_shared_proto_user_user_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_shared_proto_user_user_proto_rawDesc), len(file_shared_proto_user_user_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_shared_proto_user_user_proto_goTypes,
|
||||
DependencyIndexes: file_shared_proto_user_user_proto_depIdxs,
|
||||
MessageInfos: file_shared_proto_user_user_proto_msgTypes,
|
||||
}.Build()
|
||||
File_shared_proto_user_user_proto = out.File
|
||||
file_shared_proto_user_user_proto_goTypes = nil
|
||||
file_shared_proto_user_user_proto_depIdxs = nil
|
||||
}
|
||||
40
backend/shared/proto/user/user.proto
Normal file
40
backend/shared/proto/user/user.proto
Normal file
@@ -0,0 +1,40 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package user;
|
||||
|
||||
option go_package = "shared/proto/user";
|
||||
|
||||
import "shared/proto/common/common.proto";
|
||||
|
||||
// 用户服务
|
||||
service UserService {
|
||||
// 注册用户
|
||||
rpc Register(RegisterRequest) returns (RegisterResponse);
|
||||
// 获取用户信息
|
||||
rpc GetUserByAccount(GetUserByAccountRequest) returns (GetUserByAccountResponse);
|
||||
}
|
||||
|
||||
// 注册请求
|
||||
message RegisterRequest {
|
||||
string account = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
// 注册响应
|
||||
message RegisterResponse {
|
||||
string user_id = 1;
|
||||
string account = 2;
|
||||
common.Response response = 3;
|
||||
}
|
||||
|
||||
// 获取用户信息请求
|
||||
message GetUserByAccountRequest {
|
||||
string account = 1;
|
||||
}
|
||||
|
||||
// 获取用户信息响应
|
||||
message GetUserByAccountResponse {
|
||||
string user_id = 1;
|
||||
string account = 2;
|
||||
common.Response response = 3;
|
||||
}
|
||||
167
backend/shared/proto/user/user_grpc.pb.go
Normal file
167
backend/shared/proto/user/user_grpc.pb.go
Normal file
@@ -0,0 +1,167 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v6.31.1
|
||||
// source: shared/proto/user/user.proto
|
||||
|
||||
package user
|
||||
|
||||
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 (
|
||||
UserService_Register_FullMethodName = "/user.UserService/Register"
|
||||
UserService_GetUserByAccount_FullMethodName = "/user.UserService/GetUserByAccount"
|
||||
)
|
||||
|
||||
// UserServiceClient is the client API for UserService 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.
|
||||
//
|
||||
// 用户服务
|
||||
type UserServiceClient interface {
|
||||
// 注册用户
|
||||
Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
|
||||
// 获取用户信息
|
||||
GetUserByAccount(ctx context.Context, in *GetUserByAccountRequest, opts ...grpc.CallOption) (*GetUserByAccountResponse, error)
|
||||
}
|
||||
|
||||
type userServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
|
||||
return &userServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *userServiceClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RegisterResponse)
|
||||
err := c.cc.Invoke(ctx, UserService_Register_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userServiceClient) GetUserByAccount(ctx context.Context, in *GetUserByAccountRequest, opts ...grpc.CallOption) (*GetUserByAccountResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetUserByAccountResponse)
|
||||
err := c.cc.Invoke(ctx, UserService_GetUserByAccount_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UserServiceServer is the server API for UserService service.
|
||||
// All implementations must embed UnimplementedUserServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// 用户服务
|
||||
type UserServiceServer interface {
|
||||
// 注册用户
|
||||
Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
|
||||
// 获取用户信息
|
||||
GetUserByAccount(context.Context, *GetUserByAccountRequest) (*GetUserByAccountResponse, error)
|
||||
mustEmbedUnimplementedUserServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedUserServiceServer 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 UnimplementedUserServiceServer struct{}
|
||||
|
||||
func (UnimplementedUserServiceServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Register not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) GetUserByAccount(context.Context, *GetUserByAccountRequest) (*GetUserByAccountResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetUserByAccount not implemented")
|
||||
}
|
||||
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
|
||||
func (UnimplementedUserServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to UserServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeUserServiceServer interface {
|
||||
mustEmbedUnimplementedUserServiceServer()
|
||||
}
|
||||
|
||||
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedUserServiceServer 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(&UserService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _UserService_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).Register(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserService_Register_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).Register(ctx, req.(*RegisterRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserService_GetUserByAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserByAccountRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServiceServer).GetUserByAccount(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserService_GetUserByAccount_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServiceServer).GetUserByAccount(ctx, req.(*GetUserByAccountRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var UserService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "user.UserService",
|
||||
HandlerType: (*UserServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Register",
|
||||
Handler: _UserService_Register_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserByAccount",
|
||||
Handler: _UserService_GetUserByAccount_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "shared/proto/user/user.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user