pb

package
v0.0.0-...-f8f8a0c Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 8 Imported by: 0

README

# protoc-gen-go 可以识别基础的 protobuf 关键字
$ cd protobuf ## protobuf
$ protoc -I=. --go_out=./pb --go_opt=module="gitee.com/msens1/protobuf/pb" pb/hello.proto

# protoc-gen-go-grpc 可以识别基础的 service 等关键字
$ cd protobuf ## protobuf
$ protoc -I=. --go_out=./pb --go_opt=module="gitee.com/msens1/protobuf/pb" --go-grpc_out=./pb --go-grpc_opt=module="gitee.com/msens1/protobuf/pb" pb/hello_service.proto

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Blog_name = map[int32]string{
		0: "DRAFT",
		1: "PUBLISHED",
	}
	Blog_value = map[string]int32{
		"DRAFT":     0,
		"PUBLISHED": 1,
	}
)

Enum value maps for Blog.

View Source
var BlogService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hello.BlogService",
	HandlerType: (*BlogServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "QueryBlog",
			Handler:    _BlogService_QueryBlog_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pb/hello_rpc.proto",
}

BlogService_ServiceDesc is the grpc.ServiceDesc for BlogService 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 File_pb_hello_proto protoreflect.FileDescriptor
View Source
var File_pb_hello_rpc_proto protoreflect.FileDescriptor
View Source
var File_pb_hello_service_proto protoreflect.FileDescriptor
View Source
var HelloService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "hello.HelloService",
	HandlerType: (*HelloServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hello",
			Handler:    _HelloService_Hello_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pb/hello_service.proto",
}

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

Functions

func RegisterBlogServiceServer

func RegisterBlogServiceServer(s grpc.ServiceRegistrar, srv BlogServiceServer)

func RegisterHelloServiceServer

func RegisterHelloServiceServer(s grpc.ServiceRegistrar, srv HelloServiceServer)

Types

type Blog

type Blog int32
const (
	Blog_DRAFT     Blog = 0
	Blog_PUBLISHED Blog = 1
)

func (Blog) Descriptor

func (Blog) Descriptor() protoreflect.EnumDescriptor

func (Blog) Enum

func (x Blog) Enum() *Blog

func (Blog) EnumDescriptor deprecated

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

Deprecated: Use Blog.Descriptor instead.

func (Blog) Number

func (x Blog) Number() protoreflect.EnumNumber

func (Blog) String

func (x Blog) String() string

func (Blog) Type

func (Blog) Type() protoreflect.EnumType

type BlogServiceClient

type BlogServiceClient interface {
	QueryBlog(ctx context.Context, in *QueryBlogRequest, opts ...grpc.CallOption) (*BlogSet, error)
}

BlogServiceClient is the client API for BlogService 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 BlogServiceServer

type BlogServiceServer interface {
	QueryBlog(context.Context, *QueryBlogRequest) (*BlogSet, error)
	// contains filtered or unexported methods
}

BlogServiceServer is the server API for BlogService service. All implementations must embed UnimplementedBlogServiceServer for forward compatibility

type BlogSet

type BlogSet struct {
	BlogId    int64  `protobuf:"varint,1,opt,name=blog_id,json=blogId,proto3" json:"blog_id,omitempty"`
	BlogTitle string `protobuf:"bytes,2,opt,name=blog_title,json=blogTitle,proto3" json:"blog_title,omitempty"`
	// contains filtered or unexported fields
}

func (*BlogSet) Descriptor deprecated

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

Deprecated: Use BlogSet.ProtoReflect.Descriptor instead.

func (*BlogSet) GetBlogId

func (x *BlogSet) GetBlogId() int64

func (*BlogSet) GetBlogTitle

func (x *BlogSet) GetBlogTitle() string

func (*BlogSet) ProtoMessage

func (*BlogSet) ProtoMessage()

func (*BlogSet) ProtoReflect

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

func (*BlogSet) Reset

func (x *BlogSet) Reset()

func (*BlogSet) String

func (x *BlogSet) String() string

type HelloServiceClient

type HelloServiceClient interface {
	Hello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

HelloServiceClient is the client API for HelloService 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 HelloServiceServer

type HelloServiceServer interface {
	Hello(context.Context, *Request) (*Response, error)
	// contains filtered or unexported methods
}

HelloServiceServer is the server API for HelloService service. All implementations must embed UnimplementedHelloServiceServer for forward compatibility

type QueryBlogRequest

type QueryBlogRequest struct {
	PageSize   int64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	PageNumber int64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryBlogRequest) Descriptor deprecated

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

Deprecated: Use QueryBlogRequest.ProtoReflect.Descriptor instead.

func (*QueryBlogRequest) GetPageNumber

func (x *QueryBlogRequest) GetPageNumber() int64

func (*QueryBlogRequest) GetPageSize

func (x *QueryBlogRequest) GetPageSize() int64

func (*QueryBlogRequest) ProtoMessage

func (*QueryBlogRequest) ProtoMessage()

func (*QueryBlogRequest) ProtoReflect

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

func (*QueryBlogRequest) Reset

func (x *QueryBlogRequest) Reset()

func (*QueryBlogRequest) String

func (x *QueryBlogRequest) String() string

type Request

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

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetValue

func (x *Request) GetValue() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

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

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetValue

func (x *Response) GetValue() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type String

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

func (*String) Descriptor deprecated

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

Deprecated: Use String.ProtoReflect.Descriptor instead.

func (*String) GetValue

func (x *String) GetValue() string

func (*String) ProtoMessage

func (*String) ProtoMessage()

func (*String) ProtoReflect

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

func (*String) Reset

func (x *String) Reset()

func (*String) String

func (x *String) String() string

type UnimplementedBlogServiceServer

type UnimplementedBlogServiceServer struct {
}

UnimplementedBlogServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedBlogServiceServer) QueryBlog

type UnimplementedHelloServiceServer

type UnimplementedHelloServiceServer struct {
}

UnimplementedHelloServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedHelloServiceServer) Hello

type UnsafeBlogServiceServer

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

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

type UnsafeHelloServiceServer

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

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

Jump to

Keyboard shortcuts

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