user

package
v0.0.0-...-2400502 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	UserService_UserLogin_FullMethodName    = "/UserService/UserLogin"
	UserService_UserRegister_FullMethodName = "/UserService/UserRegister"
	UserService_UserLogout_FullMethodName   = "/UserService/UserLogout"
)

Variables

View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "UserLogin",
			Handler:    _UserService_UserLogin_Handler,
		},
		{
			MethodName: "UserRegister",
			Handler:    _UserService_UserRegister_Handler,
		},
		{
			MethodName: "UserLogout",
			Handler:    _UserService_UserLogout_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "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. This client ignores the HTTP middlewares.

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. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterUserServiceServer

func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)

Types

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct{}

UnimplementedUserServiceServer must 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) UserLogin

func (UnimplementedUserServiceServer) UserLogout

func (UnimplementedUserServiceServer) UserRegister

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 UserCommonResponse

type UserCommonResponse struct {

	// @inject_tag: json:"code" form:"code"" uri:"code""
	Code int64 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
	// @inject_tag: json:"msg" form:"msg"" uri:"msg""
	Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
	// @inject_tag: json:"data" form:"data"" uri:"data""
	Data string `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
	// contains filtered or unexported fields
}

func (*UserCommonResponse) Descriptor deprecated

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

Deprecated: Use UserCommonResponse.ProtoReflect.Descriptor instead.

func (*UserCommonResponse) GetCode

func (x *UserCommonResponse) GetCode() int64

func (*UserCommonResponse) GetData

func (x *UserCommonResponse) GetData() string

func (*UserCommonResponse) GetMsg

func (x *UserCommonResponse) GetMsg() string

func (*UserCommonResponse) ProtoMessage

func (*UserCommonResponse) ProtoMessage()

func (*UserCommonResponse) ProtoReflect

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

func (*UserCommonResponse) Reset

func (x *UserCommonResponse) Reset()

func (*UserCommonResponse) String

func (x *UserCommonResponse) String() string

type UserDetailResponse

type UserDetailResponse struct {

	// @inject_tag: json:"user_response" form:"user_response" uri:"user_response"
	UserDetail *UserResponse `protobuf:"bytes,1,opt,name=UserDetail,proto3" json:"UserDetail,omitempty"`
	// @inject_tag: json:"code" form:"code"" uri:"code""
	Code int64 `protobuf:"varint,2,opt,name=Code,proto3" json:"Code,omitempty"`
	// contains filtered or unexported fields
}

func (*UserDetailResponse) Descriptor deprecated

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

Deprecated: Use UserDetailResponse.ProtoReflect.Descriptor instead.

func (*UserDetailResponse) GetCode

func (x *UserDetailResponse) GetCode() int64

func (*UserDetailResponse) GetUserDetail

func (x *UserDetailResponse) GetUserDetail() *UserResponse

func (*UserDetailResponse) ProtoMessage

func (*UserDetailResponse) ProtoMessage()

func (*UserDetailResponse) ProtoReflect

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

func (*UserDetailResponse) Reset

func (x *UserDetailResponse) Reset()

func (*UserDetailResponse) String

func (x *UserDetailResponse) String() string

type UserRequest

type UserRequest struct {

	// @inject_tag: json:"nick_name" form:"nick_name" uri:"nick_name"
	NickName string `protobuf:"bytes,1,opt,name=NickName,proto3" json:"NickName,omitempty"`
	// @inject_tag: json:"user_name" form:"user_name" uri:"user_name"
	UserName string `protobuf:"bytes,2,opt,name=UserName,proto3" json:"UserName,omitempty"`
	// @inject_tag: json:"password" form:"password" uri:"password"
	Password string `protobuf:"bytes,3,opt,name=Password,proto3" json:"Password,omitempty"`
	// @inject_tag: json:"password_confirm" form:"password_confirm" uri:"password_confirm"
	PasswordConfirm string `protobuf:"bytes,4,opt,name=PasswordConfirm,proto3" json:"PasswordConfirm,omitempty"`
	// contains filtered or unexported fields
}

func (*UserRequest) Descriptor deprecated

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

Deprecated: Use UserRequest.ProtoReflect.Descriptor instead.

func (*UserRequest) GetNickName

func (x *UserRequest) GetNickName() string

func (*UserRequest) GetPassword

func (x *UserRequest) GetPassword() string

func (*UserRequest) GetPasswordConfirm

func (x *UserRequest) GetPasswordConfirm() string

func (*UserRequest) GetUserName

func (x *UserRequest) GetUserName() string

func (*UserRequest) ProtoMessage

func (*UserRequest) ProtoMessage()

func (*UserRequest) ProtoReflect

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

func (*UserRequest) Reset

func (x *UserRequest) Reset()

func (*UserRequest) String

func (x *UserRequest) String() string

type UserResponse

type UserResponse struct {

	// @inject_tag: json:"user_id" form:"user_id" uri:"user_id"
	UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId,omitempty"`
	// @inject_tag: json:"nick_name" form:"nick_name" uri:"nick_name"
	NickName string `protobuf:"bytes,2,opt,name=NickName,proto3" json:"NickName,omitempty"`
	// @inject_tag: json:"user_name" form:"user_name" uri:"user_name"
	UserName string `protobuf:"bytes,3,opt,name=UserName,proto3" json:"UserName,omitempty"`
	// contains filtered or unexported fields
}

func (*UserResponse) Descriptor deprecated

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

Deprecated: Use UserResponse.ProtoReflect.Descriptor instead.

func (*UserResponse) GetNickName

func (x *UserResponse) GetNickName() string

func (*UserResponse) GetUserId

func (x *UserResponse) GetUserId() int64

func (*UserResponse) GetUserName

func (x *UserResponse) GetUserName() string

func (*UserResponse) ProtoMessage

func (*UserResponse) ProtoMessage()

func (*UserResponse) ProtoReflect

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

func (*UserResponse) Reset

func (x *UserResponse) Reset()

func (*UserResponse) String

func (x *UserResponse) String() string

type UserServiceClient

type UserServiceClient interface {
	UserLogin(ctx context.Context, in *UserRequest, opts ...grpc.CallOption) (*UserDetailResponse, error)
	UserRegister(ctx context.Context, in *UserRequest, opts ...grpc.CallOption) (*UserCommonResponse, error)
	UserLogout(ctx context.Context, in *UserRequest, opts ...grpc.CallOption) (*UserCommonResponse, 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.

type UserServiceServer

type UserServiceServer interface {
	UserLogin(context.Context, *UserRequest) (*UserDetailResponse, error)
	UserRegister(context.Context, *UserRequest) (*UserCommonResponse, error)
	UserLogout(context.Context, *UserRequest) (*UserCommonResponse, error)
	// contains filtered or unexported methods
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility.

Jump to

Keyboard shortcuts

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