Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterPostServiceServer(s grpc.ServiceRegistrar, srv PostServiceServer)
- func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
- type Gender
- type Post
- func (*Post) Descriptor() ([]byte, []int)deprecated
- func (x *Post) GetAuthor() *User
- func (x *Post) GetContent() string
- func (x *Post) GetDescription() string
- func (x *Post) GetId() int32
- func (x *Post) GetTitle() string
- func (*Post) ProtoMessage()
- func (x *Post) ProtoReflect() protoreflect.Message
- func (x *Post) Reset()
- func (x *Post) String() string
- type PostQuery
- type PostSearchResult
- type PostServiceClient
- type PostServiceServer
- type PostsQuery
- type UnimplementedPostServiceServer
- type UnimplementedUserServiceServer
- type UnsafePostServiceServer
- type UnsafeUserServiceServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetAge() int32
- func (x *User) GetEmail() string
- func (x *User) GetGender() Gender
- func (x *User) GetId() string
- func (x *User) GetName() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type UserQuery
- type UserQueryResult
- type UserServiceClient
- type UserServiceServer
- type UsersQuery
- func (*UsersQuery) Descriptor() ([]byte, []int)deprecated
- func (x *UsersQuery) GetGender() Gender
- func (x *UsersQuery) GetMaxAge() int32
- func (x *UsersQuery) GetMinAge() int32
- func (*UsersQuery) ProtoMessage()
- func (x *UsersQuery) ProtoReflect() protoreflect.Message
- func (x *UsersQuery) Reset()
- func (x *UsersQuery) String() string
Constants ¶
const ( PostService_GetPost_FullMethodName = "/github.ayonli.ngrpc.services.PostService/GetPost" PostService_SearchPosts_FullMethodName = "/github.ayonli.ngrpc.services.PostService/SearchPosts" )
const ( UserService_GetUser_FullMethodName = "/github.ayonli.ngrpc.services.UserService/GetUser" UserService_GetUsers_FullMethodName = "/github.ayonli.ngrpc.services.UserService/GetUsers" UserService_GetMyPosts_FullMethodName = "/github.ayonli.ngrpc.services.UserService/GetMyPosts" )
Variables ¶
var ( Gender_name = map[int32]string{ 0: "UNKNOWN", 1: "MALE", 2: "FEMALE", } Gender_value = map[string]int32{ "UNKNOWN": 0, "MALE": 1, "FEMALE": 2, } )
Enum value maps for Gender.
var File_github_ayonli_ngrpc_services_PostService_proto protoreflect.FileDescriptor
var File_github_ayonli_ngrpc_services_UserService_proto protoreflect.FileDescriptor
var File_github_ayonli_ngrpc_services_struct_proto protoreflect.FileDescriptor
var PostService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "github.ayonli.ngrpc.services.PostService", HandlerType: (*PostServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetPost", Handler: _PostService_GetPost_Handler, }, { MethodName: "SearchPosts", Handler: _PostService_SearchPosts_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github/ayonli/ngrpc/services/PostService.proto", }
PostService_ServiceDesc is the grpc.ServiceDesc for PostService 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: "github.ayonli.ngrpc.services.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetUser", Handler: _UserService_GetUser_Handler, }, { MethodName: "GetUsers", Handler: _UserService_GetUsers_Handler, }, { MethodName: "GetMyPosts", Handler: _UserService_GetMyPosts_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github/ayonli/ngrpc/services/UserService.proto", }
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)
Functions ¶
func RegisterPostServiceServer ¶
func RegisterPostServiceServer(s grpc.ServiceRegistrar, srv PostServiceServer)
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
Types ¶
type Gender ¶
type Gender int32
func (Gender) Descriptor ¶
func (Gender) Descriptor() protoreflect.EnumDescriptor
func (Gender) EnumDescriptor
deprecated
func (Gender) Number ¶
func (x Gender) Number() protoreflect.EnumNumber
func (Gender) Type ¶
func (Gender) Type() protoreflect.EnumType
type Post ¶
type Post struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` Description *string `protobuf:"bytes,3,opt,name=description,proto3,oneof" json:"description,omitempty"` Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` Author *User `protobuf:"bytes,5,opt,name=author,proto3,oneof" json:"author,omitempty"` // contains filtered or unexported fields }
func (*Post) Descriptor
deprecated
func (*Post) GetContent ¶
func (*Post) GetDescription ¶
func (*Post) ProtoMessage ¶
func (*Post) ProtoMessage()
func (*Post) ProtoReflect ¶
func (x *Post) ProtoReflect() protoreflect.Message
type PostQuery ¶
type PostQuery struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*PostQuery) Descriptor
deprecated
func (*PostQuery) ProtoMessage ¶
func (*PostQuery) ProtoMessage()
func (*PostQuery) ProtoReflect ¶
func (x *PostQuery) ProtoReflect() protoreflect.Message
type PostSearchResult ¶
type PostSearchResult struct { Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"` // contains filtered or unexported fields }
func (*PostSearchResult) Descriptor
deprecated
func (*PostSearchResult) Descriptor() ([]byte, []int)
Deprecated: Use PostSearchResult.ProtoReflect.Descriptor instead.
func (*PostSearchResult) GetPosts ¶
func (x *PostSearchResult) GetPosts() []*Post
func (*PostSearchResult) ProtoMessage ¶
func (*PostSearchResult) ProtoMessage()
func (*PostSearchResult) ProtoReflect ¶
func (x *PostSearchResult) ProtoReflect() protoreflect.Message
func (*PostSearchResult) Reset ¶
func (x *PostSearchResult) Reset()
func (*PostSearchResult) String ¶
func (x *PostSearchResult) String() string
type PostServiceClient ¶
type PostServiceClient interface { GetPost(ctx context.Context, in *PostQuery, opts ...grpc.CallOption) (*Post, error) SearchPosts(ctx context.Context, in *PostsQuery, opts ...grpc.CallOption) (*PostSearchResult, error) }
PostServiceClient is the client API for PostService 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 NewPostServiceClient ¶
func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient
type PostServiceServer ¶
type PostServiceServer interface { GetPost(context.Context, *PostQuery) (*Post, error) SearchPosts(context.Context, *PostsQuery) (*PostSearchResult, error) // contains filtered or unexported methods }
PostServiceServer is the server API for PostService service. All implementations must embed UnimplementedPostServiceServer for forward compatibility
type PostsQuery ¶
type PostsQuery struct { Author *string `protobuf:"bytes,1,opt,name=author,proto3,oneof" json:"author,omitempty"` Keyword *string `protobuf:"bytes,2,opt,name=keyword,proto3,oneof" json:"keyword,omitempty"` // contains filtered or unexported fields }
func (*PostsQuery) Descriptor
deprecated
func (*PostsQuery) Descriptor() ([]byte, []int)
Deprecated: Use PostsQuery.ProtoReflect.Descriptor instead.
func (*PostsQuery) GetAuthor ¶
func (x *PostsQuery) GetAuthor() string
func (*PostsQuery) GetKeyword ¶
func (x *PostsQuery) GetKeyword() string
func (*PostsQuery) ProtoMessage ¶
func (*PostsQuery) ProtoMessage()
func (*PostsQuery) ProtoReflect ¶
func (x *PostsQuery) ProtoReflect() protoreflect.Message
func (*PostsQuery) Reset ¶
func (x *PostsQuery) Reset()
func (*PostsQuery) String ¶
func (x *PostsQuery) String() string
type UnimplementedPostServiceServer ¶
type UnimplementedPostServiceServer struct { }
UnimplementedPostServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedPostServiceServer) SearchPosts ¶
func (UnimplementedPostServiceServer) SearchPosts(context.Context, *PostsQuery) (*PostSearchResult, error)
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedUserServiceServer) GetMyPosts ¶
func (UnimplementedUserServiceServer) GetMyPosts(context.Context, *UserQuery) (*PostSearchResult, error)
func (UnimplementedUserServiceServer) GetUsers ¶
func (UnimplementedUserServiceServer) GetUsers(context.Context, *UsersQuery) (*UserQueryResult, error)
type UnsafePostServiceServer ¶
type UnsafePostServiceServer interface {
// contains filtered or unexported methods
}
UnsafePostServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PostServiceServer will result in compilation errors.
type UnsafeUserServiceServer ¶
type UnsafeUserServiceServer interface {
// contains filtered or unexported methods
}
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 User ¶
type User struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Gender Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=github.ayonli.ngrpc.services.Gender" json:"gender,omitempty"` Age int32 `protobuf:"varint,4,opt,name=age,proto3" json:"age,omitempty"` Email string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserQuery ¶
type UserQuery struct { Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` Email *string `protobuf:"bytes,2,opt,name=email,proto3,oneof" json:"email,omitempty"` // contains filtered or unexported fields }
func (*UserQuery) Descriptor
deprecated
func (*UserQuery) ProtoMessage ¶
func (*UserQuery) ProtoMessage()
func (*UserQuery) ProtoReflect ¶
func (x *UserQuery) ProtoReflect() protoreflect.Message
type UserQueryResult ¶
type UserQueryResult struct { Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` // contains filtered or unexported fields }
func (*UserQueryResult) Descriptor
deprecated
func (*UserQueryResult) Descriptor() ([]byte, []int)
Deprecated: Use UserQueryResult.ProtoReflect.Descriptor instead.
func (*UserQueryResult) GetUsers ¶
func (x *UserQueryResult) GetUsers() []*User
func (*UserQueryResult) ProtoMessage ¶
func (*UserQueryResult) ProtoMessage()
func (*UserQueryResult) ProtoReflect ¶
func (x *UserQueryResult) ProtoReflect() protoreflect.Message
func (*UserQueryResult) Reset ¶
func (x *UserQueryResult) Reset()
func (*UserQueryResult) String ¶
func (x *UserQueryResult) String() string
type UserServiceClient ¶
type UserServiceClient interface { GetUser(ctx context.Context, in *UserQuery, opts ...grpc.CallOption) (*User, error) GetUsers(ctx context.Context, in *UsersQuery, opts ...grpc.CallOption) (*UserQueryResult, error) GetMyPosts(ctx context.Context, in *UserQuery, opts ...grpc.CallOption) (*PostSearchResult, error) }
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.
func NewUserServiceClient ¶
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { GetUser(context.Context, *UserQuery) (*User, error) GetUsers(context.Context, *UsersQuery) (*UserQueryResult, error) GetMyPosts(context.Context, *UserQuery) (*PostSearchResult, error) // contains filtered or unexported methods }
UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility
type UsersQuery ¶
type UsersQuery struct { Gender *Gender `protobuf:"varint,1,opt,name=gender,proto3,enum=github.ayonli.ngrpc.services.Gender,oneof" json:"gender,omitempty"` MinAge *int32 `protobuf:"varint,2,opt,name=minAge,proto3,oneof" json:"minAge,omitempty"` MaxAge *int32 `protobuf:"varint,3,opt,name=maxAge,proto3,oneof" json:"maxAge,omitempty"` // contains filtered or unexported fields }
func (*UsersQuery) Descriptor
deprecated
func (*UsersQuery) Descriptor() ([]byte, []int)
Deprecated: Use UsersQuery.ProtoReflect.Descriptor instead.
func (*UsersQuery) GetGender ¶
func (x *UsersQuery) GetGender() Gender
func (*UsersQuery) GetMaxAge ¶
func (x *UsersQuery) GetMaxAge() int32
func (*UsersQuery) GetMinAge ¶
func (x *UsersQuery) GetMinAge() int32
func (*UsersQuery) ProtoMessage ¶
func (*UsersQuery) ProtoMessage()
func (*UsersQuery) ProtoReflect ¶
func (x *UsersQuery) ProtoReflect() protoreflect.Message
func (*UsersQuery) Reset ¶
func (x *UsersQuery) Reset()
func (*UsersQuery) String ¶
func (x *UsersQuery) String() string