Documentation ¶
Overview ¶
Package user is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
- func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
- func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
- type UnimplementedUserServiceServer
- type UnsafeUserServiceServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetAvatar() string
- func (x *User) GetCreatedAt() *timestamppb.Timestamp
- func (x *User) GetEmail() string
- func (x *User) GetExtra() map[string]*anypb.Any
- func (x *User) GetId() string
- func (x *User) GetNickname() string
- func (x *User) GetOuterId() string
- func (x *User) GetProvider() string
- func (x *User) GetRoles() []string
- func (x *User) GetStatus() User_Status
- func (x *User) GetUpdatedAt() *timestamppb.Timestamp
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- func (m *User) Validate() error
- func (m *User) ValidateAll() error
- type UserListRequest
- func (*UserListRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UserListRequest) GetUsername() string
- func (*UserListRequest) ProtoMessage()
- func (x *UserListRequest) ProtoReflect() protoreflect.Message
- func (x *UserListRequest) Reset()
- func (x *UserListRequest) String() string
- func (m *UserListRequest) Validate() error
- func (m *UserListRequest) ValidateAll() error
- type UserListRequestMultiError
- type UserListRequestValidationError
- func (e UserListRequestValidationError) Cause() error
- func (e UserListRequestValidationError) Error() string
- func (e UserListRequestValidationError) ErrorName() string
- func (e UserListRequestValidationError) Field() string
- func (e UserListRequestValidationError) Key() bool
- func (e UserListRequestValidationError) Reason() string
- type UserListResponse
- func (*UserListResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UserListResponse) GetItems() []*User
- func (x *UserListResponse) GetTotal() int64
- func (*UserListResponse) ProtoMessage()
- func (x *UserListResponse) ProtoReflect() protoreflect.Message
- func (x *UserListResponse) Reset()
- func (x *UserListResponse) String() string
- func (m *UserListResponse) Validate() error
- func (m *UserListResponse) ValidateAll() error
- type UserListResponseMultiError
- type UserListResponseValidationError
- func (e UserListResponseValidationError) Cause() error
- func (e UserListResponseValidationError) Error() string
- func (e UserListResponseValidationError) ErrorName() string
- func (e UserListResponseValidationError) Field() string
- func (e UserListResponseValidationError) Key() bool
- func (e UserListResponseValidationError) Reason() string
- type UserMultiError
- type UserServiceClient
- type UserServiceServer
- type UserValidationError
- type User_Status
- func (User_Status) Descriptor() protoreflect.EnumDescriptor
- func (x User_Status) Enum() *User_Status
- func (User_Status) EnumDescriptor() ([]byte, []int)deprecated
- func (x User_Status) Number() protoreflect.EnumNumber
- func (x User_Status) String() string
- func (User_Status) Type() protoreflect.EnumType
Constants ¶
This section is empty.
Variables ¶
var ( User_Status_name = map[int32]string{ 0: "PENDING", 1: "BUILDING", 2: "PUBLISHED", 3: "EXPIRED", 4: "FAILED", } User_Status_value = map[string]int32{ "PENDING": 0, "BUILDING": 1, "PUBLISHED": 2, "EXPIRED": 3, "FAILED": 4, } )
Enum value maps for User_Status.
var File_user_user_proto protoreflect.FileDescriptor
var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "user.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "List", Handler: _UserService_List_Handler, }, { MethodName: "Info", Handler: _UserService_Info_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "user/user.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 RegisterUserServiceHandler ¶
func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserServiceHandler registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandlerClient ¶
func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
RegisterUserServiceHandlerClient registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerFromEndpoint ¶
func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceHandlerServer ¶
func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". UnaryRPC :call UserServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead.
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
Types ¶
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedUserServiceServer) List ¶
func (UnimplementedUserServiceServer) List(context.Context, *UserListRequest) (*UserListResponse, 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" bson:"_id,omitempty"` // @gotags: bson:"_id,omitempty" Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` OuterId string `protobuf:"bytes,3,opt,name=outer_id,json=outerId,proto3" json:"outer_id,omitempty" bson:"outer_id,omitempty"` // @gotags: bson:"outer_id,omitempty" Nickname string `protobuf:"bytes,4,opt,name=nickname,proto3" json:"nickname,omitempty"` Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` Roles []string `protobuf:"bytes,6,rep,name=roles,proto3" json:"roles,omitempty"` Extra map[string]*anypb.Any `` /* 151-byte string literal not displayed */ Provider string `protobuf:"bytes,9,opt,name=provider,proto3" json:"provider,omitempty"` Status User_Status `protobuf:"varint,10,opt,name=status,proto3,enum=user.User_Status" json:"status,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,101,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty" bson:"created_at,omitempty"` // @gotags: bson:"created_at,omitempty" UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,103,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty" bson:"updated_at,omitempty"` // @gotags: bson:"updated_at,omitempty" // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) GetCreatedAt ¶
func (x *User) GetCreatedAt() *timestamppb.Timestamp
func (*User) GetNickname ¶
func (*User) GetOuterId ¶
func (*User) GetProvider ¶
func (*User) GetStatus ¶
func (x *User) GetStatus() User_Status
func (*User) GetUpdatedAt ¶
func (x *User) GetUpdatedAt() *timestamppb.Timestamp
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
func (*User) Validate ¶
Validate checks the field values on User with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*User) ValidateAll ¶
ValidateAll checks the field values on User with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UserMultiError, or nil if none found.
type UserListRequest ¶
type UserListRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // contains filtered or unexported fields }
func (*UserListRequest) Descriptor
deprecated
func (*UserListRequest) Descriptor() ([]byte, []int)
Deprecated: Use UserListRequest.ProtoReflect.Descriptor instead.
func (*UserListRequest) GetUsername ¶
func (x *UserListRequest) GetUsername() string
func (*UserListRequest) ProtoMessage ¶
func (*UserListRequest) ProtoMessage()
func (*UserListRequest) ProtoReflect ¶
func (x *UserListRequest) ProtoReflect() protoreflect.Message
func (*UserListRequest) Reset ¶
func (x *UserListRequest) Reset()
func (*UserListRequest) String ¶
func (x *UserListRequest) String() string
func (*UserListRequest) Validate ¶
func (m *UserListRequest) Validate() error
Validate checks the field values on UserListRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UserListRequest) ValidateAll ¶
func (m *UserListRequest) ValidateAll() error
ValidateAll checks the field values on UserListRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UserListRequestMultiError, or nil if none found.
type UserListRequestMultiError ¶
type UserListRequestMultiError []error
UserListRequestMultiError is an error wrapping multiple validation errors returned by UserListRequest.ValidateAll() if the designated constraints aren't met.
func (UserListRequestMultiError) AllErrors ¶
func (m UserListRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UserListRequestMultiError) Error ¶
func (m UserListRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UserListRequestValidationError ¶
type UserListRequestValidationError struct {
// contains filtered or unexported fields
}
UserListRequestValidationError is the validation error returned by UserListRequest.Validate if the designated constraints aren't met.
func (UserListRequestValidationError) Cause ¶
func (e UserListRequestValidationError) Cause() error
Cause function returns cause value.
func (UserListRequestValidationError) Error ¶
func (e UserListRequestValidationError) Error() string
Error satisfies the builtin error interface
func (UserListRequestValidationError) ErrorName ¶
func (e UserListRequestValidationError) ErrorName() string
ErrorName returns error name.
func (UserListRequestValidationError) Field ¶
func (e UserListRequestValidationError) Field() string
Field function returns field value.
func (UserListRequestValidationError) Key ¶
func (e UserListRequestValidationError) Key() bool
Key function returns key value.
func (UserListRequestValidationError) Reason ¶
func (e UserListRequestValidationError) Reason() string
Reason function returns reason value.
type UserListResponse ¶
type UserListResponse struct { Items []*User `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` Total int64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` // contains filtered or unexported fields }
func (*UserListResponse) Descriptor
deprecated
func (*UserListResponse) Descriptor() ([]byte, []int)
Deprecated: Use UserListResponse.ProtoReflect.Descriptor instead.
func (*UserListResponse) GetItems ¶
func (x *UserListResponse) GetItems() []*User
func (*UserListResponse) GetTotal ¶
func (x *UserListResponse) GetTotal() int64
func (*UserListResponse) ProtoMessage ¶
func (*UserListResponse) ProtoMessage()
func (*UserListResponse) ProtoReflect ¶
func (x *UserListResponse) ProtoReflect() protoreflect.Message
func (*UserListResponse) Reset ¶
func (x *UserListResponse) Reset()
func (*UserListResponse) String ¶
func (x *UserListResponse) String() string
func (*UserListResponse) Validate ¶
func (m *UserListResponse) Validate() error
Validate checks the field values on UserListResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UserListResponse) ValidateAll ¶
func (m *UserListResponse) ValidateAll() error
ValidateAll checks the field values on UserListResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UserListResponseMultiError, or nil if none found.
type UserListResponseMultiError ¶
type UserListResponseMultiError []error
UserListResponseMultiError is an error wrapping multiple validation errors returned by UserListResponse.ValidateAll() if the designated constraints aren't met.
func (UserListResponseMultiError) AllErrors ¶
func (m UserListResponseMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UserListResponseMultiError) Error ¶
func (m UserListResponseMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UserListResponseValidationError ¶
type UserListResponseValidationError struct {
// contains filtered or unexported fields
}
UserListResponseValidationError is the validation error returned by UserListResponse.Validate if the designated constraints aren't met.
func (UserListResponseValidationError) Cause ¶
func (e UserListResponseValidationError) Cause() error
Cause function returns cause value.
func (UserListResponseValidationError) Error ¶
func (e UserListResponseValidationError) Error() string
Error satisfies the builtin error interface
func (UserListResponseValidationError) ErrorName ¶
func (e UserListResponseValidationError) ErrorName() string
ErrorName returns error name.
func (UserListResponseValidationError) Field ¶
func (e UserListResponseValidationError) Field() string
Field function returns field value.
func (UserListResponseValidationError) Key ¶
func (e UserListResponseValidationError) Key() bool
Key function returns key value.
func (UserListResponseValidationError) Reason ¶
func (e UserListResponseValidationError) Reason() string
Reason function returns reason value.
type UserMultiError ¶
type UserMultiError []error
UserMultiError is an error wrapping multiple validation errors returned by User.ValidateAll() if the designated constraints aren't met.
func (UserMultiError) AllErrors ¶
func (m UserMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UserMultiError) Error ¶
func (m UserMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UserServiceClient ¶
type UserServiceClient interface { List(ctx context.Context, in *UserListRequest, opts ...grpc.CallOption) (*UserListResponse, error) Info(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*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 { List(context.Context, *UserListRequest) (*UserListResponse, error) Info(context.Context, *emptypb.Empty) (*User, error) }
UserServiceServer is the server API for UserService service. All implementations should embed UnimplementedUserServiceServer for forward compatibility
type UserValidationError ¶
type UserValidationError struct {
// contains filtered or unexported fields
}
UserValidationError is the validation error returned by User.Validate if the designated constraints aren't met.
func (UserValidationError) Cause ¶
func (e UserValidationError) Cause() error
Cause function returns cause value.
func (UserValidationError) Error ¶
func (e UserValidationError) Error() string
Error satisfies the builtin error interface
func (UserValidationError) ErrorName ¶
func (e UserValidationError) ErrorName() string
ErrorName returns error name.
func (UserValidationError) Field ¶
func (e UserValidationError) Field() string
Field function returns field value.
func (UserValidationError) Key ¶
func (e UserValidationError) Key() bool
Key function returns key value.
func (UserValidationError) Reason ¶
func (e UserValidationError) Reason() string
Reason function returns reason value.
type User_Status ¶
type User_Status int32
const ( User_PENDING User_Status = 0 User_BUILDING User_Status = 1 User_PUBLISHED User_Status = 2 User_EXPIRED User_Status = 3 User_FAILED User_Status = 4 )
func (User_Status) Descriptor ¶
func (User_Status) Descriptor() protoreflect.EnumDescriptor
func (User_Status) Enum ¶
func (x User_Status) Enum() *User_Status
func (User_Status) EnumDescriptor
deprecated
func (User_Status) EnumDescriptor() ([]byte, []int)
Deprecated: Use User_Status.Descriptor instead.
func (User_Status) Number ¶
func (x User_Status) Number() protoreflect.EnumNumber
func (User_Status) String ¶
func (x User_Status) String() string
func (User_Status) Type ¶
func (User_Status) Type() protoreflect.EnumType