Documentation ¶
Index ¶
- Variables
- func NewXClientForExample(addr string) (client.XClient, error)
- func RegisterExampleHTTPServer(g *gin.RouterGroup, srv ExampleHTTPServer)
- func ServeForExample(addr string) error
- type ExampleAble
- type ExampleClient
- type ExampleHTTPServer
- type ExampleImpl
- type ExampleOneClient
- type LoginReq
- func (*LoginReq) Descriptor() ([]byte, []int)
- func (m *LoginReq) GetPassword() string
- func (m *LoginReq) GetUsername() string
- func (m *LoginReq) Marshal() (dAtA []byte, err error)
- func (m *LoginReq) MarshalTo(dAtA []byte) (int, error)
- func (m *LoginReq) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LoginReq) ProtoMessage()
- func (m *LoginReq) Reset()
- func (m *LoginReq) Size() (n int)
- func (m *LoginReq) String() string
- func (m *LoginReq) Unmarshal(dAtA []byte) error
- func (m *LoginReq) XXX_DiscardUnknown()
- func (m *LoginReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LoginReq) XXX_Merge(src proto.Message)
- func (m *LoginReq) XXX_Size() int
- func (m *LoginReq) XXX_Unmarshal(b []byte) error
- type LoginRsp
- func (*LoginRsp) Descriptor() ([]byte, []int)
- func (m *LoginRsp) GetExpiresAt() int64
- func (m *LoginRsp) GetToken() string
- func (m *LoginRsp) Marshal() (dAtA []byte, err error)
- func (m *LoginRsp) MarshalTo(dAtA []byte) (int, error)
- func (m *LoginRsp) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LoginRsp) ProtoMessage()
- func (m *LoginRsp) Reset()
- func (m *LoginRsp) Size() (n int)
- func (m *LoginRsp) String() string
- func (m *LoginRsp) Unmarshal(dAtA []byte) error
- func (m *LoginRsp) XXX_DiscardUnknown()
- func (m *LoginRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LoginRsp) XXX_Merge(src proto.Message)
- func (m *LoginRsp) XXX_Size() int
- func (m *LoginRsp) XXX_Unmarshal(b []byte) error
- type SmsReq
- func (*SmsReq) Descriptor() ([]byte, []int)
- func (m *SmsReq) GetMobile() string
- func (m *SmsReq) Marshal() (dAtA []byte, err error)
- func (m *SmsReq) MarshalTo(dAtA []byte) (int, error)
- func (m *SmsReq) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SmsReq) ProtoMessage()
- func (m *SmsReq) Reset()
- func (m *SmsReq) Size() (n int)
- func (m *SmsReq) String() string
- func (m *SmsReq) Unmarshal(dAtA []byte) error
- func (m *SmsReq) XXX_DiscardUnknown()
- func (m *SmsReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SmsReq) XXX_Merge(src proto.Message)
- func (m *SmsReq) XXX_Size() int
- func (m *SmsReq) XXX_Unmarshal(b []byte) error
- type SmsRsp
- func (*SmsRsp) Descriptor() ([]byte, []int)
- func (m *SmsRsp) GetCode() string
- func (m *SmsRsp) Marshal() (dAtA []byte, err error)
- func (m *SmsRsp) MarshalTo(dAtA []byte) (int, error)
- func (m *SmsRsp) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SmsRsp) ProtoMessage()
- func (m *SmsRsp) Reset()
- func (m *SmsRsp) Size() (n int)
- func (m *SmsRsp) String() string
- func (m *SmsRsp) Unmarshal(dAtA []byte) error
- func (m *SmsRsp) XXX_DiscardUnknown()
- func (m *SmsRsp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SmsRsp) XXX_Merge(src proto.Message)
- func (m *SmsRsp) XXX_Size() int
- func (m *SmsRsp) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewXClientForExample ¶
NewXClientForExample creates a XClient. You can configure this client with more options such as etcd registry, serialize type, select algorithm and fail mode.
func RegisterExampleHTTPServer ¶
func RegisterExampleHTTPServer(g *gin.RouterGroup, srv ExampleHTTPServer)
func ServeForExample ¶
ServeForExample starts a server only registers one service. You can register more services and only start one server. It blocks until the application exits.
Types ¶
type ExampleAble ¶
type ExampleAble interface { // Login is server rpc method as defined Login(ctx context.Context, args *LoginReq, reply *LoginRsp) (err error) // Sms is server rpc method as defined Sms(ctx context.Context, args *SmsReq, reply *SmsRsp) (err error) }
================== interface skeleton ===================
type ExampleClient ¶
type ExampleClient struct {
// contains filtered or unexported fields
}
================== client stub =================== Example is a client wrapped XClient.
func NewExampleClient ¶
func NewExampleClient(xclient client.XClient) *ExampleClient
NewExampleClient wraps a XClient as ExampleClient. You can pass a shared XClient object created by NewXClientForExample.
type ExampleHTTPServer ¶
type ExampleHTTPServer interface { // Login Login(context.Context, *LoginReq) (*LoginRsp, error) // Sms Sms(context.Context, *SmsReq) (*SmsRsp, error) }
ExampleHTTPServer
type ExampleImpl ¶
type ExampleImpl struct{}
================== server skeleton ===================
type ExampleOneClient ¶
type ExampleOneClient struct {
// contains filtered or unexported fields
}
================== oneclient stub =================== ExampleOneClient is a client wrapped oneClient.
func NewExampleOneClient ¶
func NewExampleOneClient(oneclient *client.OneClient) *ExampleOneClient
NewExampleOneClient wraps a OneClient as ExampleOneClient. You can pass a shared OneClient object created by NewOneClientForExample.
type LoginReq ¶
type LoginReq struct { // @gotags: binding:"required" Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` // @gotags: binding:"required" Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LoginReq) Descriptor ¶
func (*LoginReq) GetPassword ¶
func (*LoginReq) GetUsername ¶
func (*LoginReq) MarshalToSizedBuffer ¶
func (*LoginReq) ProtoMessage ¶
func (*LoginReq) ProtoMessage()
func (*LoginReq) XXX_DiscardUnknown ¶
func (m *LoginReq) XXX_DiscardUnknown()
func (*LoginReq) XXX_Marshal ¶
func (*LoginReq) XXX_Unmarshal ¶
type LoginRsp ¶
type LoginRsp struct { Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` ExpiresAt int64 `protobuf:"varint,2,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LoginRsp) Descriptor ¶
func (*LoginRsp) GetExpiresAt ¶
func (*LoginRsp) MarshalToSizedBuffer ¶
func (*LoginRsp) ProtoMessage ¶
func (*LoginRsp) ProtoMessage()
func (*LoginRsp) XXX_DiscardUnknown ¶
func (m *LoginRsp) XXX_DiscardUnknown()
func (*LoginRsp) XXX_Marshal ¶
func (*LoginRsp) XXX_Unmarshal ¶
type SmsReq ¶
type SmsReq struct { // @gotags: binding:"required,mobile" Mobile string `protobuf:"bytes,1,opt,name=mobile,proto3" json:"mobile,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SmsReq) Descriptor ¶
func (*SmsReq) MarshalToSizedBuffer ¶
func (*SmsReq) ProtoMessage ¶
func (*SmsReq) ProtoMessage()
func (*SmsReq) XXX_DiscardUnknown ¶
func (m *SmsReq) XXX_DiscardUnknown()
func (*SmsReq) XXX_Marshal ¶
func (*SmsReq) XXX_Unmarshal ¶
type SmsRsp ¶
type SmsRsp struct { Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SmsRsp) Descriptor ¶
func (*SmsRsp) MarshalToSizedBuffer ¶
func (*SmsRsp) ProtoMessage ¶
func (*SmsRsp) ProtoMessage()
func (*SmsRsp) XXX_DiscardUnknown ¶
func (m *SmsRsp) XXX_DiscardUnknown()