ctl

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSid added in v1.0.17

func GenerateSid(id *int64, key string) string

func GenerateToken added in v1.0.17

func GenerateToken(id int64, expire int, signKey []byte) (string, error)

Types

type AnyParam

type AnyParam struct {
	// contains filtered or unexported fields
}

func (*AnyParam) ToFloat64

func (a *AnyParam) ToFloat64() float64

func (*AnyParam) ToInt64

func (a *AnyParam) ToInt64() int64

type Claims added in v1.0.17

type Claims struct {
	ID       int64
	Username string `json:"username"`
	jwt.StandardClaims
}

func ParseToken added in v1.0.17

func ParseToken(token *string, signKey []byte) (*Claims, error)

type Ctx added in v1.0.17

type Ctx struct {
	// contains filtered or unexported fields
}

func (*Ctx) AnyParams added in v1.0.17

func (m *Ctx) AnyParams(p string) (ap *AnyParam)

func (*Ctx) Error added in v1.0.17

func (m *Ctx) Error(err string) error

func (*Ctx) File added in v1.0.17

func (m *Ctx) File(p string) *multipart.FileHeader

func (*Ctx) Header added in v1.0.17

func (m *Ctx) Header(p string) string

func (*Ctx) Params added in v1.0.17

func (m *Ctx) Params(p string) string

func (*Ctx) Redirect added in v1.0.17

func (m *Ctx) Redirect(uri string)

func (*Ctx) RenderJson added in v1.0.17

func (m *Ctx) RenderJson(data any) *Msg

func (*Ctx) SetHeader added in v1.0.17

func (m *Ctx) SetHeader(k, v string)

func (*Ctx) SetStatusCode added in v1.0.17

func (m *Ctx) SetStatusCode(c int)

func (*Ctx) Success added in v1.0.17

func (m *Ctx) Success(msg string) error

func (*Ctx) WithCtx added in v1.0.17

func (m *Ctx) WithCtx(ctx *fasthttp.RequestCtx) *Ctx

type IMember added in v1.0.17

type IMember interface {
	CheckSid(id *int64, sid *string) bool
}

type JwtController added in v1.0.17

type JwtController struct {
	Ctx

	AuthOk func(id *int64) bool
	// contains filtered or unexported fields
}

func (*JwtController) Auth added in v1.0.17

func (m *JwtController) Auth(ctx *fasthttp.RequestCtx, name, action string) bool

Auth 所有控制层的鉴权方法 返回 true 表示成功

func (*JwtController) InitJwt added in v1.0.17

func (m *JwtController) InitJwt(signKey []byte)

func (*JwtController) SetSkipRule added in v1.0.17

func (m *JwtController) SetSkipRule(r *[][]string)

type Msg

type Msg struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
	// contains filtered or unexported fields
}

func (*Msg) Err

func (msg *Msg) Err(str string) *Msg

func (*Msg) Ok

func (msg *Msg) Ok(str string) *Msg

func (*Msg) Out

func (msg *Msg) Out() error

type SidController added in v1.0.17

type SidController struct {
	Ctx
	CheckAuth func(sid *string) bool
	// contains filtered or unexported fields
}

func (*SidController) Auth added in v1.0.17

func (m *SidController) Auth(ctx *fasthttp.RequestCtx, name, action string) bool

Auth 所有控制层的鉴权方法 返回 true 表示成功

func (*SidController) InitSid added in v1.0.17

func (m *SidController) InitSid(member IMember)

func (*SidController) SetSkipRule added in v1.0.17

func (m *SidController) SetSkipRule(r *[][]string)

Jump to

Keyboard shortcuts

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