gidpb

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Id_Generate_FullMethodName       = "/gid.Id/Generate"
	Id_TypeStream_FullMethodName     = "/gid.Id/TypeStream"
	Id_Types_FullMethodName          = "/gid.Id/Types"
	Id_PutTypes_FullMethodName       = "/gid.Id/PutTypes"
	Id_Chat_FullMethodName           = "/gid.Id/Chat"
	Id_Chat1_FullMethodName          = "/gid.Id/Chat1"
	Id_UploadDownload_FullMethodName = "/gid.Id/UploadDownload"
)

Variables

View Source
var (
	SrvCode_name = map[int32]string{
		0:   "OK",
		100: "IDGenerateFailed",
	}
	SrvCode_value = map[string]int32{
		"OK":               0,
		"IDGenerateFailed": 100,
	}
)

Enum value maps for SrvCode.

View Source
var (
	GenType_name = map[int32]string{
		0: "default",
		1: "uuid",
		2: "snowflake",
		3: "bigflake",
		4: "shortid",
	}
	GenType_value = map[string]int32{
		"default":   0,
		"uuid":      1,
		"snowflake": 2,
		"bigflake":  3,
		"shortid":   4,
	}
)

Enum value maps for GenType.

View Source
var ErrCodeIDGenerateFailed = &errorpb.ErrCode{
	Code:       int32(100),
	Message:    "id generate error",
	Name:       "gid.id_generate_failed",
	StatusCode: errorpb.Code_Internal,
}
View Source
var ErrCodeOK = &errorpb.ErrCode{
	Code:       int32(0),
	Message:    "ok",
	Name:       "gid.ok",
	StatusCode: errorpb.Code_OK,
}
View Source
var File_gid_id_proto protoreflect.FileDescriptor
View Source
var Id_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gid.Id",
	HandlerType: (*IdServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Generate",
			Handler:    _Id_Generate_Handler,
		},
		{
			MethodName: "Types",
			Handler:    _Id_Types_Handler,
		},
		{
			MethodName: "PutTypes",
			Handler:    _Id_PutTypes_Handler,
		},
		{
			MethodName: "UploadDownload",
			Handler:    _Id_UploadDownload_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "TypeStream",
			Handler:       _Id_TypeStream_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Chat",
			Handler:       _Id_Chat_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Chat1",
			Handler:       _Id_Chat1_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "gid/id.proto",
}

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

Functions

func RegisterIdServer

func RegisterIdServer(s grpc.ServiceRegistrar, srv IdServer)

Types

type ChatMessage

type ChatMessage struct {
	Name      string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	SessionId string   `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Msg       *Message `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

func (*ChatMessage) Descriptor deprecated

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

Deprecated: Use ChatMessage.ProtoReflect.Descriptor instead.

func (*ChatMessage) GetMsg

func (x *ChatMessage) GetMsg() *Message

func (*ChatMessage) GetName

func (x *ChatMessage) GetName() string

func (*ChatMessage) GetSessionId

func (x *ChatMessage) GetSessionId() string

func (*ChatMessage) ProtoMessage

func (*ChatMessage) ProtoMessage()

func (*ChatMessage) ProtoReflect

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

func (*ChatMessage) Reset

func (x *ChatMessage) Reset()

func (*ChatMessage) String

func (x *ChatMessage) String() string

type GenType

type GenType int32
const (
	GenType_default   GenType = 0
	GenType_uuid      GenType = 1
	GenType_snowflake GenType = 2
	GenType_bigflake  GenType = 3
	GenType_shortid   GenType = 4
)

func (GenType) Descriptor

func (GenType) Descriptor() protoreflect.EnumDescriptor

func (GenType) Enum

func (x GenType) Enum() *GenType

func (GenType) EnumDescriptor deprecated

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

Deprecated: Use GenType.Descriptor instead.

func (GenType) Number

func (x GenType) Number() protoreflect.EnumNumber

func (GenType) String

func (x GenType) String() string

func (GenType) Type

func (GenType) Type() protoreflect.EnumType

type GenerateRequest

type GenerateRequest struct {

	// type of id e.g uuid, shortid, snowflake (64 bit), bigflake (128 bit)
	Type GenType `protobuf:"varint,1,opt,name=type,proto3,enum=gid.GenType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

Generate a unique ID. Defaults to uuid.

func (*GenerateRequest) Descriptor deprecated

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

Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.

func (*GenerateRequest) GetType

func (x *GenerateRequest) GetType() GenType

func (*GenerateRequest) ProtoMessage

func (*GenerateRequest) ProtoMessage()

func (*GenerateRequest) ProtoReflect

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

func (*GenerateRequest) Reset

func (x *GenerateRequest) Reset()

func (*GenerateRequest) String

func (x *GenerateRequest) String() string

type GenerateResponse

type GenerateResponse struct {

	// the unique id generated
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// the type of id generated
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*GenerateResponse) Descriptor deprecated

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

Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.

func (*GenerateResponse) GetId

func (x *GenerateResponse) GetId() string

func (*GenerateResponse) GetType

func (x *GenerateResponse) GetType() string

func (*GenerateResponse) ProtoMessage

func (*GenerateResponse) ProtoMessage()

func (*GenerateResponse) ProtoReflect

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

func (*GenerateResponse) Reset

func (x *GenerateResponse) Reset()

func (*GenerateResponse) String

func (x *GenerateResponse) String() string

type IdClient

type IdClient interface {
	// Generate 生成ID
	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error)
	// 返回流
	TypeStream(ctx context.Context, in *TypesRequest, opts ...grpc.CallOption) (Id_TypeStreamClient, error)
	// Types id类型
	Types(ctx context.Context, in *TypesRequest, opts ...grpc.CallOption) (*TypesResponse, error)
	PutTypes(ctx context.Context, in *TypesRequest, opts ...grpc.CallOption) (*TypesResponse, error)
	// 聊天
	Chat(ctx context.Context, opts ...grpc.CallOption) (Id_ChatClient, error)
	// ws: chat1
	Chat1(ctx context.Context, opts ...grpc.CallOption) (Id_Chat1Client, error)
	UploadDownload(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
}

IdClient is the client API for Id 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 NewIdClient

func NewIdClient(cc grpc.ClientConnInterface) IdClient

type IdServer

type IdServer interface {
	// Generate 生成ID
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)
	// 返回流
	TypeStream(*TypesRequest, Id_TypeStreamServer) error
	// Types id类型
	Types(context.Context, *TypesRequest) (*TypesResponse, error)
	PutTypes(context.Context, *TypesRequest) (*TypesResponse, error)
	// 聊天
	Chat(Id_ChatServer) error
	// ws: chat1
	Chat1(Id_Chat1Server) error
	UploadDownload(context.Context, *UploadFileRequest) (*httpbody.HttpBody, error)
}

IdServer is the server API for Id service. All implementations should embed UnimplementedIdServer for forward compatibility

type Id_Chat1Client

type Id_Chat1Client interface {
	Send(*ChatMessage) error
	Recv() (*ChatMessage, error)
	grpc.ClientStream
}

type Id_Chat1Server

type Id_Chat1Server interface {
	Send(*ChatMessage) error
	Recv() (*ChatMessage, error)
	grpc.ServerStream
}

type Id_ChatClient

type Id_ChatClient interface {
	Send(*ChatMessage) error
	Recv() (*ChatMessage, error)
	grpc.ClientStream
}

type Id_ChatServer

type Id_ChatServer interface {
	Send(*ChatMessage) error
	Recv() (*ChatMessage, error)
	grpc.ServerStream
}

type Id_TypeStreamClient

type Id_TypeStreamClient interface {
	Recv() (*TypesResponse, error)
	grpc.ClientStream
}

type Id_TypeStreamServer

type Id_TypeStreamServer interface {
	Send(*TypesResponse) error
	grpc.ServerStream
}

type Message

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

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetName

func (x *Message) GetName() string

func (*Message) GetText

func (x *Message) GetText() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type SrvCode

type SrvCode int32
const (
	SrvCode_OK SrvCode = 0
	// id generate error
	SrvCode_IDGenerateFailed SrvCode = 100
)

func (SrvCode) Descriptor

func (SrvCode) Descriptor() protoreflect.EnumDescriptor

func (SrvCode) Enum

func (x SrvCode) Enum() *SrvCode

func (SrvCode) EnumDescriptor deprecated

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

Deprecated: Use SrvCode.Descriptor instead.

func (SrvCode) Number

func (x SrvCode) Number() protoreflect.EnumNumber

func (SrvCode) String

func (x SrvCode) String() string

func (SrvCode) Type

func (SrvCode) Type() protoreflect.EnumType

type TypesRequest

type TypesRequest struct {
	Name   string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	NameId uint64 `protobuf:"varint,2,opt,name=name_id,json=nameId,proto3" json:"name_id,omitempty"`
	Hello  string `protobuf:"bytes,3,opt,name=hello,proto3" json:"hello,omitempty"`
	// contains filtered or unexported fields
}

List the types of IDs available. No query params needed.

func (*TypesRequest) Descriptor deprecated

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

Deprecated: Use TypesRequest.ProtoReflect.Descriptor instead.

func (*TypesRequest) GetHello

func (x *TypesRequest) GetHello() string

func (*TypesRequest) GetName

func (x *TypesRequest) GetName() string

func (*TypesRequest) GetNameId

func (x *TypesRequest) GetNameId() uint64

func (*TypesRequest) ProtoMessage

func (*TypesRequest) ProtoMessage()

func (*TypesRequest) ProtoReflect

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

func (*TypesRequest) Reset

func (x *TypesRequest) Reset()

func (*TypesRequest) String

func (x *TypesRequest) String() string

type TypesResponse

type TypesResponse struct {
	Types []string `protobuf:"bytes,1,rep,name=types,proto3" json:"types,omitempty"`
	// contains filtered or unexported fields
}

TypesResponse 返回值类型

func (*TypesResponse) Descriptor deprecated

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

Deprecated: Use TypesResponse.ProtoReflect.Descriptor instead.

func (*TypesResponse) GetTypes

func (x *TypesResponse) GetTypes() []string

func (*TypesResponse) ProtoMessage

func (*TypesResponse) ProtoMessage()

func (*TypesResponse) ProtoReflect

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

func (*TypesResponse) Reset

func (x *TypesResponse) Reset()

func (*TypesResponse) String

func (x *TypesResponse) String() string

type UnimplementedIdServer

type UnimplementedIdServer struct {
}

UnimplementedIdServer should be embedded to have forward compatible implementations.

func (UnimplementedIdServer) Chat

func (UnimplementedIdServer) Chat1

func (UnimplementedIdServer) Generate

func (UnimplementedIdServer) PutTypes

func (UnimplementedIdServer) TypeStream

func (UnimplementedIdServer) Types

func (UnimplementedIdServer) UploadDownload

type UnsafeIdServer

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

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

type UploadFileRequest

type UploadFileRequest struct {
	Filename string             `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
	File     *httpbody.HttpBody `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"`
	// contains filtered or unexported fields
}

func (*UploadFileRequest) Descriptor deprecated

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

Deprecated: Use UploadFileRequest.ProtoReflect.Descriptor instead.

func (*UploadFileRequest) GetFile

func (x *UploadFileRequest) GetFile() *httpbody.HttpBody

func (*UploadFileRequest) GetFilename

func (x *UploadFileRequest) GetFilename() string

func (*UploadFileRequest) ProtoMessage

func (*UploadFileRequest) ProtoMessage()

func (*UploadFileRequest) ProtoReflect

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

func (*UploadFileRequest) Reset

func (x *UploadFileRequest) Reset()

func (*UploadFileRequest) String

func (x *UploadFileRequest) String() string

Jump to

Keyboard shortcuts

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