account

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package account is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var AccountBase_Level_name = map[int32]string{
	0: "LevelDefault",
	1: "LevelOne",
	2: "LevelTwo",
	3: "LevelThree",
}
View Source
var AccountBase_Level_value = map[string]int32{
	"LevelDefault": 0,
	"LevelOne":     1,
	"LevelTwo":     2,
	"LevelThree":   3,
}
View Source
var AccountBase_Status_name = map[int32]string{
	0: "StatusDefault",
	1: "StatusNormal",
	2: "StatusFrozen",
}
View Source
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) Descriptor() ([]byte, []int)

func (*AccountID) GetId

func (m *AccountID) GetId() int64

func (*AccountID) ProtoMessage

func (*AccountID) ProtoMessage()

func (*AccountID) Reset

func (m *AccountID) Reset()

func (*AccountID) String

func (m *AccountID) String() string

func (*AccountID) XXX_DiscardUnknown

func (m *AccountID) XXX_DiscardUnknown()

func (*AccountID) XXX_Marshal

func (m *AccountID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AccountID) XXX_Merge

func (m *AccountID) XXX_Merge(src proto.Message)

func (*AccountID) XXX_Size

func (m *AccountID) XXX_Size() int

func (*AccountID) XXX_Unmarshal

func (m *AccountID) XXX_Unmarshal(b []byte) error

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) Descriptor() ([]byte, []int)

func (*Null) ProtoMessage

func (*Null) ProtoMessage()

func (*Null) Reset

func (m *Null) Reset()

func (*Null) String

func (m *Null) String() string

func (*Null) XXX_DiscardUnknown

func (m *Null) XXX_DiscardUnknown()

func (*Null) XXX_Marshal

func (m *Null) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Null) XXX_Merge

func (m *Null) XXX_Merge(src proto.Message)

func (*Null) XXX_Size

func (m *Null) XXX_Size() int

func (*Null) XXX_Unmarshal

func (m *Null) XXX_Unmarshal(b []byte) error

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) Descriptor() ([]byte, []int)

func (*Page) GetCount

func (m *Page) GetCount() int64

func (*Page) GetPageIndex

func (m *Page) GetPageIndex() int64

func (*Page) GetPageSize

func (m *Page) GetPageSize() int64

func (*Page) GetPageTotal

func (m *Page) GetPageTotal() int64

func (*Page) GetTotal

func (m *Page) GetTotal() int64

func (*Page) ProtoMessage

func (*Page) ProtoMessage()

func (*Page) Reset

func (m *Page) Reset()

func (*Page) String

func (m *Page) String() string

func (*Page) XXX_DiscardUnknown

func (m *Page) XXX_DiscardUnknown()

func (*Page) XXX_Marshal

func (m *Page) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Page) XXX_Merge

func (m *Page) XXX_Merge(src proto.Message)

func (*Page) XXX_Size

func (m *Page) XXX_Size() int

func (*Page) XXX_Unmarshal

func (m *Page) XXX_Unmarshal(b []byte) error

type UnimplementedAccountServiceServer

type UnimplementedAccountServiceServer struct {
}

UnimplementedAccountServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAccountServiceServer) AccountAdd

func (*UnimplementedAccountServiceServer) AccountQueryOne

func (*UnimplementedAccountServiceServer) AccountUpdate

Directories

Path Synopsis
protoc-gen-swagger

Jump to

Keyboard shortcuts

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