api

package
v0.0.0-...-201036b Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeLoginReq

func DecodeLoginReq(ctx context.Context, r *http.Request) (request interface{}, err error)

func EncodeRes

func EncodeRes(ctx context.Context, writer http.ResponseWriter, i interface{}) error

func MakeLoginEndpoint

func MakeLoginEndpoint(api Api) endpoint.Endpoint

Types

type Api

type Api interface {
	Login(ctx context.Context, req ReqLogin) (ResLogin, error)
}

type ApiSvr

type ApiSvr struct {
	Logger     log.Logger
	UserClient pb.UserServer
}

func (ApiSvr) Login

func (svr ApiSvr) Login(ctx context.Context, req ReqLogin) (ResLogin, error)

type Remote

type Remote struct {
	// contains filtered or unexported fields
}

func NewRemote

func NewRemote(logger log.Logger, zipkinTracer *zipkin.Tracer) Remote

func (Remote) NewUserClient

func (r Remote) NewUserClient(conn *grpc.ClientConn) pb.UserServer

type ReqLogin

type ReqLogin struct {
	Username string `json:"username"`
	Pwd      string `json:"pwd"`
}

type ResLogin

type ResLogin struct {
	Code   int    `json:"code"`
	Unread int    `json:"unread"`
	Msg    string `json:"msg"`
	UID    string `json:"uid"`
}

type UserClient

type UserClient struct {
	LoginEndpoint endpoint.Endpoint
}

func (UserClient) Login

func (c UserClient) Login(ctx context.Context, req *pb.LoginReq) (*pb.LoginRes, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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