init
This commit is contained in:
commit
ee2718a1d0
17 files changed
+5264
No files matched your search
@@ -0,0 +1,23 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"example.com/layout/proto/discovery"
|
||||
"example.com/layout/proto/micro_layout/proto/user"
|
||||
)
|
||||
|
||||
const ServiceName = "micro.micro_layout"
|
||||
|
||||
type MicroLayoutClient struct {
|
||||
User user.UserClient
|
||||
connection *discovery.Connection
|
||||
}
|
||||
|
||||
func NewMicroLayoutClient(cfg discovery.Config, service string) (*MicroLayoutClient, error) {
|
||||
connection, err := discovery.Dial(cfg, service)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &MicroLayoutClient{User: user.NewUserClient(connection.Conn), connection: connection}, nil
|
||||
}
|
||||
|
||||
func (client *MicroLayoutClient) Close() error { return client.connection.Close() }
|
||||
@@ -0,0 +1,346 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.12
|
||||
// protoc v7.34.0
|
||||
// source: micro_layout/proto/user/user.proto
|
||||
|
||||
package user
|
||||
|
||||
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 CreateRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateRequest) Reset() {
|
||||
*x = CreateRequest{}
|
||||
mi := &file_micro_layout_proto_user_user_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_micro_layout_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 CreateRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateRequest) Descriptor() ([]byte, []int) {
|
||||
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CreateRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Item *UserItem `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateResponse) Reset() {
|
||||
*x = CreateResponse{}
|
||||
mi := &file_micro_layout_proto_user_user_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_micro_layout_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 CreateResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateResponse) Descriptor() ([]byte, []int) {
|
||||
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateResponse) GetItem() *UserItem {
|
||||
if x != nil {
|
||||
return x.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type QueryInfoRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryInfoRequest) Reset() {
|
||||
*x = QueryInfoRequest{}
|
||||
mi := &file_micro_layout_proto_user_user_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryInfoRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryInfoRequest) ProtoMessage() {}
|
||||
|
||||
func (x *QueryInfoRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_micro_layout_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 QueryInfoRequest.ProtoReflect.Descriptor instead.
|
||||
func (*QueryInfoRequest) Descriptor() ([]byte, []int) {
|
||||
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *QueryInfoRequest) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type QueryInfoResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"`
|
||||
Item *UserItem `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryInfoResponse) Reset() {
|
||||
*x = QueryInfoResponse{}
|
||||
mi := &file_micro_layout_proto_user_user_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryInfoResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryInfoResponse) ProtoMessage() {}
|
||||
|
||||
func (x *QueryInfoResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_micro_layout_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 QueryInfoResponse.ProtoReflect.Descriptor instead.
|
||||
func (*QueryInfoResponse) Descriptor() ([]byte, []int) {
|
||||
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *QueryInfoResponse) GetExists() bool {
|
||||
if x != nil {
|
||||
return x.Exists
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *QueryInfoResponse) GetItem() *UserItem {
|
||||
if x != nil {
|
||||
return x.Item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UserItem struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UserItem) Reset() {
|
||||
*x = UserItem{}
|
||||
mi := &file_micro_layout_proto_user_user_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UserItem) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserItem) ProtoMessage() {}
|
||||
|
||||
func (x *UserItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_micro_layout_proto_user_user_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 UserItem.ProtoReflect.Descriptor instead.
|
||||
func (*UserItem) Descriptor() ([]byte, []int) {
|
||||
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *UserItem) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UserItem) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserItem) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_micro_layout_proto_user_user_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_micro_layout_proto_user_user_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\"micro_layout/proto/user/user.proto\x12\x17micro.micro_layout.user\"#\n" +
|
||||
"\rCreateRequest\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\"G\n" +
|
||||
"\x0eCreateResponse\x125\n" +
|
||||
"\x04item\x18\x01 \x01(\v2!.micro.micro_layout.user.UserItemR\x04item\"\"\n" +
|
||||
"\x10QueryInfoRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\"b\n" +
|
||||
"\x11QueryInfoResponse\x12\x16\n" +
|
||||
"\x06exists\x18\x01 \x01(\bR\x06exists\x125\n" +
|
||||
"\x04item\x18\x02 \x01(\v2!.micro.micro_layout.user.UserItemR\x04item\"F\n" +
|
||||
"\bUserItem\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" +
|
||||
"\x06status\x18\x03 \x01(\tR\x06status2\xc9\x01\n" +
|
||||
"\x04User\x12[\n" +
|
||||
"\x06Create\x12&.micro.micro_layout.user.CreateRequest\x1a'.micro.micro_layout.user.CreateResponse\"\x00\x12d\n" +
|
||||
"\tQueryInfo\x12).micro.micro_layout.user.QueryInfoRequest\x1a*.micro.micro_layout.user.QueryInfoResponse\"\x00B2Z0example.com/layout/proto/micro_layout/proto/userb\x06proto3"
|
||||
|
||||
var (
|
||||
file_micro_layout_proto_user_user_proto_rawDescOnce sync.Once
|
||||
file_micro_layout_proto_user_user_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_micro_layout_proto_user_user_proto_rawDescGZIP() []byte {
|
||||
file_micro_layout_proto_user_user_proto_rawDescOnce.Do(func() {
|
||||
file_micro_layout_proto_user_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_micro_layout_proto_user_user_proto_rawDesc), len(file_micro_layout_proto_user_user_proto_rawDesc)))
|
||||
})
|
||||
return file_micro_layout_proto_user_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_micro_layout_proto_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_micro_layout_proto_user_user_proto_goTypes = []any{
|
||||
(*CreateRequest)(nil), // 0: micro.micro_layout.user.CreateRequest
|
||||
(*CreateResponse)(nil), // 1: micro.micro_layout.user.CreateResponse
|
||||
(*QueryInfoRequest)(nil), // 2: micro.micro_layout.user.QueryInfoRequest
|
||||
(*QueryInfoResponse)(nil), // 3: micro.micro_layout.user.QueryInfoResponse
|
||||
(*UserItem)(nil), // 4: micro.micro_layout.user.UserItem
|
||||
}
|
||||
var file_micro_layout_proto_user_user_proto_depIdxs = []int32{
|
||||
4, // 0: micro.micro_layout.user.CreateResponse.item:type_name -> micro.micro_layout.user.UserItem
|
||||
4, // 1: micro.micro_layout.user.QueryInfoResponse.item:type_name -> micro.micro_layout.user.UserItem
|
||||
0, // 2: micro.micro_layout.user.User.Create:input_type -> micro.micro_layout.user.CreateRequest
|
||||
2, // 3: micro.micro_layout.user.User.QueryInfo:input_type -> micro.micro_layout.user.QueryInfoRequest
|
||||
1, // 4: micro.micro_layout.user.User.Create:output_type -> micro.micro_layout.user.CreateResponse
|
||||
3, // 5: micro.micro_layout.user.User.QueryInfo:output_type -> micro.micro_layout.user.QueryInfoResponse
|
||||
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_micro_layout_proto_user_user_proto_init() }
|
||||
func file_micro_layout_proto_user_user_proto_init() {
|
||||
if File_micro_layout_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_micro_layout_proto_user_user_proto_rawDesc), len(file_micro_layout_proto_user_user_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_micro_layout_proto_user_user_proto_goTypes,
|
||||
DependencyIndexes: file_micro_layout_proto_user_user_proto_depIdxs,
|
||||
MessageInfos: file_micro_layout_proto_user_user_proto_msgTypes,
|
||||
}.Build()
|
||||
File_micro_layout_proto_user_user_proto = out.File
|
||||
file_micro_layout_proto_user_user_proto_goTypes = nil
|
||||
file_micro_layout_proto_user_user_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package micro.micro_layout.user;
|
||||
|
||||
option go_package = "example.com/layout/proto/micro_layout/proto/user";
|
||||
|
||||
service User {
|
||||
rpc Create(CreateRequest) returns (CreateResponse) {}
|
||||
rpc QueryInfo(QueryInfoRequest) returns (QueryInfoResponse) {}
|
||||
}
|
||||
|
||||
message CreateRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message CreateResponse {
|
||||
UserItem item = 1;
|
||||
}
|
||||
|
||||
message QueryInfoRequest {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message QueryInfoResponse {
|
||||
bool exists = 1;
|
||||
UserItem item = 2;
|
||||
}
|
||||
|
||||
message UserItem {
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string status = 3;
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v7.34.0
|
||||
// source: micro_layout/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 (
|
||||
User_Create_FullMethodName = "/micro.micro_layout.user.User/Create"
|
||||
User_QueryInfo_FullMethodName = "/micro.micro_layout.user.User/QueryInfo"
|
||||
)
|
||||
|
||||
// UserClient is the client API for User 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 UserClient interface {
|
||||
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
|
||||
QueryInfo(ctx context.Context, in *QueryInfoRequest, opts ...grpc.CallOption) (*QueryInfoResponse, error)
|
||||
}
|
||||
|
||||
type userClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewUserClient(cc grpc.ClientConnInterface) UserClient {
|
||||
return &userClient{cc}
|
||||
}
|
||||
|
||||
func (c *userClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CreateResponse)
|
||||
err := c.cc.Invoke(ctx, User_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userClient) QueryInfo(ctx context.Context, in *QueryInfoRequest, opts ...grpc.CallOption) (*QueryInfoResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(QueryInfoResponse)
|
||||
err := c.cc.Invoke(ctx, User_QueryInfo_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UserServer is the server API for User service.
|
||||
// All implementations must embed UnimplementedUserServer
|
||||
// for forward compatibility.
|
||||
type UserServer interface {
|
||||
Create(context.Context, *CreateRequest) (*CreateResponse, error)
|
||||
QueryInfo(context.Context, *QueryInfoRequest) (*QueryInfoResponse, error)
|
||||
mustEmbedUnimplementedUserServer()
|
||||
}
|
||||
|
||||
// UnimplementedUserServer 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 UnimplementedUserServer struct{}
|
||||
|
||||
func (UnimplementedUserServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) QueryInfo(context.Context, *QueryInfoRequest) (*QueryInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QueryInfo not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
|
||||
func (UnimplementedUserServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to UserServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeUserServer interface {
|
||||
mustEmbedUnimplementedUserServer()
|
||||
}
|
||||
|
||||
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
|
||||
// If the following call pancis, it indicates UnimplementedUserServer 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(&User_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _User_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: User_Create_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).Create(ctx, req.(*CreateRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _User_QueryInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).QueryInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: User_QueryInfo_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).QueryInfo(ctx, req.(*QueryInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// User_ServiceDesc is the grpc.ServiceDesc for User service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var User_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "micro.micro_layout.user.User",
|
||||
HandlerType: (*UserServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Create",
|
||||
Handler: _User_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "QueryInfo",
|
||||
Handler: _User_QueryInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "micro_layout/proto/user/user.proto",
|
||||
}
|
||||
Reference in new issue
Block a user