client

package
v0.0.0-...-f6cb80d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCErrCode

func GRPCErrCode(err error) int

func GRPCStatus

func GRPCStatus(err error) codes.Code

Types

type UserInfo

type UserInfo struct {
	ID        int
	Username  string
	FirstName string
	LastName  string
	Phone     string
	Email     string
	LastLogin time.Time
}

type UserInfoModifyView

type UserInfoModifyView struct {
	FirstName string
	LastName  string
	Phone     string
	Email     string
}

type UserInfoRegisterView

type UserInfoRegisterView struct {
	Username  string
	Password  string
	FirstName string
	LastName  string
	Phone     string
	Email     string
}

type UserServiceClient

type UserServiceClient interface {
	Register(ctx context.Context, info *UserInfoRegisterView) (userID int, err error)
	Login(ctx context.Context, username string, password string, ip string, expireAt *time.Time) (token string, actualExpireAt time.Time, err error)
	Authenticate(ctx context.Context, token string) (userID int, err error)

	GetUserInfo(ctx context.Context, userID int) (info *UserInfo, err error)
	ModifyUserInfo(ctx context.Context, info *UserInfoModifyView, userID int) error
	ModifyPassword(ctx context.Context, newPassword string, oldPassword string, userID int) error
}

func NewUserServiceClient

func NewUserServiceClient(ctx context.Context, serviceAddr string, opts ...grpc.DialOption) UserServiceClient

Jump to

Keyboard shortcuts

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