http

package
v0.5.16 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

View Source
const UserIdKey = "user_id"

Variables

View Source
var NewContext = func(ctx *gin.Context) Context {
	return &Ctx{
		Context: ctx,
	}
}

NewContext 最好在中间件已经赋值以下两个参数 ginCtx.Set("user", nil) ginCtx.Set("user_id", nil)

View Source
var UserModel interface{}

UserModel 不能赋值指针

Functions

func Cors

func Cors() gin.HandlerFunc

Cors 跨域

Types

type Context

type Context interface {
	Success(data interface{})
	Fail(err error)
	Gin() *gin.Context
	Token() string
	Id() uint64
	IdStr() string
	User() interface{}
}

type Ctx

type Ctx struct {
	*gin.Context

	UserInfo interface{}
}

func (Ctx) Fail

func (receiver Ctx) Fail(err error)

func (Ctx) Gin

func (receiver Ctx) Gin() *gin.Context

func (Ctx) Id

func (receiver Ctx) Id() uint64

func (Ctx) IdStr added in v0.5.15

func (receiver Ctx) IdStr() string

func (Ctx) InitUser added in v0.5.15

func (receiver Ctx) InitUser()

func (Ctx) Success

func (receiver Ctx) Success(data interface{})

func (Ctx) Token

func (receiver Ctx) Token() string

func (Ctx) User

func (receiver Ctx) User() interface{}

Jump to

Keyboard shortcuts

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