v1

package
v0.3.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterUserServant

func RegisterUserServant(e *gin.Engine, s User, b UserBinding, r UserRender)

RegisterUserServant register User servant to gin

Types

type AgentInfo

type AgentInfo struct {
	Platform  string `json:"platform"`
	UserAgent string `json:"user_agent"`
}

type LoginReq

type LoginReq struct {
	AgentInfo AgentInfo `json:"agent_info"`
	Name      string    `json:"name"`
	Passwd    string    `json:"passwd"`
}

type LoginResp

type LoginResp struct {
	UserInfo
	ServerInfo ServerInfo `json:"server_info"`
	JwtToken   string     `json:"jwt_token"`
}

type ServerInfo

type ServerInfo struct {
	ApiVer string `json:"api_ver"`
}

type UnimplementedUserBinding

type UnimplementedUserBinding struct {
	BindAny func(*gin.Context, any) mir.Error
}

UnimplementedUserBinding can be embedded to have forward compatible implementations.

func (*UnimplementedUserBinding) BindLogin

func (b *UnimplementedUserBinding) BindLogin(c *gin.Context) (*LoginReq, mir.Error)

type UnimplementedUserRender

type UnimplementedUserRender struct {
	RenderAny func(*gin.Context, any, mir.Error)
}

UnimplementedUserRender can be embedded to have forward compatible implementations.

func (*UnimplementedUserRender) RenderLogin

func (r *UnimplementedUserRender) RenderLogin(c *gin.Context, data *LoginResp, err mir.Error)

func (*UnimplementedUserRender) RenderLogout

func (r *UnimplementedUserRender) RenderLogout(c *gin.Context, err mir.Error)

type UnimplementedUserServant

type UnimplementedUserServant struct {
}

UnimplementedUserServant can be embedded to have forward compatible implementations.

func (UnimplementedUserServant) Chain

func (UnimplementedUserServant) Login

func (UnimplementedUserServant) Login(req *LoginReq) (*LoginResp, mir.Error)

func (UnimplementedUserServant) Logout

func (UnimplementedUserServant) Logout() mir.Error

type User

type User interface {
	// Chain provide handlers chain for gin
	Chain() gin.HandlersChain

	Logout() mir.Error
	Login(*LoginReq) (*LoginResp, mir.Error)
	// contains filtered or unexported methods
}

type UserBinding

type UserBinding interface {
	BindLogin(*gin.Context) (*LoginReq, mir.Error)
	// contains filtered or unexported methods
}

type UserInfo

type UserInfo struct {
	Name string `json:"name"`
}

type UserRender

type UserRender interface {
	RenderLogout(*gin.Context, mir.Error)
	RenderLogin(*gin.Context, *LoginResp, mir.Error)
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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