ctl

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitUserInfo

func InitUserInfo(ctx context.Context)

func NewContext

func NewContext(ctx context.Context, u *UserInfo) context.Context

Types

type Response

type Response struct {
	Status int         `json:"status"`
	Data   interface{} `json:"data"`
	Msg    string      `json:"msg"`
	Error  string      `json:"error"`
}

Response 基础序列化器

func RespError

func RespError(ctx *gin.Context, err error, data string, code ...int) *Response

func RespSuccess

func RespSuccess(ctx *gin.Context, data interface{}, code ...int) *Response

RespSuccess 带data成功返回

type UserInfo

type UserInfo struct {
	Id       int64  `json:"id"`
	UserName string `json:"user_name"`
}

func FromContext

func FromContext(ctx context.Context) (*UserInfo, bool)

func GetUserInfo

func GetUserInfo(ctx context.Context) (*UserInfo, error)

Jump to

Keyboard shortcuts

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