Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
- type AddUserRequest
- func (*AddUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *AddUserRequest) GetName() string
- func (x *AddUserRequest) GetRole() Role
- func (*AddUserRequest) ProtoMessage()
- func (x *AddUserRequest) ProtoReflect() protoreflect.Message
- func (x *AddUserRequest) Reset()
- func (x *AddUserRequest) String() string
- type DeleteUserRequest
- type ListUsersRequest
- func (*ListUsersRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListUsersRequest) GetCreatedSince() *timestamppb.Timestamp
- func (x *ListUsersRequest) GetOlderThan() *durationpb.Duration
- func (*ListUsersRequest) ProtoMessage()
- func (x *ListUsersRequest) ProtoReflect() protoreflect.Message
- func (x *ListUsersRequest) Reset()
- func (x *ListUsersRequest) String() string
- type Role
- type UnimplementedUserServiceServer
- func (UnimplementedUserServiceServer) AddUser(context.Context, *AddUserRequest) (*User, error)
- func (UnimplementedUserServiceServer) AddUsers(grpc.ClientStreamingServer[AddUserRequest, emptypb.Empty]) error
- func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*User, error)
- func (UnimplementedUserServiceServer) ListUsers(*ListUsersRequest, grpc.ServerStreamingServer[User]) error
- type UnsafeUserServiceServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetCreateTime() *timestamppb.Timestamp
- func (x *User) GetId() string
- func (x *User) GetName() string
- func (x *User) GetRole() Role
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type UserRole
- type UserServiceClient
- type UserServiceServer
- type UserService_AddUsersClient
- type UserService_AddUsersServer
- type UserService_ListUsersClient
- type UserService_ListUsersServer
Constants ¶
const ( UserService_AddUser_FullMethodName = "/users.UserService/AddUser" UserService_AddUsers_FullMethodName = "/users.UserService/AddUsers" UserService_DeleteUser_FullMethodName = "/users.UserService/DeleteUser" UserService_ListUsers_FullMethodName = "/users.UserService/ListUsers" )
Variables ¶
var ( Role_name = map[int32]string{ 0: "GUEST", 1: "MEMBER", 2: "ADMIN", } Role_value = map[string]int32{ "GUEST": 0, "MEMBER": 1, "ADMIN": 2, } )
Enum value maps for Role.
var File_proto_users_proto protoreflect.FileDescriptor
var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "users.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddUser", Handler: _UserService_AddUser_Handler, }, { MethodName: "DeleteUser", Handler: _UserService_DeleteUser_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "AddUsers", Handler: _UserService_AddUsers_Handler, ClientStreams: true, }, { StreamName: "ListUsers", Handler: _UserService_ListUsers_Handler, ServerStreams: true, }, }, Metadata: "proto/users.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 RegisterUserServiceServer ¶
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
Types ¶
type AddUserRequest ¶
type AddUserRequest struct { Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=users.Role" json:"role,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*AddUserRequest) Descriptor
deprecated
func (*AddUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddUserRequest.ProtoReflect.Descriptor instead.
func (*AddUserRequest) GetName ¶
func (x *AddUserRequest) GetName() string
func (*AddUserRequest) GetRole ¶
func (x *AddUserRequest) GetRole() Role
func (*AddUserRequest) ProtoMessage ¶
func (*AddUserRequest) ProtoMessage()
func (*AddUserRequest) ProtoReflect ¶
func (x *AddUserRequest) ProtoReflect() protoreflect.Message
func (*AddUserRequest) Reset ¶
func (x *AddUserRequest) Reset()
func (*AddUserRequest) String ¶
func (x *AddUserRequest) String() string
type DeleteUserRequest ¶
type DeleteUserRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*DeleteUserRequest) Descriptor
deprecated
func (*DeleteUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserRequest) GetId ¶
func (x *DeleteUserRequest) GetId() string
func (*DeleteUserRequest) ProtoMessage ¶
func (*DeleteUserRequest) ProtoMessage()
func (*DeleteUserRequest) ProtoReflect ¶
func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message
func (*DeleteUserRequest) Reset ¶
func (x *DeleteUserRequest) Reset()
func (*DeleteUserRequest) String ¶
func (x *DeleteUserRequest) String() string
type ListUsersRequest ¶
type ListUsersRequest struct { // Only list users created after this timestamp CreatedSince *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_since,json=createdSince,proto3" json:"created_since,omitempty"` // Only list users older than this Duration OlderThan *durationpb.Duration `protobuf:"bytes,2,opt,name=older_than,json=olderThan,proto3" json:"older_than,omitempty"` // contains filtered or unexported fields }
func (*ListUsersRequest) Descriptor
deprecated
func (*ListUsersRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead.
func (*ListUsersRequest) GetCreatedSince ¶
func (x *ListUsersRequest) GetCreatedSince() *timestamppb.Timestamp
func (*ListUsersRequest) GetOlderThan ¶
func (x *ListUsersRequest) GetOlderThan() *durationpb.Duration
func (*ListUsersRequest) ProtoMessage ¶
func (*ListUsersRequest) ProtoMessage()
func (*ListUsersRequest) ProtoReflect ¶
func (x *ListUsersRequest) ProtoReflect() protoreflect.Message
func (*ListUsersRequest) Reset ¶
func (x *ListUsersRequest) Reset()
func (*ListUsersRequest) String ¶
func (x *ListUsersRequest) String() string
type Role ¶
type Role int32
func (Role) Descriptor ¶
func (Role) Descriptor() protoreflect.EnumDescriptor
func (Role) EnumDescriptor
deprecated
func (Role) Number ¶
func (x Role) Number() protoreflect.EnumNumber
func (Role) Type ¶
func (Role) Type() protoreflect.EnumType
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct{}
UnimplementedUserServiceServer should 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.
func (UnimplementedUserServiceServer) AddUser ¶
func (UnimplementedUserServiceServer) AddUser(context.Context, *AddUserRequest) (*User, error)
func (UnimplementedUserServiceServer) AddUsers ¶
func (UnimplementedUserServiceServer) AddUsers(grpc.ClientStreamingServer[AddUserRequest, emptypb.Empty]) error
func (UnimplementedUserServiceServer) DeleteUser ¶
func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*User, error)
func (UnimplementedUserServiceServer) ListUsers ¶
func (UnimplementedUserServiceServer) ListUsers(*ListUsersRequest, grpc.ServerStreamingServer[User]) error
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"` Role Role `protobuf:"varint,2,opt,name=role,proto3,enum=users.Role" json:"role,omitempty"` CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) GetCreateTime ¶
func (x *User) GetCreateTime() *timestamppb.Timestamp
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserRole ¶
type UserRole struct { Role Role `protobuf:"varint,1,opt,name=role,proto3,enum=users.Role" json:"role,omitempty"` // contains filtered or unexported fields }
func (*UserRole) Descriptor
deprecated
func (*UserRole) ProtoMessage ¶
func (*UserRole) ProtoMessage()
func (*UserRole) ProtoReflect ¶
func (x *UserRole) ProtoReflect() protoreflect.Message
type UserServiceClient ¶
type UserServiceClient interface { AddUser(ctx context.Context, in *AddUserRequest, opts ...grpc.CallOption) (*User, error) AddUsers(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AddUserRequest, emptypb.Empty], error) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*User, error) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[User], 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 { AddUser(context.Context, *AddUserRequest) (*User, error) AddUsers(grpc.ClientStreamingServer[AddUserRequest, emptypb.Empty]) error DeleteUser(context.Context, *DeleteUserRequest) (*User, error) ListUsers(*ListUsersRequest, grpc.ServerStreamingServer[User]) error }
UserServiceServer is the server API for UserService service. All implementations should embed UnimplementedUserServiceServer for forward compatibility.
type UserService_AddUsersClient ¶
type UserService_AddUsersClient = grpc.ClientStreamingClient[AddUserRequest, emptypb.Empty]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type UserService_AddUsersServer ¶
type UserService_AddUsersServer = grpc.ClientStreamingServer[AddUserRequest, emptypb.Empty]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type UserService_ListUsersClient ¶
type UserService_ListUsersClient = grpc.ServerStreamingClient[User]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type UserService_ListUsersServer ¶
type UserService_ListUsersServer = grpc.ServerStreamingServer[User]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.