Documentation
¶
Overview ¶
Package identity is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func MicroRegisterUserServiceHandler(s server.Server, hdlr UserServiceHandler, opts ...server.HandlerOption) error
- func NewUserServiceEndpoints() []*api.Endpoint
- 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() int64
- func (x *User) GetDeletedAt() int64
- func (x *User) GetDisabledAt() int64
- func (x *User) GetId() string
- func (x *User) GetNickname() string
- func (x *User) GetUsername() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type UserCredential
- func (*UserCredential) Descriptor() ([]byte, []int)deprecated
- func (x *UserCredential) GetCredential() string
- func (x *UserCredential) GetId() string
- func (x *UserCredential) GetIdentifier() string
- func (x *UserCredential) GetType() UserCredentialType
- func (x *UserCredential) GetUserId() string
- func (x *UserCredential) GetVerificationAt() int64
- func (x *UserCredential) GetVerified() bool
- func (*UserCredential) ProtoMessage()
- func (x *UserCredential) ProtoReflect() protoreflect.Message
- func (x *UserCredential) Reset()
- func (x *UserCredential) String() string
- type UserCredentialType
- func (UserCredentialType) Descriptor() protoreflect.EnumDescriptor
- func (x UserCredentialType) Enum() *UserCredentialType
- func (UserCredentialType) EnumDescriptor() ([]byte, []int)deprecated
- func (x UserCredentialType) Number() protoreflect.EnumNumber
- func (x UserCredentialType) String() string
- func (UserCredentialType) Type() protoreflect.EnumType
- type UserService
- type UserServiceClient
- type UserServiceHandler
- type UserServiceServer
- type UserSignInRequest
- func (*UserSignInRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UserSignInRequest) GetPassword() string
- func (x *UserSignInRequest) GetType() UserCredentialType
- func (x *UserSignInRequest) GetUsername() string
- func (*UserSignInRequest) ProtoMessage()
- func (x *UserSignInRequest) ProtoReflect() protoreflect.Message
- func (x *UserSignInRequest) Reset()
- func (x *UserSignInRequest) String() string
- type UserSignInResponse
- type UserSignUpRequest
- func (*UserSignUpRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UserSignUpRequest) GetEmail() string
- func (x *UserSignUpRequest) GetPassword() string
- func (x *UserSignUpRequest) GetTelephone() string
- func (x *UserSignUpRequest) GetType() UserCredentialType
- func (x *UserSignUpRequest) GetUsername() string
- func (*UserSignUpRequest) ProtoMessage()
- func (x *UserSignUpRequest) ProtoReflect() protoreflect.Message
- func (x *UserSignUpRequest) Reset()
- func (x *UserSignUpRequest) String() string
- type UserSignUpResponse
Constants ¶
const ( UserService_SignUp_FullMethodName = "/UserService/SignUp" UserService_SignIn_FullMethodName = "/UserService/SignIn" )
Variables ¶
var ( UserCredentialType_name = map[int32]string{ 0: "USERNAME", 1: "EMAIL", 2: "PHONE", } UserCredentialType_value = map[string]int32{ "USERNAME": 0, "EMAIL": 1, "PHONE": 2, } )
Enum value maps for UserCredentialType.
var File_identity_user_proto protoreflect.FileDescriptor
var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SignUp", Handler: _UserService_SignUp_Handler, }, { MethodName: "SignIn", Handler: _UserService_SignIn_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "identity/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 MicroRegisterUserServiceHandler ¶
func MicroRegisterUserServiceHandler(s server.Server, hdlr UserServiceHandler, opts ...server.HandlerOption) error
func NewUserServiceEndpoints ¶
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 must be embedded to have forward compatible implementations.
func (UnimplementedUserServiceServer) SignIn ¶
func (UnimplementedUserServiceServer) SignIn(context.Context, *UserSignInRequest) (*UserSignInResponse, error)
func (UnimplementedUserServiceServer) SignUp ¶
func (UnimplementedUserServiceServer) SignUp(context.Context, *UserSignUpRequest) (*UserSignUpResponse, 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"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` Nickname string `protobuf:"bytes,3,opt,name=nickname,proto3" json:"nickname,omitempty"` Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"` DisabledAt int64 `protobuf:"varint,5,opt,name=disabledAt,proto3" json:"disabledAt,omitempty"` DeletedAt int64 `protobuf:"varint,6,opt,name=deletedAt,proto3" json:"deletedAt,omitempty"` CreatedAt int64 `protobuf:"varint,7,opt,name=createdAt,proto3" json:"createdAt,omitempty"` // contains filtered or unexported fields }
entity struct user
func (*User) Descriptor
deprecated
func (*User) GetCreatedAt ¶
func (*User) GetDeletedAt ¶
func (*User) GetDisabledAt ¶
func (*User) GetNickname ¶
func (*User) GetUsername ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserCredential ¶
type UserCredential struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` UserId string `protobuf:"bytes,2,opt,name=userId,proto3" json:"userId,omitempty"` Type UserCredentialType `protobuf:"varint,3,opt,name=type,proto3,enum=UserCredentialType" json:"type,omitempty"` Identifier string `protobuf:"bytes,4,opt,name=identifier,proto3" json:"identifier,omitempty"` Credential string `protobuf:"bytes,5,opt,name=credential,proto3" json:"credential,omitempty"` Verified bool `protobuf:"varint,6,opt,name=verified,proto3" json:"verified,omitempty"` VerificationAt int64 `protobuf:"varint,7,opt,name=VerificationAt,proto3" json:"VerificationAt,omitempty"` // contains filtered or unexported fields }
user credential
func (*UserCredential) Descriptor
deprecated
func (*UserCredential) Descriptor() ([]byte, []int)
Deprecated: Use UserCredential.ProtoReflect.Descriptor instead.
func (*UserCredential) GetCredential ¶
func (x *UserCredential) GetCredential() string
func (*UserCredential) GetId ¶
func (x *UserCredential) GetId() string
func (*UserCredential) GetIdentifier ¶
func (x *UserCredential) GetIdentifier() string
func (*UserCredential) GetType ¶
func (x *UserCredential) GetType() UserCredentialType
func (*UserCredential) GetUserId ¶
func (x *UserCredential) GetUserId() string
func (*UserCredential) GetVerificationAt ¶
func (x *UserCredential) GetVerificationAt() int64
func (*UserCredential) GetVerified ¶
func (x *UserCredential) GetVerified() bool
func (*UserCredential) ProtoMessage ¶
func (*UserCredential) ProtoMessage()
func (*UserCredential) ProtoReflect ¶
func (x *UserCredential) ProtoReflect() protoreflect.Message
func (*UserCredential) Reset ¶
func (x *UserCredential) Reset()
func (*UserCredential) String ¶
func (x *UserCredential) String() string
type UserCredentialType ¶
type UserCredentialType int32
user credential type enum
const ( UserCredentialType_USERNAME UserCredentialType = 0 UserCredentialType_EMAIL UserCredentialType = 1 UserCredentialType_PHONE UserCredentialType = 2 )
func (UserCredentialType) Descriptor ¶
func (UserCredentialType) Descriptor() protoreflect.EnumDescriptor
func (UserCredentialType) Enum ¶
func (x UserCredentialType) Enum() *UserCredentialType
func (UserCredentialType) EnumDescriptor
deprecated
func (UserCredentialType) EnumDescriptor() ([]byte, []int)
Deprecated: Use UserCredentialType.Descriptor instead.
func (UserCredentialType) Number ¶
func (x UserCredentialType) Number() protoreflect.EnumNumber
func (UserCredentialType) String ¶
func (x UserCredentialType) String() string
func (UserCredentialType) Type ¶
func (UserCredentialType) Type() protoreflect.EnumType
type UserService ¶
type UserService interface { SignUp(ctx context.Context, in *UserSignUpRequest, opts ...client.CallOption) (*UserSignUpResponse, error) SignIn(ctx context.Context, in *UserSignInRequest, opts ...client.CallOption) (*UserSignInResponse, error) }
func NewUserService ¶
func NewUserService(name string, c client.Client) UserService
type UserServiceClient ¶
type UserServiceClient interface { SignUp(ctx context.Context, in *UserSignUpRequest, opts ...grpc.CallOption) (*UserSignUpResponse, error) SignIn(ctx context.Context, in *UserSignInRequest, opts ...grpc.CallOption) (*UserSignInResponse, 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 UserServiceHandler ¶
type UserServiceHandler interface { SignUp(context.Context, *UserSignUpRequest, *UserSignUpResponse) error SignIn(context.Context, *UserSignInRequest, *UserSignInResponse) error }
type UserServiceServer ¶
type UserServiceServer interface { SignUp(context.Context, *UserSignUpRequest) (*UserSignUpResponse, error) SignIn(context.Context, *UserSignInRequest) (*UserSignInResponse, error) // contains filtered or unexported methods }
UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility
type UserSignInRequest ¶
type UserSignInRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` Type UserCredentialType `protobuf:"varint,3,opt,name=type,proto3,enum=UserCredentialType" json:"type,omitempty"` // contains filtered or unexported fields }
func (*UserSignInRequest) Descriptor
deprecated
func (*UserSignInRequest) Descriptor() ([]byte, []int)
Deprecated: Use UserSignInRequest.ProtoReflect.Descriptor instead.
func (*UserSignInRequest) GetPassword ¶
func (x *UserSignInRequest) GetPassword() string
func (*UserSignInRequest) GetType ¶
func (x *UserSignInRequest) GetType() UserCredentialType
func (*UserSignInRequest) GetUsername ¶
func (x *UserSignInRequest) GetUsername() string
func (*UserSignInRequest) ProtoMessage ¶
func (*UserSignInRequest) ProtoMessage()
func (*UserSignInRequest) ProtoReflect ¶
func (x *UserSignInRequest) ProtoReflect() protoreflect.Message
func (*UserSignInRequest) Reset ¶
func (x *UserSignInRequest) Reset()
func (*UserSignInRequest) String ¶
func (x *UserSignInRequest) String() string
type UserSignInResponse ¶
type UserSignInResponse struct {
// contains filtered or unexported fields
}
func (*UserSignInResponse) Descriptor
deprecated
func (*UserSignInResponse) Descriptor() ([]byte, []int)
Deprecated: Use UserSignInResponse.ProtoReflect.Descriptor instead.
func (*UserSignInResponse) ProtoMessage ¶
func (*UserSignInResponse) ProtoMessage()
func (*UserSignInResponse) ProtoReflect ¶
func (x *UserSignInResponse) ProtoReflect() protoreflect.Message
func (*UserSignInResponse) Reset ¶
func (x *UserSignInResponse) Reset()
func (*UserSignInResponse) String ¶
func (x *UserSignInResponse) String() string
type UserSignUpRequest ¶
type UserSignUpRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` Telephone string `protobuf:"bytes,3,opt,name=telephone,proto3" json:"telephone,omitempty"` Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` Type UserCredentialType `protobuf:"varint,5,opt,name=type,proto3,enum=UserCredentialType" json:"type,omitempty"` // contains filtered or unexported fields }
request & response struct
func (*UserSignUpRequest) Descriptor
deprecated
func (*UserSignUpRequest) Descriptor() ([]byte, []int)
Deprecated: Use UserSignUpRequest.ProtoReflect.Descriptor instead.
func (*UserSignUpRequest) GetEmail ¶
func (x *UserSignUpRequest) GetEmail() string
func (*UserSignUpRequest) GetPassword ¶
func (x *UserSignUpRequest) GetPassword() string
func (*UserSignUpRequest) GetTelephone ¶
func (x *UserSignUpRequest) GetTelephone() string
func (*UserSignUpRequest) GetType ¶
func (x *UserSignUpRequest) GetType() UserCredentialType
func (*UserSignUpRequest) GetUsername ¶
func (x *UserSignUpRequest) GetUsername() string
func (*UserSignUpRequest) ProtoMessage ¶
func (*UserSignUpRequest) ProtoMessage()
func (*UserSignUpRequest) ProtoReflect ¶
func (x *UserSignUpRequest) ProtoReflect() protoreflect.Message
func (*UserSignUpRequest) Reset ¶
func (x *UserSignUpRequest) Reset()
func (*UserSignUpRequest) String ¶
func (x *UserSignUpRequest) String() string
type UserSignUpResponse ¶
type UserSignUpResponse struct {
// contains filtered or unexported fields
}
func (*UserSignUpResponse) Descriptor
deprecated
func (*UserSignUpResponse) Descriptor() ([]byte, []int)
Deprecated: Use UserSignUpResponse.ProtoReflect.Descriptor instead.
func (*UserSignUpResponse) ProtoMessage ¶
func (*UserSignUpResponse) ProtoMessage()
func (*UserSignUpResponse) ProtoReflect ¶
func (x *UserSignUpResponse) ProtoReflect() protoreflect.Message
func (*UserSignUpResponse) Reset ¶
func (x *UserSignUpResponse) Reset()
func (*UserSignUpResponse) String ¶
func (x *UserSignUpResponse) String() string