http

package
v0.4.27 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const UserIdKey = "user_id"
View Source
const UserKey = "user"

Variables

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

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

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
	User() interface{}
}

type Ctx

type Ctx struct {
	*gin.Context
}

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) 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