Documentation ¶
Overview ¶
Package user is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- 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.Server, srv UserServiceServer)
- type Null
- func (*Null) Descriptor() ([]byte, []int)
- func (*Null) ProtoMessage()
- func (m *Null) Reset()
- func (m *Null) String() string
- func (m *Null) XXX_DiscardUnknown()
- func (m *Null) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Null) XXX_Merge(src proto.Message)
- func (m *Null) XXX_Size() int
- func (m *Null) XXX_Unmarshal(b []byte) error
- type Page
- func (*Page) Descriptor() ([]byte, []int)
- func (m *Page) GetCount() int64
- func (m *Page) GetPageIndex() int64
- func (m *Page) GetPageSize() int64
- func (m *Page) GetPageTotal() int64
- func (m *Page) GetTotal() int64
- func (*Page) ProtoMessage()
- func (m *Page) Reset()
- func (m *Page) String() string
- func (m *Page) XXX_DiscardUnknown()
- func (m *Page) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Page) XXX_Merge(src proto.Message)
- func (m *Page) XXX_Size() int
- func (m *Page) XXX_Unmarshal(b []byte) error
- type UnimplementedUserServiceServer
- func (*UnimplementedUserServiceServer) UserAdd(ctx context.Context, req *UserBase) (*UserBase, error)
- func (*UnimplementedUserServiceServer) UserDelete(ctx context.Context, req *UserID) (*UserID, error)
- func (*UnimplementedUserServiceServer) UserQueryAll(ctx context.Context, req *UserAllOption) (*UserAll, error)
- func (*UnimplementedUserServiceServer) UserQueryOne(ctx context.Context, req *UserID) (*UserBase, error)
- func (*UnimplementedUserServiceServer) UserUpdate(ctx context.Context, req *UserBase) (*UserBase, error)
- type UserAll
- func (*UserAll) Descriptor() ([]byte, []int)
- func (m *UserAll) GetAll() []*UserBase
- func (m *UserAll) GetPage() *Page
- func (*UserAll) ProtoMessage()
- func (m *UserAll) Reset()
- func (m *UserAll) String() string
- func (m *UserAll) XXX_DiscardUnknown()
- func (m *UserAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserAll) XXX_Merge(src proto.Message)
- func (m *UserAll) XXX_Size() int
- func (m *UserAll) XXX_Unmarshal(b []byte) error
- type UserAllOption
- func (*UserAllOption) Descriptor() ([]byte, []int)
- func (m *UserAllOption) GetPage() *Page
- func (m *UserAllOption) GetSex() UserSex
- func (m *UserAllOption) GetUserName() string
- func (*UserAllOption) ProtoMessage()
- func (m *UserAllOption) Reset()
- func (m *UserAllOption) String() string
- func (m *UserAllOption) XXX_DiscardUnknown()
- func (m *UserAllOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserAllOption) XXX_Merge(src proto.Message)
- func (m *UserAllOption) XXX_Size() int
- func (m *UserAllOption) XXX_Unmarshal(b []byte) error
- type UserBase
- func (*UserBase) Descriptor() ([]byte, []int)
- func (m *UserBase) GetId() int64
- func (m *UserBase) GetIphone() string
- func (m *UserBase) GetPassword() string
- func (m *UserBase) GetSex() UserSex
- func (m *UserBase) GetUserName() string
- func (*UserBase) ProtoMessage()
- func (m *UserBase) Reset()
- func (m *UserBase) String() string
- func (m *UserBase) XXX_DiscardUnknown()
- func (m *UserBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserBase) XXX_Merge(src proto.Message)
- func (m *UserBase) XXX_Size() int
- func (m *UserBase) XXX_Unmarshal(b []byte) error
- type UserID
- func (*UserID) Descriptor() ([]byte, []int)
- func (m *UserID) GetId() int64
- func (*UserID) ProtoMessage()
- func (m *UserID) Reset()
- func (m *UserID) String() string
- func (m *UserID) XXX_DiscardUnknown()
- func (m *UserID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserID) XXX_Merge(src proto.Message)
- func (m *UserID) XXX_Size() int
- func (m *UserID) XXX_Unmarshal(b []byte) error
- type UserServiceClient
- type UserServiceServer
- type UserSex
Constants ¶
This section is empty.
Variables ¶
var UserSex_name = map[int32]string{
0: "DEFAULT",
1: "MEN",
2: "WOMEN",
}
var UserSex_value = map[string]int32{
"DEFAULT": 0,
"MEN": 1,
"WOMEN": 2,
}
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.
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)
Types ¶
type Null ¶
type Null struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
空消息
func (*Null) Descriptor ¶
func (*Null) ProtoMessage ¶
func (*Null) ProtoMessage()
func (*Null) XXX_DiscardUnknown ¶
func (m *Null) XXX_DiscardUnknown()
func (*Null) XXX_Unmarshal ¶
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
分页
func (*Page) Descriptor ¶
func (*Page) GetPageIndex ¶
func (*Page) GetPageSize ¶
func (*Page) GetPageTotal ¶
func (*Page) ProtoMessage ¶
func (*Page) ProtoMessage()
func (*Page) XXX_DiscardUnknown ¶
func (m *Page) XXX_DiscardUnknown()
func (*Page) XXX_Unmarshal ¶
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedUserServiceServer) UserDelete ¶
func (*UnimplementedUserServiceServer) UserQueryAll ¶
func (*UnimplementedUserServiceServer) UserQueryAll(ctx context.Context, req *UserAllOption) (*UserAll, error)
func (*UnimplementedUserServiceServer) UserQueryOne ¶
func (*UnimplementedUserServiceServer) UserUpdate ¶
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
用户全部
func (*UserAll) Descriptor ¶
func (*UserAll) ProtoMessage ¶
func (*UserAll) ProtoMessage()
func (*UserAll) XXX_DiscardUnknown ¶
func (m *UserAll) XXX_DiscardUnknown()
func (*UserAll) XXX_Marshal ¶
func (*UserAll) XXX_Unmarshal ¶
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
用户全部选项
func (*UserAllOption) Descriptor ¶
func (*UserAllOption) Descriptor() ([]byte, []int)
func (*UserAllOption) GetPage ¶
func (m *UserAllOption) GetPage() *Page
func (*UserAllOption) GetSex ¶
func (m *UserAllOption) GetSex() UserSex
func (*UserAllOption) GetUserName ¶
func (m *UserAllOption) GetUserName() string
func (*UserAllOption) ProtoMessage ¶
func (*UserAllOption) ProtoMessage()
func (*UserAllOption) Reset ¶
func (m *UserAllOption) Reset()
func (*UserAllOption) String ¶
func (m *UserAllOption) String() string
func (*UserAllOption) XXX_DiscardUnknown ¶
func (m *UserAllOption) XXX_DiscardUnknown()
func (*UserAllOption) XXX_Marshal ¶
func (m *UserAllOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UserAllOption) XXX_Merge ¶
func (m *UserAllOption) XXX_Merge(src proto.Message)
func (*UserAllOption) XXX_Size ¶
func (m *UserAllOption) XXX_Size() int
func (*UserAllOption) XXX_Unmarshal ¶
func (m *UserAllOption) XXX_Unmarshal(b []byte) error
type UserBase ¶
type UserBase struct { // @inject_tag: db:"id" Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"id"` // @inject_tag: db:"user_name" valid:"required~用户名称必须存在" UserName string `` /* 142-byte string literal not displayed */ // @inject_tag: db:"iphone" valid:"required~手机号必须存在" Iphone string `protobuf:"bytes,3,opt,name=iphone,proto3" json:"iphone,omitempty" db:"iphone" valid:"required~手机号必须存在"` // @inject_tag: db:"password" Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty" db:"password"` // @inject_tag: db:"sex" Sex UserSex `protobuf:"varint,5,opt,name=sex,proto3,enum=user.UserSex" json:"sex,omitempty" db:"sex"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
注入标签: https://github.com/favadi/protoc-go-inject-tag 用户基本信息
func (*UserBase) Descriptor ¶
func (*UserBase) GetPassword ¶
func (*UserBase) GetUserName ¶
func (*UserBase) ProtoMessage ¶
func (*UserBase) ProtoMessage()
func (*UserBase) XXX_DiscardUnknown ¶
func (m *UserBase) XXX_DiscardUnknown()
func (*UserBase) XXX_Marshal ¶
func (*UserBase) XXX_Unmarshal ¶
type UserID ¶
type UserID struct { // 用户id Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*UserID) Descriptor ¶
func (*UserID) ProtoMessage ¶
func (*UserID) ProtoMessage()
func (*UserID) XXX_DiscardUnknown ¶
func (m *UserID) XXX_DiscardUnknown()
func (*UserID) XXX_Marshal ¶
func (*UserID) XXX_Unmarshal ¶
type UserServiceClient ¶
type UserServiceClient interface { // 用户添加 UserAdd(ctx context.Context, in *UserBase, opts ...grpc.CallOption) (*UserBase, error) // 用户更新 UserUpdate(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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewUserServiceClient ¶
func NewUserServiceClient(cc *grpc.ClientConn) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { // 用户添加 UserAdd(context.Context, *UserBase) (*UserBase, error) // 用户更新 UserUpdate(context.Context, *UserBase) (*UserBase, error) // 用户删除 UserDelete(context.Context, *UserID) (*UserID, error) // 用户查询一个 UserQueryOne(context.Context, *UserID) (*UserBase, error) // 用户查询全部 UserQueryAll(context.Context, *UserAllOption) (*UserAll, error) }
UserServiceServer is the server API for UserService service.