Documentation ¶
Overview ¶
Package account is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error
- func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error
- func RegisterAccountServiceServer(s *grpc.Server, srv AccountServiceServer)
- type AccountAll
- func (*AccountAll) Descriptor() ([]byte, []int)
- func (m *AccountAll) GetAll() []*AccountBase
- func (m *AccountAll) GetPage() *Page
- func (*AccountAll) ProtoMessage()
- func (m *AccountAll) Reset()
- func (m *AccountAll) String() string
- func (m *AccountAll) XXX_DiscardUnknown()
- func (m *AccountAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountAll) XXX_Merge(src proto.Message)
- func (m *AccountAll) XXX_Size() int
- func (m *AccountAll) XXX_Unmarshal(b []byte) error
- type AccountBase
- func (*AccountBase) Descriptor() ([]byte, []int)
- func (m *AccountBase) GetAccountLevel() AccountBase_Level
- func (m *AccountBase) GetAccountStatus() AccountBase_Status
- func (m *AccountBase) GetBalance() float32
- func (m *AccountBase) GetId() int64
- func (m *AccountBase) GetUserId() int64
- func (*AccountBase) ProtoMessage()
- func (m *AccountBase) Reset()
- func (m *AccountBase) String() string
- func (m *AccountBase) XXX_DiscardUnknown()
- func (m *AccountBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountBase) XXX_Merge(src proto.Message)
- func (m *AccountBase) XXX_Size() int
- func (m *AccountBase) XXX_Unmarshal(b []byte) error
- type AccountBase_Level
- type AccountBase_Status
- type AccountID
- func (*AccountID) Descriptor() ([]byte, []int)
- func (m *AccountID) GetId() int64
- func (*AccountID) ProtoMessage()
- func (m *AccountID) Reset()
- func (m *AccountID) String() string
- func (m *AccountID) XXX_DiscardUnknown()
- func (m *AccountID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountID) XXX_Merge(src proto.Message)
- func (m *AccountID) XXX_Size() int
- func (m *AccountID) XXX_Unmarshal(b []byte) error
- type AccountServiceClient
- type AccountServiceServer
- type AccountUpdateReq
- func (*AccountUpdateReq) Descriptor() ([]byte, []int)
- func (m *AccountUpdateReq) GetBalance() float32
- func (m *AccountUpdateReq) GetId() int64
- func (*AccountUpdateReq) ProtoMessage()
- func (m *AccountUpdateReq) Reset()
- func (m *AccountUpdateReq) String() string
- func (m *AccountUpdateReq) XXX_DiscardUnknown()
- func (m *AccountUpdateReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountUpdateReq) XXX_Merge(src proto.Message)
- func (m *AccountUpdateReq) XXX_Size() int
- func (m *AccountUpdateReq) XXX_Unmarshal(b []byte) error
- 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 UnimplementedAccountServiceServer
- func (*UnimplementedAccountServiceServer) AccountAdd(ctx context.Context, req *AccountBase) (*AccountBase, error)
- func (*UnimplementedAccountServiceServer) AccountQueryOne(ctx context.Context, req *AccountID) (*AccountBase, error)
- func (*UnimplementedAccountServiceServer) AccountUpdate(ctx context.Context, req *AccountUpdateReq) (*empty.Empty, error)
Constants ¶
This section is empty.
Variables ¶
var AccountBase_Level_name = map[int32]string{
0: "LevelDefault",
1: "LevelOne",
2: "LevelTwo",
3: "LevelThree",
}
var AccountBase_Level_value = map[string]int32{
"LevelDefault": 0,
"LevelOne": 1,
"LevelTwo": 2,
"LevelThree": 3,
}
var AccountBase_Status_name = map[int32]string{
0: "StatusDefault",
1: "StatusNormal",
2: "StatusFrozen",
}
var AccountBase_Status_value = map[string]int32{
"StatusDefault": 0,
"StatusNormal": 1,
"StatusFrozen": 2,
}
Functions ¶
func RegisterAccountServiceHandler ¶
func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterAccountServiceHandler registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterAccountServiceHandlerClient ¶
func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error
RegisterAccountServiceHandlerClient registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AccountServiceClient" to call the correct interceptors.
func RegisterAccountServiceHandlerFromEndpoint ¶
func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterAccountServiceHandlerFromEndpoint is same as RegisterAccountServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAccountServiceHandlerServer ¶
func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error
RegisterAccountServiceHandlerServer registers the http handlers for service AccountService to "mux". UnaryRPC :call AccountServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
func RegisterAccountServiceServer ¶
func RegisterAccountServiceServer(s *grpc.Server, srv AccountServiceServer)
Types ¶
type AccountAll ¶
type AccountAll struct { // 账户信息 All []*AccountBase `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 (*AccountAll) Descriptor ¶
func (*AccountAll) Descriptor() ([]byte, []int)
func (*AccountAll) GetAll ¶
func (m *AccountAll) GetAll() []*AccountBase
func (*AccountAll) GetPage ¶
func (m *AccountAll) GetPage() *Page
func (*AccountAll) ProtoMessage ¶
func (*AccountAll) ProtoMessage()
func (*AccountAll) Reset ¶
func (m *AccountAll) Reset()
func (*AccountAll) String ¶
func (m *AccountAll) String() string
func (*AccountAll) XXX_DiscardUnknown ¶
func (m *AccountAll) XXX_DiscardUnknown()
func (*AccountAll) XXX_Marshal ¶
func (m *AccountAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AccountAll) XXX_Merge ¶
func (m *AccountAll) XXX_Merge(src proto.Message)
func (*AccountAll) XXX_Size ¶
func (m *AccountAll) XXX_Size() int
func (*AccountAll) XXX_Unmarshal ¶
func (m *AccountAll) XXX_Unmarshal(b []byte) error
type AccountBase ¶
type AccountBase struct { // @inject_tag: db:"id" Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" db:"id"` // @inject_tag: db:"user_id" valid:"required~用户id必须存在" UserId int64 `` /* 131-byte string literal not displayed */ // @inject_tag: db:"account_level" valid:"required~账户级别必须存在" AccountLevel AccountBase_Level `` /* 190-byte string literal not displayed */ // @inject_tag: db:"balance" Balance float32 `protobuf:"fixed32,4,opt,name=balance,proto3" json:"balance,omitempty" db:"balance"` // @inject_tag: db:"account_status" valid:"required~账户状态必须存在" AccountStatus AccountBase_Status `` /* 195-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
注入标签: https://github.com/favadi/protoc-go-inject-tag 账户基本信息
func (*AccountBase) Descriptor ¶
func (*AccountBase) Descriptor() ([]byte, []int)
func (*AccountBase) GetAccountLevel ¶
func (m *AccountBase) GetAccountLevel() AccountBase_Level
func (*AccountBase) GetAccountStatus ¶
func (m *AccountBase) GetAccountStatus() AccountBase_Status
func (*AccountBase) GetBalance ¶
func (m *AccountBase) GetBalance() float32
func (*AccountBase) GetId ¶
func (m *AccountBase) GetId() int64
func (*AccountBase) GetUserId ¶
func (m *AccountBase) GetUserId() int64
func (*AccountBase) ProtoMessage ¶
func (*AccountBase) ProtoMessage()
func (*AccountBase) Reset ¶
func (m *AccountBase) Reset()
func (*AccountBase) String ¶
func (m *AccountBase) String() string
func (*AccountBase) XXX_DiscardUnknown ¶
func (m *AccountBase) XXX_DiscardUnknown()
func (*AccountBase) XXX_Marshal ¶
func (m *AccountBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AccountBase) XXX_Merge ¶
func (m *AccountBase) XXX_Merge(src proto.Message)
func (*AccountBase) XXX_Size ¶
func (m *AccountBase) XXX_Size() int
func (*AccountBase) XXX_Unmarshal ¶
func (m *AccountBase) XXX_Unmarshal(b []byte) error
type AccountBase_Level ¶
type AccountBase_Level int32
账户级别
const ( AccountBase_LevelDefault AccountBase_Level = 0 AccountBase_LevelOne AccountBase_Level = 1 AccountBase_LevelTwo AccountBase_Level = 2 AccountBase_LevelThree AccountBase_Level = 3 )
func (AccountBase_Level) EnumDescriptor ¶
func (AccountBase_Level) EnumDescriptor() ([]byte, []int)
func (AccountBase_Level) String ¶
func (x AccountBase_Level) String() string
type AccountBase_Status ¶
type AccountBase_Status int32
账户状态
const ( AccountBase_StatusDefault AccountBase_Status = 0 // 正常 AccountBase_StatusNormal AccountBase_Status = 1 // 冻结 AccountBase_StatusFrozen AccountBase_Status = 2 )
func (AccountBase_Status) EnumDescriptor ¶
func (AccountBase_Status) EnumDescriptor() ([]byte, []int)
func (AccountBase_Status) String ¶
func (x AccountBase_Status) String() string
type AccountID ¶
type AccountID 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 (*AccountID) Descriptor ¶
func (*AccountID) ProtoMessage ¶
func (*AccountID) ProtoMessage()
func (*AccountID) XXX_DiscardUnknown ¶
func (m *AccountID) XXX_DiscardUnknown()
func (*AccountID) XXX_Marshal ¶
func (*AccountID) XXX_Unmarshal ¶
type AccountServiceClient ¶
type AccountServiceClient interface { // 账户添加 AccountAdd(ctx context.Context, in *AccountBase, opts ...grpc.CallOption) (*AccountBase, error) // 账户更新 AccountUpdate(ctx context.Context, in *AccountUpdateReq, opts ...grpc.CallOption) (*empty.Empty, error) // 账户查询一个 AccountQueryOne(ctx context.Context, in *AccountID, opts ...grpc.CallOption) (*AccountBase, error) }
AccountServiceClient is the client API for AccountService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewAccountServiceClient ¶
func NewAccountServiceClient(cc *grpc.ClientConn) AccountServiceClient
type AccountServiceServer ¶
type AccountServiceServer interface { // 账户添加 AccountAdd(context.Context, *AccountBase) (*AccountBase, error) // 账户更新 AccountUpdate(context.Context, *AccountUpdateReq) (*empty.Empty, error) // 账户查询一个 AccountQueryOne(context.Context, *AccountID) (*AccountBase, error) }
AccountServiceServer is the server API for AccountService service.
type AccountUpdateReq ¶
type AccountUpdateReq struct { // 账户id Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 账户余额 Balance float32 `protobuf:"fixed32,2,opt,name=balance,proto3" json:"balance,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
账户更新请求
func (*AccountUpdateReq) Descriptor ¶
func (*AccountUpdateReq) Descriptor() ([]byte, []int)
func (*AccountUpdateReq) GetBalance ¶
func (m *AccountUpdateReq) GetBalance() float32
func (*AccountUpdateReq) GetId ¶
func (m *AccountUpdateReq) GetId() int64
func (*AccountUpdateReq) ProtoMessage ¶
func (*AccountUpdateReq) ProtoMessage()
func (*AccountUpdateReq) Reset ¶
func (m *AccountUpdateReq) Reset()
func (*AccountUpdateReq) String ¶
func (m *AccountUpdateReq) String() string
func (*AccountUpdateReq) XXX_DiscardUnknown ¶
func (m *AccountUpdateReq) XXX_DiscardUnknown()
func (*AccountUpdateReq) XXX_Marshal ¶
func (m *AccountUpdateReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AccountUpdateReq) XXX_Merge ¶
func (m *AccountUpdateReq) XXX_Merge(src proto.Message)
func (*AccountUpdateReq) XXX_Size ¶
func (m *AccountUpdateReq) XXX_Size() int
func (*AccountUpdateReq) XXX_Unmarshal ¶
func (m *AccountUpdateReq) XXX_Unmarshal(b []byte) error
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 UnimplementedAccountServiceServer ¶
type UnimplementedAccountServiceServer struct { }
UnimplementedAccountServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedAccountServiceServer) AccountAdd ¶
func (*UnimplementedAccountServiceServer) AccountAdd(ctx context.Context, req *AccountBase) (*AccountBase, error)
func (*UnimplementedAccountServiceServer) AccountQueryOne ¶
func (*UnimplementedAccountServiceServer) AccountQueryOne(ctx context.Context, req *AccountID) (*AccountBase, error)
func (*UnimplementedAccountServiceServer) AccountUpdate ¶
func (*UnimplementedAccountServiceServer) AccountUpdate(ctx context.Context, req *AccountUpdateReq) (*empty.Empty, error)