pb

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CMD_name = map[int32]string{
		0:        "INVALID",
		1001:     "GreeterHello",
		10000001: "Max",
	}
	CMD_value = map[string]int32{
		"INVALID":      0,
		"GreeterHello": 1001,
		"Max":          10000001,
	}
)

Enum value maps for CMD.

View Source
var (
	AuthType_name = map[int32]string{
		0: "AuthNone",
		1: "AuthUser",
		2: "AuthManager",
	}
	AuthType_value = map[string]int32{
		"AuthNone":    0,
		"AuthUser":    1,
		"AuthManager": 2,
	}
)

Enum value maps for AuthType.

View Source
var (
	ServiceName_name = map[int32]string{
		0: "ServerNone",
		1: "ServerGate",
		2: "ServiceLogin",
		3: "ServiceLogic",
	}
	ServiceName_value = map[string]int32{
		"ServerNone":   0,
		"ServerGate":   1,
		"ServiceLogin": 2,
		"ServiceLogic": 3,
	}
)

Enum value maps for ServiceName.

View Source
var (
	// See `ProtoIdRule`
	//
	// optional extend.ProtoIdRule id = 1001;
	E_Id = &file_extend_proto_extTypes[0]
	// 若 auth_method 定义则优先使用,否则使用 service 的定义
	//
	// optional extend.AuthType auth_method = 1002;
	E_AuthMethod = &file_extend_proto_extTypes[1]
)

Extension fields to descriptor.MethodOptions.

View Source
var (
	// optional extend.AuthType auth_service = 1002;
	E_AuthService = &file_extend_proto_extTypes[2]
	// optional extend.ServiceName service_name = 1004;
	E_ServiceName = &file_extend_proto_extTypes[3]
)

Extension fields to descriptor.ServiceOptions.

View Source
var (
	MethodRouter = map[string]*interfaces.MethodItem{
		"/v1/greeter/hello": {HTTP: "GET", Method: "Greeter.Hello", Auth: 0, Cmd: int32(CMD_GreeterHello)},
	}

	IdMsg = map[int32]*interfaces.ReqItem{
		int32(CMD_GreeterHello): {Req: func() proto.Message { return &HelloReq{} }, Rsp: func() proto.Message { return &HelloRsp{} }, Auth: 0, Name: "/v1/greeter/hello", HTTP: "GET"},
	}
)
View Source
var File_extend_proto protoreflect.FileDescriptor
View Source
var File_greeter_proto protoreflect.FileDescriptor
View Source
var Greeter_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Greeter",
	HandlerType: (*GreeterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hello",
			Handler:    _Greeter_Hello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "greeter.proto",
}

Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var MsgDef = &MsgDefStruct{}

Functions

func AddGreeterServerProvider

func AddGreeterServerProvider(svr GreeterServer)

func RegisterGreeterServer

func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)

Types

type AuthType

type AuthType int32

鉴权类型

const (
	AuthType_AuthNone    AuthType = 0 // 无鉴权
	AuthType_AuthUser    AuthType = 1 // 玩家鉴权
	AuthType_AuthManager AuthType = 2 // 内部管理接口
)

func (AuthType) Descriptor

func (AuthType) Descriptor() protoreflect.EnumDescriptor

func (AuthType) Enum

func (x AuthType) Enum() *AuthType

func (AuthType) EnumDescriptor deprecated

func (AuthType) EnumDescriptor() ([]byte, []int)

Deprecated: Use AuthType.Descriptor instead.

func (AuthType) Number

func (x AuthType) Number() protoreflect.EnumNumber

func (AuthType) String

func (x AuthType) String() string

func (AuthType) Type

type CMD

type CMD int32
const (
	CMD_INVALID      CMD = 0
	CMD_GreeterHello CMD = 1001
	CMD_Max          CMD = 10000001
)

func (CMD) Descriptor

func (CMD) Descriptor() protoreflect.EnumDescriptor

func (CMD) Enum

func (x CMD) Enum() *CMD

func (CMD) EnumDescriptor deprecated

func (CMD) EnumDescriptor() ([]byte, []int)

Deprecated: Use CMD.Descriptor instead.

func (CMD) Number

func (x CMD) Number() protoreflect.EnumNumber

func (CMD) String

func (x CMD) String() string

func (CMD) Type

func (CMD) Type() protoreflect.EnumType

type GreeterClient

type GreeterClient interface {
	// 客户端初始化接口
	Hello(ctx context.Context, in *HelloReq, opts ...grpc.CallOption) (*HelloRsp, error)
}

GreeterClient is the client API for Greeter 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.

func NewGreeterClient

func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient

func NewGreeterClientDiscovery

func NewGreeterClientDiscovery() (GreeterClient, error)

type GreeterServer

type GreeterServer interface {
	// 客户端初始化接口
	Hello(context.Context, *HelloReq) (*HelloRsp, error)
	// contains filtered or unexported methods
}

GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility

type HelloReq

type HelloReq struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloReq) Descriptor deprecated

func (*HelloReq) Descriptor() ([]byte, []int)

Deprecated: Use HelloReq.ProtoReflect.Descriptor instead.

func (*HelloReq) GetName

func (x *HelloReq) GetName() string

func (*HelloReq) ProtoMessage

func (*HelloReq) ProtoMessage()

func (*HelloReq) ProtoReflect

func (x *HelloReq) ProtoReflect() protoreflect.Message

func (*HelloReq) Reset

func (x *HelloReq) Reset()

func (*HelloReq) String

func (x *HelloReq) String() string

type HelloRsp

type HelloRsp struct {
	Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloRsp) Descriptor deprecated

func (*HelloRsp) Descriptor() ([]byte, []int)

Deprecated: Use HelloRsp.ProtoReflect.Descriptor instead.

func (*HelloRsp) GetMsg

func (x *HelloRsp) GetMsg() string

func (*HelloRsp) ProtoMessage

func (*HelloRsp) ProtoMessage()

func (*HelloRsp) ProtoReflect

func (x *HelloRsp) ProtoReflect() protoreflect.Message

func (*HelloRsp) Reset

func (x *HelloRsp) Reset()

func (*HelloRsp) String

func (x *HelloRsp) String() string

type MsgDefStruct

type MsgDefStruct struct{}

func (*MsgDefStruct) GetIdMsg

func (m *MsgDefStruct) GetIdMsg() map[int32]*interfaces.ReqItem

func (*MsgDefStruct) GetMethodRouter

func (m *MsgDefStruct) GetMethodRouter() map[string]*interfaces.MethodItem

type ProtoId

type ProtoId struct {
	Rules []*ProtoIdRule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
	// contains filtered or unexported fields
}

func (*ProtoId) Descriptor deprecated

func (*ProtoId) Descriptor() ([]byte, []int)

Deprecated: Use ProtoId.ProtoReflect.Descriptor instead.

func (*ProtoId) GetRules

func (x *ProtoId) GetRules() []*ProtoIdRule

func (*ProtoId) ProtoMessage

func (*ProtoId) ProtoMessage()

func (*ProtoId) ProtoReflect

func (x *ProtoId) ProtoReflect() protoreflect.Message

func (*ProtoId) Reset

func (x *ProtoId) Reset()

func (*ProtoId) String

func (x *ProtoId) String() string

type ProtoIdRule

type ProtoIdRule struct {
	Cmd CMD `protobuf:"varint,1,opt,name=cmd,proto3,enum=CMD" json:"cmd,omitempty"`
	// contains filtered or unexported fields
}

func (*ProtoIdRule) Descriptor deprecated

func (*ProtoIdRule) Descriptor() ([]byte, []int)

Deprecated: Use ProtoIdRule.ProtoReflect.Descriptor instead.

func (*ProtoIdRule) GetCmd

func (x *ProtoIdRule) GetCmd() CMD

func (*ProtoIdRule) ProtoMessage

func (*ProtoIdRule) ProtoMessage()

func (*ProtoIdRule) ProtoReflect

func (x *ProtoIdRule) ProtoReflect() protoreflect.Message

func (*ProtoIdRule) Reset

func (x *ProtoIdRule) Reset()

func (*ProtoIdRule) String

func (x *ProtoIdRule) String() string

type ServiceName

type ServiceName int32
const (
	ServiceName_ServerNone   ServiceName = 0
	ServiceName_ServerGate   ServiceName = 1
	ServiceName_ServiceLogin ServiceName = 2
	ServiceName_ServiceLogic ServiceName = 3
)

func (ServiceName) Descriptor

func (ServiceName) Enum

func (x ServiceName) Enum() *ServiceName

func (ServiceName) EnumDescriptor deprecated

func (ServiceName) EnumDescriptor() ([]byte, []int)

Deprecated: Use ServiceName.Descriptor instead.

func (ServiceName) Number

func (x ServiceName) Number() protoreflect.EnumNumber

func (ServiceName) String

func (x ServiceName) String() string

func (ServiceName) Type

type UnimplementedGreeterServer

type UnimplementedGreeterServer struct {
}

UnimplementedGreeterServer must be embedded to have forward compatible implementations.

func (UnimplementedGreeterServer) Hello

type UnsafeGreeterServer

type UnsafeGreeterServer interface {
	// contains filtered or unexported methods
}

UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GreeterServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL