user

package
v0.0.0-...-fd4dc81 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	UserSex_name = map[int32]string{
		0: "DEFAULT",
		1: "MEN",
		2: "WOMEN",
	}
	UserSex_value = map[string]int32{
		"DEFAULT": 0,
		"MEN":     1,
		"WOMEN":   2,
	}
)

Enum value maps for UserSex.

View Source
var File_user_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "user.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "UserInfo",
			Handler:    _UserService_UserInfo_Handler,
		},
		{
			MethodName: "UserDelete",
			Handler:    _UserService_UserDelete_Handler,
		},
		{
			MethodName: "UserQueryOne",
			Handler:    _UserService_UserQueryOne_Handler,
		},
		{
			MethodName: "UserQueryAll",
			Handler:    _UserService_UserQueryAll_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 Null

type Null struct {
	// contains filtered or unexported fields
}

空消息

func (*Null) Descriptor deprecated

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

Deprecated: Use Null.ProtoReflect.Descriptor instead.

func (*Null) ProtoMessage

func (*Null) ProtoMessage()

func (*Null) ProtoReflect

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

func (*Null) Reset

func (x *Null) Reset()

func (*Null) String

func (x *Null) String() string

type Page

type Page struct {

	//  页
	PageIndex int64 `protobuf:"varint,1,opt,name=page_index,json=pageIndex,proto3" json:"page_index,omitempty"`
	//  每页大小
	PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	//  总页数
	PageTotal int64 `protobuf:"varint,3,opt,name=page_total,json=pageTotal,proto3" json:"page_total,omitempty"`
	//  条数
	Count int64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"`
	//  总条数
	Total int64 `protobuf:"varint,5,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

分页

func (*Page) Descriptor deprecated

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

Deprecated: Use Page.ProtoReflect.Descriptor instead.

func (*Page) GetCount

func (x *Page) GetCount() int64

func (*Page) GetPageIndex

func (x *Page) GetPageIndex() int64

func (*Page) GetPageSize

func (x *Page) GetPageSize() int64

func (*Page) GetPageTotal

func (x *Page) GetPageTotal() int64

func (*Page) GetTotal

func (x *Page) GetTotal() int64

func (*Page) ProtoMessage

func (*Page) ProtoMessage()

func (*Page) ProtoReflect

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

func (*Page) Reset

func (x *Page) Reset()

func (*Page) String

func (x *Page) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) UserDelete

func (UnimplementedUserServiceServer) UserInfo

func (UnimplementedUserServiceServer) UserQueryAll

func (UnimplementedUserServiceServer) UserQueryOne

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 UserAll

type UserAll struct {

	//  用户信息
	All []*UserBase `protobuf:"bytes,1,rep,name=all,proto3" json:"all,omitempty"`
	//  页数
	Page *Page `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"`
	// contains filtered or unexported fields
}

用户全部

func (*UserAll) Descriptor deprecated

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

Deprecated: Use UserAll.ProtoReflect.Descriptor instead.

func (*UserAll) GetAll

func (x *UserAll) GetAll() []*UserBase

func (*UserAll) GetPage

func (x *UserAll) GetPage() *Page

func (*UserAll) ProtoMessage

func (*UserAll) ProtoMessage()

func (*UserAll) ProtoReflect

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

func (*UserAll) Reset

func (x *UserAll) Reset()

func (*UserAll) String

func (x *UserAll) String() string

type UserAllOption

type UserAllOption struct {

	//  用户性别
	Sex UserSex `protobuf:"varint,1,opt,name=sex,proto3,enum=user.UserSex" json:"sex,omitempty"`
	//  页数
	Page *Page `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"`
	//  用户名称
	UserName string `protobuf:"bytes,3,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"`
	// contains filtered or unexported fields
}

用户全部选项

func (*UserAllOption) Descriptor deprecated

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

Deprecated: Use UserAllOption.ProtoReflect.Descriptor instead.

func (*UserAllOption) GetPage

func (x *UserAllOption) GetPage() *Page

func (*UserAllOption) GetSex

func (x *UserAllOption) GetSex() UserSex

func (*UserAllOption) GetUserName

func (x *UserAllOption) GetUserName() string

func (*UserAllOption) ProtoMessage

func (*UserAllOption) ProtoMessage()

func (*UserAllOption) ProtoReflect

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

func (*UserAllOption) Reset

func (x *UserAllOption) Reset()

func (*UserAllOption) String

func (x *UserAllOption) String() string

type UserBase

type UserBase struct {

	//  @inject_tag: db:"id"
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	//  @inject_tag: db:"user_name" valid:"required~用户名称必须存在"
	UserName string `protobuf:"bytes,2,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"`
	//  @inject_tag: db:"iphone" valid:"required~手机号必须存在"
	Iphone string `protobuf:"bytes,3,opt,name=iphone,proto3" json:"iphone,omitempty"`
	//  @inject_tag: db:"password"
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"`
	//  @inject_tag: db:"sex"
	Sex UserSex `protobuf:"varint,5,opt,name=sex,proto3,enum=user.UserSex" json:"sex,omitempty"`
	// contains filtered or unexported fields
}

注入标签: https://github.com/favadi/protoc-go-inject-tag 用户基本信息

func (*UserBase) Descriptor deprecated

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

Deprecated: Use UserBase.ProtoReflect.Descriptor instead.

func (*UserBase) GetId

func (x *UserBase) GetId() int64

func (*UserBase) GetIphone

func (x *UserBase) GetIphone() string

func (*UserBase) GetPassword

func (x *UserBase) GetPassword() string

func (*UserBase) GetSex

func (x *UserBase) GetSex() UserSex

func (*UserBase) GetUserName

func (x *UserBase) GetUserName() string

func (*UserBase) ProtoMessage

func (*UserBase) ProtoMessage()

func (*UserBase) ProtoReflect

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

func (*UserBase) Reset

func (x *UserBase) Reset()

func (*UserBase) String

func (x *UserBase) String() string

type UserID

type UserID struct {

	//  用户id
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*UserID) Descriptor deprecated

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

Deprecated: Use UserID.ProtoReflect.Descriptor instead.

func (*UserID) GetId

func (x *UserID) GetId() int64

func (*UserID) ProtoMessage

func (*UserID) ProtoMessage()

func (*UserID) ProtoReflect

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

func (*UserID) Reset

func (x *UserID) Reset()

func (*UserID) String

func (x *UserID) String() string

type UserServiceClient

type UserServiceClient interface {
	//  用户资料
	UserInfo(ctx context.Context, in *UserBase, opts ...grpc.CallOption) (*UserBase, error)
	//  用户删除
	UserDelete(ctx context.Context, in *UserID, opts ...grpc.CallOption) (*UserID, error)
	//  用户查询一个
	UserQueryOne(ctx context.Context, in *UserID, opts ...grpc.CallOption) (*UserBase, error)
	//  用户查询全部
	UserQueryAll(ctx context.Context, in *UserAllOption, opts ...grpc.CallOption) (*UserAll, 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 {
	//  用户资料
	UserInfo(context.Context, *UserBase) (*UserBase, error)
	//  用户删除
	UserDelete(context.Context, *UserID) (*UserID, error)
	//  用户查询一个
	UserQueryOne(context.Context, *UserID) (*UserBase, error)
	//  用户查询全部
	UserQueryAll(context.Context, *UserAllOption) (*UserAll, error)
	// contains filtered or unexported methods
}

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

type UserSex

type UserSex int32

用户性别

const (
	UserSex_DEFAULT UserSex = 0
	UserSex_MEN     UserSex = 1
	UserSex_WOMEN   UserSex = 2
)

func (UserSex) Descriptor

func (UserSex) Descriptor() protoreflect.EnumDescriptor

func (UserSex) Enum

func (x UserSex) Enum() *UserSex

func (UserSex) EnumDescriptor deprecated

func (UserSex) EnumDescriptor() ([]byte, []int)

Deprecated: Use UserSex.Descriptor instead.

func (UserSex) Number

func (x UserSex) Number() protoreflect.EnumNumber

func (UserSex) String

func (x UserSex) String() string

func (UserSex) Type

func (UserSex) Type() protoreflect.EnumType

Jump to

Keyboard shortcuts

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