Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterAccountHTTPServer(s *http.Server, srv AccountHTTPServer)
- func RegisterAccountHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAccountHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountClient) error
- func RegisterAccountHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAccountHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServer) error
- func RegisterAccountServer(s grpc.ServiceRegistrar, srv AccountServer)
- type AccountClient
- type AccountHTTPClient
- type AccountHTTPClientImpl
- type AccountHTTPServer
- type AccountServer
- type ErrorReason
- func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
- func (x ErrorReason) Enum() *ErrorReason
- func (ErrorReason) EnumDescriptor() ([]byte, []int)deprecated
- func (x ErrorReason) Number() protoreflect.EnumNumber
- func (x ErrorReason) String() string
- func (ErrorReason) Type() protoreflect.EnumType
- type GetUserInfoParams
- func (*GetUserInfoParams) Descriptor() ([]byte, []int)deprecated
- func (x *GetUserInfoParams) GetId() string
- func (*GetUserInfoParams) ProtoMessage()
- func (x *GetUserInfoParams) ProtoReflect() protoreflect.Message
- func (x *GetUserInfoParams) Reset()
- func (x *GetUserInfoParams) String() string
- func (m *GetUserInfoParams) Validate() error
- func (m *GetUserInfoParams) ValidateAll() error
- type GetUserInfoParamsMultiError
- type GetUserInfoParamsValidationError
- func (e GetUserInfoParamsValidationError) Cause() error
- func (e GetUserInfoParamsValidationError) Error() string
- func (e GetUserInfoParamsValidationError) ErrorName() string
- func (e GetUserInfoParamsValidationError) Field() string
- func (e GetUserInfoParamsValidationError) Key() bool
- func (e GetUserInfoParamsValidationError) Reason() string
- type GetUserInfoReply
- func (*GetUserInfoReply) Descriptor() ([]byte, []int)deprecated
- func (x *GetUserInfoReply) GetCreatedAt() *timestamppb.Timestamp
- func (x *GetUserInfoReply) GetId() string
- func (x *GetUserInfoReply) GetRoleType() RoleType
- func (x *GetUserInfoReply) GetUpdatedAt() *timestamppb.Timestamp
- func (x *GetUserInfoReply) GetUsername() string
- func (*GetUserInfoReply) ProtoMessage()
- func (x *GetUserInfoReply) ProtoReflect() protoreflect.Message
- func (x *GetUserInfoReply) Reset()
- func (x *GetUserInfoReply) String() string
- func (m *GetUserInfoReply) Validate() error
- func (m *GetUserInfoReply) ValidateAll() error
- type GetUserInfoReplyMultiError
- type GetUserInfoReplyValidationError
- func (e GetUserInfoReplyValidationError) Cause() error
- func (e GetUserInfoReplyValidationError) Error() string
- func (e GetUserInfoReplyValidationError) ErrorName() string
- func (e GetUserInfoReplyValidationError) Field() string
- func (e GetUserInfoReplyValidationError) Key() bool
- func (e GetUserInfoReplyValidationError) Reason() string
- type RoleType
- type UnimplementedAccountServer
- type UnsafeAccountServer
Constants ¶
This section is empty.
Variables ¶
var ( RoleType_name = map[int32]string{ 0: "UNDEFINED", 1: "Normal_USER", 8: "VIP_USER", 9: "ADMIN_USER", 64: "SUPPER_USER", } RoleType_value = map[string]int32{ "UNDEFINED": 0, "Normal_USER": 1, "VIP_USER": 8, "ADMIN_USER": 9, "SUPPER_USER": 64, } )
Enum value maps for RoleType.
var ( ErrorReason_name = map[int32]string{ 0: "INTERNAL_ERROR", 1: "USER_NOT_FOUND", } ErrorReason_value = map[string]int32{ "INTERNAL_ERROR": 0, "USER_NOT_FOUND": 1, } )
Enum value maps for ErrorReason.
var Account_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.account.service.v1.Account", HandlerType: (*AccountServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetUserInfo", Handler: _Account_GetUserInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "v1/account.proto", }
Account_ServiceDesc is the grpc.ServiceDesc for Account service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_v1_account_proto protoreflect.FileDescriptor
var File_v1_error_reason_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAccountHTTPServer ¶
func RegisterAccountHTTPServer(s *http.Server, srv AccountHTTPServer)
func RegisterAccountHandler ¶
func RegisterAccountHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterAccountHandler registers the http handlers for service Account to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterAccountHandlerClient ¶
func RegisterAccountHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountClient) error
RegisterAccountHandlerClient registers the http handlers for service Account to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AccountClient" to call the correct interceptors.
func RegisterAccountHandlerFromEndpoint ¶
func RegisterAccountHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterAccountHandlerFromEndpoint is same as RegisterAccountHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAccountHandlerServer ¶
func RegisterAccountHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServer) error
RegisterAccountHandlerServer registers the http handlers for service Account to "mux". UnaryRPC :call AccountServer 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 RegisterAccountHandlerFromEndpoint instead.
func RegisterAccountServer ¶
func RegisterAccountServer(s grpc.ServiceRegistrar, srv AccountServer)
Types ¶
type AccountClient ¶
type AccountClient interface {
GetUserInfo(ctx context.Context, in *GetUserInfoParams, opts ...grpc.CallOption) (*GetUserInfoReply, error)
}
AccountClient is the client API for Account 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 NewAccountClient ¶
func NewAccountClient(cc grpc.ClientConnInterface) AccountClient
type AccountHTTPClient ¶
type AccountHTTPClient interface {
GetUserInfo(ctx context.Context, req *GetUserInfoParams, opts ...http.CallOption) (rsp *GetUserInfoReply, err error)
}
func NewAccountHTTPClient ¶
func NewAccountHTTPClient(client *http.Client) AccountHTTPClient
type AccountHTTPClientImpl ¶
type AccountHTTPClientImpl struct {
// contains filtered or unexported fields
}
func (*AccountHTTPClientImpl) GetUserInfo ¶
func (c *AccountHTTPClientImpl) GetUserInfo(ctx context.Context, in *GetUserInfoParams, opts ...http.CallOption) (*GetUserInfoReply, error)
type AccountHTTPServer ¶
type AccountHTTPServer interface {
GetUserInfo(context.Context, *GetUserInfoParams) (*GetUserInfoReply, error)
}
type AccountServer ¶
type AccountServer interface { GetUserInfo(context.Context, *GetUserInfoParams) (*GetUserInfoReply, error) // contains filtered or unexported methods }
AccountServer is the server API for Account service. All implementations must embed UnimplementedAccountServer for forward compatibility
type ErrorReason ¶
type ErrorReason int32
const ( ErrorReason_INTERNAL_ERROR ErrorReason = 0 ErrorReason_USER_NOT_FOUND ErrorReason = 1 )
func (ErrorReason) Descriptor ¶
func (ErrorReason) Descriptor() protoreflect.EnumDescriptor
func (ErrorReason) Enum ¶
func (x ErrorReason) Enum() *ErrorReason
func (ErrorReason) EnumDescriptor
deprecated
func (ErrorReason) EnumDescriptor() ([]byte, []int)
Deprecated: Use ErrorReason.Descriptor instead.
func (ErrorReason) Number ¶
func (x ErrorReason) Number() protoreflect.EnumNumber
func (ErrorReason) String ¶
func (x ErrorReason) String() string
func (ErrorReason) Type ¶
func (ErrorReason) Type() protoreflect.EnumType
type GetUserInfoParams ¶
type GetUserInfoParams struct { // 用户ID Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetUserInfoParams) Descriptor
deprecated
func (*GetUserInfoParams) Descriptor() ([]byte, []int)
Deprecated: Use GetUserInfoParams.ProtoReflect.Descriptor instead.
func (*GetUserInfoParams) GetId ¶
func (x *GetUserInfoParams) GetId() string
func (*GetUserInfoParams) ProtoMessage ¶
func (*GetUserInfoParams) ProtoMessage()
func (*GetUserInfoParams) ProtoReflect ¶
func (x *GetUserInfoParams) ProtoReflect() protoreflect.Message
func (*GetUserInfoParams) Reset ¶
func (x *GetUserInfoParams) Reset()
func (*GetUserInfoParams) String ¶
func (x *GetUserInfoParams) String() string
func (*GetUserInfoParams) Validate ¶
func (m *GetUserInfoParams) Validate() error
Validate checks the field values on GetUserInfoParams 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 (*GetUserInfoParams) ValidateAll ¶
func (m *GetUserInfoParams) ValidateAll() error
ValidateAll checks the field values on GetUserInfoParams 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 GetUserInfoParamsMultiError, or nil if none found.
type GetUserInfoParamsMultiError ¶
type GetUserInfoParamsMultiError []error
GetUserInfoParamsMultiError is an error wrapping multiple validation errors returned by GetUserInfoParams.ValidateAll() if the designated constraints aren't met.
func (GetUserInfoParamsMultiError) AllErrors ¶
func (m GetUserInfoParamsMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (GetUserInfoParamsMultiError) Error ¶
func (m GetUserInfoParamsMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type GetUserInfoParamsValidationError ¶
type GetUserInfoParamsValidationError struct {
// contains filtered or unexported fields
}
GetUserInfoParamsValidationError is the validation error returned by GetUserInfoParams.Validate if the designated constraints aren't met.
func (GetUserInfoParamsValidationError) Cause ¶
func (e GetUserInfoParamsValidationError) Cause() error
Cause function returns cause value.
func (GetUserInfoParamsValidationError) Error ¶
func (e GetUserInfoParamsValidationError) Error() string
Error satisfies the builtin error interface
func (GetUserInfoParamsValidationError) ErrorName ¶
func (e GetUserInfoParamsValidationError) ErrorName() string
ErrorName returns error name.
func (GetUserInfoParamsValidationError) Field ¶
func (e GetUserInfoParamsValidationError) Field() string
Field function returns field value.
func (GetUserInfoParamsValidationError) Key ¶
func (e GetUserInfoParamsValidationError) Key() bool
Key function returns key value.
func (GetUserInfoParamsValidationError) Reason ¶
func (e GetUserInfoParamsValidationError) Reason() string
Reason function returns reason value.
type GetUserInfoReply ¶
type GetUserInfoReply struct { // 用户ID Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 用户名 Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // 用户角色类型 RoleType RoleType `protobuf:"varint,3,opt,name=role_type,json=roleType,proto3,enum=api.account.service.v1.RoleType" json:"role_type,omitempty"` // 截止时间 CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 开始时间 UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // contains filtered or unexported fields }
func (*GetUserInfoReply) Descriptor
deprecated
func (*GetUserInfoReply) Descriptor() ([]byte, []int)
Deprecated: Use GetUserInfoReply.ProtoReflect.Descriptor instead.
func (*GetUserInfoReply) GetCreatedAt ¶
func (x *GetUserInfoReply) GetCreatedAt() *timestamppb.Timestamp
func (*GetUserInfoReply) GetId ¶
func (x *GetUserInfoReply) GetId() string
func (*GetUserInfoReply) GetRoleType ¶
func (x *GetUserInfoReply) GetRoleType() RoleType
func (*GetUserInfoReply) GetUpdatedAt ¶
func (x *GetUserInfoReply) GetUpdatedAt() *timestamppb.Timestamp
func (*GetUserInfoReply) GetUsername ¶
func (x *GetUserInfoReply) GetUsername() string
func (*GetUserInfoReply) ProtoMessage ¶
func (*GetUserInfoReply) ProtoMessage()
func (*GetUserInfoReply) ProtoReflect ¶
func (x *GetUserInfoReply) ProtoReflect() protoreflect.Message
func (*GetUserInfoReply) Reset ¶
func (x *GetUserInfoReply) Reset()
func (*GetUserInfoReply) String ¶
func (x *GetUserInfoReply) String() string
func (*GetUserInfoReply) Validate ¶
func (m *GetUserInfoReply) Validate() error
Validate checks the field values on GetUserInfoReply 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 (*GetUserInfoReply) ValidateAll ¶
func (m *GetUserInfoReply) ValidateAll() error
ValidateAll checks the field values on GetUserInfoReply 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 GetUserInfoReplyMultiError, or nil if none found.
type GetUserInfoReplyMultiError ¶
type GetUserInfoReplyMultiError []error
GetUserInfoReplyMultiError is an error wrapping multiple validation errors returned by GetUserInfoReply.ValidateAll() if the designated constraints aren't met.
func (GetUserInfoReplyMultiError) AllErrors ¶
func (m GetUserInfoReplyMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (GetUserInfoReplyMultiError) Error ¶
func (m GetUserInfoReplyMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type GetUserInfoReplyValidationError ¶
type GetUserInfoReplyValidationError struct {
// contains filtered or unexported fields
}
GetUserInfoReplyValidationError is the validation error returned by GetUserInfoReply.Validate if the designated constraints aren't met.
func (GetUserInfoReplyValidationError) Cause ¶
func (e GetUserInfoReplyValidationError) Cause() error
Cause function returns cause value.
func (GetUserInfoReplyValidationError) Error ¶
func (e GetUserInfoReplyValidationError) Error() string
Error satisfies the builtin error interface
func (GetUserInfoReplyValidationError) ErrorName ¶
func (e GetUserInfoReplyValidationError) ErrorName() string
ErrorName returns error name.
func (GetUserInfoReplyValidationError) Field ¶
func (e GetUserInfoReplyValidationError) Field() string
Field function returns field value.
func (GetUserInfoReplyValidationError) Key ¶
func (e GetUserInfoReplyValidationError) Key() bool
Key function returns key value.
func (GetUserInfoReplyValidationError) Reason ¶
func (e GetUserInfoReplyValidationError) Reason() string
Reason function returns reason value.
type RoleType ¶
type RoleType int32
func (RoleType) Descriptor ¶
func (RoleType) Descriptor() protoreflect.EnumDescriptor
func (RoleType) EnumDescriptor
deprecated
func (RoleType) Number ¶
func (x RoleType) Number() protoreflect.EnumNumber
func (RoleType) Type ¶
func (RoleType) Type() protoreflect.EnumType
type UnimplementedAccountServer ¶
type UnimplementedAccountServer struct { }
UnimplementedAccountServer must be embedded to have forward compatible implementations.
func (UnimplementedAccountServer) GetUserInfo ¶
func (UnimplementedAccountServer) GetUserInfo(context.Context, *GetUserInfoParams) (*GetUserInfoReply, error)
type UnsafeAccountServer ¶
type UnsafeAccountServer interface {
// contains filtered or unexported methods
}
UnsafeAccountServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AccountServer will result in compilation errors.