example

package
v0.0.0-...-1c24166 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_example_example_proto protoreflect.FileDescriptor

Functions

func NewXClientForExample

func NewXClientForExample(addr string) (client.XClient, error)

NewXClientForExample creates a XClient. You can configure this client with more options such as etcd registry, serialize type, select algorithm and fail mode.

func RegisterExampleHTTPService

func RegisterExampleHTTPService(g *gin.RouterGroup, svc ExampleHTTPService)

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.

func (*ExampleClient) Login

func (c *ExampleClient) Login(ctx context.Context, args *LoginReq) (reply *LoginRsp, err error)

Login is client rpc method as defined

func (*ExampleClient) Sms

func (c *ExampleClient) Sms(ctx context.Context, args *SmsReq) (reply *SmsRsp, err error)

Sms is client rpc method as defined

type ExampleHTTPService

type ExampleHTTPService interface {
	// Login ...
	Login(context.Context, *LoginReq) (*LoginRsp, error)
	// Sms ...
	Sms(context.Context, *SmsReq) (*SmsRsp, error)
}

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.

func (*ExampleOneClient) Login

func (c *ExampleOneClient) Login(ctx context.Context, args *LoginReq) (reply *LoginRsp, err error)

Login is client rpc method as defined

func (*ExampleOneClient) Sms

func (c *ExampleOneClient) Sms(ctx context.Context, args *SmsReq) (reply *SmsRsp, err error)

Sms is client rpc method as defined

type LoginReq

type LoginReq struct {

	// @gotags: binding:"required"
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty" binding:"required"`
	// @gotags: binding:"required"
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" binding:"required"`
	// contains filtered or unexported fields
}

func (*LoginReq) Descriptor deprecated

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

Deprecated: Use LoginReq.ProtoReflect.Descriptor instead.

func (*LoginReq) GetPassword

func (x *LoginReq) GetPassword() string

func (*LoginReq) GetUsername

func (x *LoginReq) GetUsername() string

func (*LoginReq) ProtoMessage

func (*LoginReq) ProtoMessage()

func (*LoginReq) ProtoReflect

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

func (*LoginReq) Reset

func (x *LoginReq) Reset()

func (*LoginReq) String

func (x *LoginReq) String() string

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"`
	// contains filtered or unexported fields
}

func (*LoginRsp) Descriptor deprecated

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

Deprecated: Use LoginRsp.ProtoReflect.Descriptor instead.

func (*LoginRsp) GetExpiresAt

func (x *LoginRsp) GetExpiresAt() int64

func (*LoginRsp) GetToken

func (x *LoginRsp) GetToken() string

func (*LoginRsp) ProtoMessage

func (*LoginRsp) ProtoMessage()

func (*LoginRsp) ProtoReflect

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

func (*LoginRsp) Reset

func (x *LoginRsp) Reset()

func (*LoginRsp) String

func (x *LoginRsp) String() string

type SmsReq

type SmsReq struct {

	// @gotags: binding:"required,mobile"
	Mobile string `protobuf:"bytes,1,opt,name=mobile,proto3" json:"mobile,omitempty" binding:"required,mobile"`
	// contains filtered or unexported fields
}

func (*SmsReq) Descriptor deprecated

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

Deprecated: Use SmsReq.ProtoReflect.Descriptor instead.

func (*SmsReq) GetMobile

func (x *SmsReq) GetMobile() string

func (*SmsReq) ProtoMessage

func (*SmsReq) ProtoMessage()

func (*SmsReq) ProtoReflect

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

func (*SmsReq) Reset

func (x *SmsReq) Reset()

func (*SmsReq) String

func (x *SmsReq) String() string

type SmsRsp

type SmsRsp struct {
	Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

func (*SmsRsp) Descriptor deprecated

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

Deprecated: Use SmsRsp.ProtoReflect.Descriptor instead.

func (*SmsRsp) GetCode

func (x *SmsRsp) GetCode() string

func (*SmsRsp) ProtoMessage

func (*SmsRsp) ProtoMessage()

func (*SmsRsp) ProtoReflect

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

func (*SmsRsp) Reset

func (x *SmsRsp) Reset()

func (*SmsRsp) String

func (x *SmsRsp) String() string

Jump to

Keyboard shortcuts

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