common

package
v0.0.0-...-7dcfe9a Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthHeaderKey = "Authorization"
	AuthBearerKey = "Bearer " // I have a blank space

	AuthAccessKey = "accessToken"
)
View Source
const (
	CacheRsaBits   = 1024
	CacheSignInKey = "global:sign_in:key"
)
View Source
const (
	RespCodeSuccess  = 200
	RespCodeNotFound = 404
	RespCodeNeedAuth = 401

	RespCodeInternalError = 500
)
View Source
const (
	RespMsgNotFount = "not found"
	RespMsgIdNum    = "id must be a int value"
)
View Source
const (
	DefaultTimeFormatter = "2006-01-02:15:04:05"
	DateFormatter        = "2006-01-02"
	DateFormatterNoSplit = "20060102"
	DefaultCodeLen       = 16
)
View Source
const (
	UserStatusActivate   = 20
	UserStatusDeActivate = 10
)
View Source
const (
	ContentBlank = ""
)

Variables

This section is empty.

Functions

func Authorization

func Authorization(ctx iris.Context) (claims *jwt.Claims, success bool)

func FormatTime

func FormatTime(t time.Time) (s string)

func GetAuthorization

func GetAuthorization(ctx iris.Context) (tokenStr string)

func GetCtxToken

func GetCtxToken(ctx iris.Context, token *jwt.Claims)

func GetOrg

func GetOrg(ctx iris.Context) int

func RandCode

func RandCode(n int) string

func RandTxt

func RandTxt(n int) string

func RandomString

func RandomString(n int) string

func ResponseJSON

func ResponseJSON(ctx iris.Context, j interface{})

func SaveCtxToken

func SaveCtxToken(ctx iris.Context, token *jwt.Claims)

func VerifyToken

func VerifyToken(tokenStr string) (claims *jwt.Claims, success bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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