grpc_server

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_api_protobuf_api_proto protoreflect.FileDescriptor
View Source
var Token_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Token",
	HandlerType: (*TokenServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "LoginToken",
			Handler:    _Token_LoginToken_Handler,
		},
		{
			MethodName: "RefreshToken",
			Handler:    _Token_RefreshToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/protobuf/api.proto",
}

Token_ServiceDesc is the grpc.ServiceDesc for Token service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var UserMe_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "UserMe",
	HandlerType: (*UserMeServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetUserMe",
			Handler:    _UserMe_GetUserMe_Handler,
		},
		{
			MethodName: "UpdateUserMe",
			Handler:    _UserMe_UpdateUserMe_Handler,
		},
		{
			MethodName: "DeleteUserMe",
			Handler:    _UserMe_DeleteUserMe_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/protobuf/api.proto",
}

UserMe_ServiceDesc is the grpc.ServiceDesc for UserMe service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var User_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "User",
	HandlerType: (*UserServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListUser",
			Handler:    _User_ListUser_Handler,
		},
		{
			MethodName: "CreateUser",
			Handler:    _User_CreateUser_Handler,
		},
		{
			MethodName: "GetUser",
			Handler:    _User_GetUser_Handler,
		},
		{
			MethodName: "UpdateUser",
			Handler:    _User_UpdateUser_Handler,
		},
		{
			MethodName: "DeleteUser",
			Handler:    _User_DeleteUser_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/protobuf/api.proto",
}

User_ServiceDesc is the grpc.ServiceDesc for User service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterTokenServer

func RegisterTokenServer(s grpc.ServiceRegistrar, srv TokenServer)

func RegisterUserMeServer

func RegisterUserMeServer(s grpc.ServiceRegistrar, srv UserMeServer)

func RegisterUserServer

func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer)

Types

type ServerGRPC

type ServerGRPC struct {
	UnimplementedTokenServer
	UnimplementedUserServer
	UnimplementedUserMeServer
	// contains filtered or unexported fields
}

ServerGRPC

func New

func New(d *domain.Domain, e *casbin.Enforcer) (*ServerGRPC, error)

func (*ServerGRPC) CreateUser

func (s *ServerGRPC) CreateUser(ctx context.Context, req *UserCreateRequest) (*UserInfoResponse, error)

func (*ServerGRPC) DeleteUser

func (s *ServerGRPC) DeleteUser(ctx context.Context, req *UserIDRequest) (*empty.Empty, error)

func (*ServerGRPC) DeleteUserMe

func (s *ServerGRPC) DeleteUserMe(ctx context.Context, req *empty.Empty) (*empty.Empty, error)

func (*ServerGRPC) GetUser

func (s *ServerGRPC) GetUser(ctx context.Context, req *UserIDRequest) (*UserInfoResponse, error)

func (*ServerGRPC) GetUserMe

func (s *ServerGRPC) GetUserMe(ctx context.Context, req *empty.Empty) (*UserInfoResponse, error)

func (*ServerGRPC) ListUser

func (s *ServerGRPC) ListUser(ctx context.Context, req *UserListRequest) (*UserListResponse, error)

func (*ServerGRPC) ListenAndServe

func (s *ServerGRPC) ListenAndServe()

func (*ServerGRPC) LoginToken

func (s *ServerGRPC) LoginToken(ctx context.Context, req *TokenLoginRequest) (*TokenInfosResponse, error)

func (*ServerGRPC) RefreshToken

func (s *ServerGRPC) RefreshToken(ctx context.Context, req *TokenRefreshRequest) (*TokenInfoResponse, error)

func (*ServerGRPC) Shutdown

func (s *ServerGRPC) Shutdown()

func (*ServerGRPC) UpdateUser

func (s *ServerGRPC) UpdateUser(ctx context.Context, req *UserUpdateRequest) (*empty.Empty, error)

func (*ServerGRPC) UpdateUserMe

func (s *ServerGRPC) UpdateUserMe(ctx context.Context, req *UserUpdateRequest) (*empty.Empty, error)

type TokenClient

type TokenClient interface {
	LoginToken(ctx context.Context, in *TokenLoginRequest, opts ...grpc.CallOption) (*TokenInfosResponse, error)
	RefreshToken(ctx context.Context, in *TokenRefreshRequest, opts ...grpc.CallOption) (*TokenInfoResponse, error)
}

TokenClient is the client API for Token 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 NewTokenClient

func NewTokenClient(cc grpc.ClientConnInterface) TokenClient

type TokenInfoResponse

type TokenInfoResponse struct {
	Token     string                 `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	IssuedAt  *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=issuedAt,proto3" json:"issuedAt,omitempty"`
	ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expiresAt,proto3" json:"expiresAt,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenInfoResponse) Descriptor deprecated

func (*TokenInfoResponse) Descriptor() ([]byte, []int)

Deprecated: Use TokenInfoResponse.ProtoReflect.Descriptor instead.

func (*TokenInfoResponse) GetExpiresAt

func (x *TokenInfoResponse) GetExpiresAt() *timestamppb.Timestamp

func (*TokenInfoResponse) GetIssuedAt

func (x *TokenInfoResponse) GetIssuedAt() *timestamppb.Timestamp

func (*TokenInfoResponse) GetToken

func (x *TokenInfoResponse) GetToken() string

func (*TokenInfoResponse) ProtoMessage

func (*TokenInfoResponse) ProtoMessage()

func (*TokenInfoResponse) ProtoReflect

func (x *TokenInfoResponse) ProtoReflect() protoreflect.Message

func (*TokenInfoResponse) Reset

func (x *TokenInfoResponse) Reset()

func (*TokenInfoResponse) String

func (x *TokenInfoResponse) String() string

type TokenInfosResponse

type TokenInfosResponse struct {
	AccessToken  *TokenInfoResponse `protobuf:"bytes,1,opt,name=accessToken,proto3" json:"accessToken,omitempty"`
	RefreshToken *TokenInfoResponse `protobuf:"bytes,2,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"`
	// contains filtered or unexported fields
}

Token response

func (*TokenInfosResponse) Descriptor deprecated

func (*TokenInfosResponse) Descriptor() ([]byte, []int)

Deprecated: Use TokenInfosResponse.ProtoReflect.Descriptor instead.

func (*TokenInfosResponse) GetAccessToken

func (x *TokenInfosResponse) GetAccessToken() *TokenInfoResponse

func (*TokenInfosResponse) GetRefreshToken

func (x *TokenInfosResponse) GetRefreshToken() *TokenInfoResponse

func (*TokenInfosResponse) ProtoMessage

func (*TokenInfosResponse) ProtoMessage()

func (*TokenInfosResponse) ProtoReflect

func (x *TokenInfosResponse) ProtoReflect() protoreflect.Message

func (*TokenInfosResponse) Reset

func (x *TokenInfosResponse) Reset()

func (*TokenInfosResponse) String

func (x *TokenInfosResponse) String() string

type TokenLoginRequest

type TokenLoginRequest struct {
	LoginId  string `protobuf:"bytes,1,opt,name=loginId,proto3" json:"loginId,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

Message Token request

func (*TokenLoginRequest) Descriptor deprecated

func (*TokenLoginRequest) Descriptor() ([]byte, []int)

Deprecated: Use TokenLoginRequest.ProtoReflect.Descriptor instead.

func (*TokenLoginRequest) GetLoginId

func (x *TokenLoginRequest) GetLoginId() string

func (*TokenLoginRequest) GetPassword

func (x *TokenLoginRequest) GetPassword() string

func (*TokenLoginRequest) ProtoMessage

func (*TokenLoginRequest) ProtoMessage()

func (*TokenLoginRequest) ProtoReflect

func (x *TokenLoginRequest) ProtoReflect() protoreflect.Message

func (*TokenLoginRequest) Reset

func (x *TokenLoginRequest) Reset()

func (*TokenLoginRequest) String

func (x *TokenLoginRequest) String() string

type TokenRefreshRequest

type TokenRefreshRequest struct {
	RefreshToken string `protobuf:"bytes,1,opt,name=refreshToken,proto3" json:"refreshToken,omitempty"`
	// contains filtered or unexported fields
}

func (*TokenRefreshRequest) Descriptor deprecated

func (*TokenRefreshRequest) Descriptor() ([]byte, []int)

Deprecated: Use TokenRefreshRequest.ProtoReflect.Descriptor instead.

func (*TokenRefreshRequest) GetRefreshToken

func (x *TokenRefreshRequest) GetRefreshToken() string

func (*TokenRefreshRequest) ProtoMessage

func (*TokenRefreshRequest) ProtoMessage()

func (*TokenRefreshRequest) ProtoReflect

func (x *TokenRefreshRequest) ProtoReflect() protoreflect.Message

func (*TokenRefreshRequest) Reset

func (x *TokenRefreshRequest) Reset()

func (*TokenRefreshRequest) String

func (x *TokenRefreshRequest) String() string

type TokenServer

type TokenServer interface {
	LoginToken(context.Context, *TokenLoginRequest) (*TokenInfosResponse, error)
	RefreshToken(context.Context, *TokenRefreshRequest) (*TokenInfoResponse, error)
	// contains filtered or unexported methods
}

TokenServer is the server API for Token service. All implementations must embed UnimplementedTokenServer for forward compatibility

type UnimplementedTokenServer

type UnimplementedTokenServer struct {
}

UnimplementedTokenServer must be embedded to have forward compatible implementations.

func (UnimplementedTokenServer) LoginToken

func (UnimplementedTokenServer) RefreshToken

type UnimplementedUserMeServer

type UnimplementedUserMeServer struct {
}

UnimplementedUserMeServer must be embedded to have forward compatible implementations.

func (UnimplementedUserMeServer) DeleteUserMe

func (UnimplementedUserMeServer) GetUserMe

func (UnimplementedUserMeServer) UpdateUserMe

type UnimplementedUserServer

type UnimplementedUserServer struct {
}

UnimplementedUserServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServer) CreateUser

func (UnimplementedUserServer) DeleteUser

func (UnimplementedUserServer) GetUser

func (UnimplementedUserServer) ListUser

func (UnimplementedUserServer) UpdateUser

type UnsafeTokenServer

type UnsafeTokenServer interface {
	// contains filtered or unexported methods
}

UnsafeTokenServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TokenServer will result in compilation errors.

type UnsafeUserMeServer

type UnsafeUserMeServer interface {
	// contains filtered or unexported methods
}

UnsafeUserMeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserMeServer will result in compilation errors.

type UnsafeUserServer

type UnsafeUserServer interface {
	// contains filtered or unexported methods
}

UnsafeUserServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserServer will result in compilation errors.

type UserClient

type UserClient interface {
	ListUser(ctx context.Context, in *UserListRequest, opts ...grpc.CallOption) (*UserListResponse, error)
	CreateUser(ctx context.Context, in *UserCreateRequest, opts ...grpc.CallOption) (*UserInfoResponse, error)
	GetUser(ctx context.Context, in *UserIDRequest, opts ...grpc.CallOption) (*UserInfoResponse, error)
	UpdateUser(ctx context.Context, in *UserUpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	DeleteUser(ctx context.Context, in *UserIDRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

UserClient is the client API for User 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 NewUserClient

func NewUserClient(cc grpc.ClientConnInterface) UserClient

type UserCreateRequest

type UserCreateRequest struct {
	LoginId  string `protobuf:"bytes,1,opt,name=loginId,proto3" json:"loginId,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Role     string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"`
	Phone    string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
	Email    string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*UserCreateRequest) Descriptor deprecated

func (*UserCreateRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserCreateRequest.ProtoReflect.Descriptor instead.

func (*UserCreateRequest) GetEmail

func (x *UserCreateRequest) GetEmail() string

func (*UserCreateRequest) GetLoginId

func (x *UserCreateRequest) GetLoginId() string

func (*UserCreateRequest) GetPassword

func (x *UserCreateRequest) GetPassword() string

func (*UserCreateRequest) GetPhone

func (x *UserCreateRequest) GetPhone() string

func (*UserCreateRequest) GetRole

func (x *UserCreateRequest) GetRole() string

func (*UserCreateRequest) ProtoMessage

func (*UserCreateRequest) ProtoMessage()

func (*UserCreateRequest) ProtoReflect

func (x *UserCreateRequest) ProtoReflect() protoreflect.Message

func (*UserCreateRequest) Reset

func (x *UserCreateRequest) Reset()

func (*UserCreateRequest) String

func (x *UserCreateRequest) String() string

type UserIDRequest

type UserIDRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*UserIDRequest) Descriptor deprecated

func (*UserIDRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserIDRequest.ProtoReflect.Descriptor instead.

func (*UserIDRequest) GetId

func (x *UserIDRequest) GetId() string

func (*UserIDRequest) ProtoMessage

func (*UserIDRequest) ProtoMessage()

func (*UserIDRequest) ProtoReflect

func (x *UserIDRequest) ProtoReflect() protoreflect.Message

func (*UserIDRequest) Reset

func (x *UserIDRequest) Reset()

func (*UserIDRequest) String

func (x *UserIDRequest) String() string

type UserInfoResponse

type UserInfoResponse struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	LoginId string `protobuf:"bytes,2,opt,name=loginId,proto3" json:"loginId,omitempty"`
	Role    string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"`
	Phone   string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
	Email   string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func UserModelToUserInfo

func UserModelToUserInfo(userModel *entity.UserInfo) *UserInfoResponse

func (*UserInfoResponse) Descriptor deprecated

func (*UserInfoResponse) Descriptor() ([]byte, []int)

Deprecated: Use UserInfoResponse.ProtoReflect.Descriptor instead.

func (*UserInfoResponse) GetEmail

func (x *UserInfoResponse) GetEmail() string

func (*UserInfoResponse) GetId

func (x *UserInfoResponse) GetId() string

func (*UserInfoResponse) GetLoginId

func (x *UserInfoResponse) GetLoginId() string

func (*UserInfoResponse) GetPhone

func (x *UserInfoResponse) GetPhone() string

func (*UserInfoResponse) GetRole

func (x *UserInfoResponse) GetRole() string

func (*UserInfoResponse) ProtoMessage

func (*UserInfoResponse) ProtoMessage()

func (*UserInfoResponse) ProtoReflect

func (x *UserInfoResponse) ProtoReflect() protoreflect.Message

func (*UserInfoResponse) Reset

func (x *UserInfoResponse) Reset()

func (*UserInfoResponse) String

func (x *UserInfoResponse) String() string

type UserListRequest

type UserListRequest struct {
	Offset int32 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
	Limit  int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

User request

func (*UserListRequest) Descriptor deprecated

func (*UserListRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserListRequest.ProtoReflect.Descriptor instead.

func (*UserListRequest) GetLimit

func (x *UserListRequest) GetLimit() int32

func (*UserListRequest) GetOffset

func (x *UserListRequest) GetOffset() int32

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

type UserListResponse

type UserListResponse struct {
	Uesrs []*UserInfoResponse `protobuf:"bytes,1,rep,name=uesrs,proto3" json:"uesrs,omitempty"`
	// contains filtered or unexported fields
}

User response

func UserModelListToUserInfoList

func UserModelListToUserInfoList(userModelList []entity.UserInfo) *UserListResponse

func (*UserListResponse) Descriptor deprecated

func (*UserListResponse) Descriptor() ([]byte, []int)

Deprecated: Use UserListResponse.ProtoReflect.Descriptor instead.

func (*UserListResponse) GetUesrs

func (x *UserListResponse) GetUesrs() []*UserInfoResponse

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

type UserMeClient

type UserMeClient interface {
	GetUserMe(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserInfoResponse, error)
	UpdateUserMe(ctx context.Context, in *UserUpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	DeleteUserMe(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

UserMeClient is the client API for UserMe 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 NewUserMeClient

func NewUserMeClient(cc grpc.ClientConnInterface) UserMeClient

type UserMeServer

type UserMeServer interface {
	GetUserMe(context.Context, *emptypb.Empty) (*UserInfoResponse, error)
	UpdateUserMe(context.Context, *UserUpdateRequest) (*emptypb.Empty, error)
	DeleteUserMe(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

UserMeServer is the server API for UserMe service. All implementations must embed UnimplementedUserMeServer for forward compatibility

type UserServer

type UserServer interface {
	ListUser(context.Context, *UserListRequest) (*UserListResponse, error)
	CreateUser(context.Context, *UserCreateRequest) (*UserInfoResponse, error)
	GetUser(context.Context, *UserIDRequest) (*UserInfoResponse, error)
	UpdateUser(context.Context, *UserUpdateRequest) (*emptypb.Empty, error)
	DeleteUser(context.Context, *UserIDRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

UserServer is the server API for User service. All implementations must embed UnimplementedUserServer for forward compatibility

type UserUpdateRequest

type UserUpdateRequest struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	Role     string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"`
	Phone    string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
	Email    string `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*UserUpdateRequest) Descriptor deprecated

func (*UserUpdateRequest) Descriptor() ([]byte, []int)

Deprecated: Use UserUpdateRequest.ProtoReflect.Descriptor instead.

func (*UserUpdateRequest) GetEmail

func (x *UserUpdateRequest) GetEmail() string

func (*UserUpdateRequest) GetId

func (x *UserUpdateRequest) GetId() string

func (*UserUpdateRequest) GetPassword

func (x *UserUpdateRequest) GetPassword() string

func (*UserUpdateRequest) GetPhone

func (x *UserUpdateRequest) GetPhone() string

func (*UserUpdateRequest) GetRole

func (x *UserUpdateRequest) GetRole() string

func (*UserUpdateRequest) ProtoMessage

func (*UserUpdateRequest) ProtoMessage()

func (*UserUpdateRequest) ProtoReflect

func (x *UserUpdateRequest) ProtoReflect() protoreflect.Message

func (*UserUpdateRequest) Reset

func (x *UserUpdateRequest) Reset()

func (*UserUpdateRequest) String

func (x *UserUpdateRequest) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL