rest

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Standard length of uniuri string to achive ~95 bits of entropy.
	StdLen = 16
	// Length of uniurl string to achive ~119 bits of entropy, closest
	// to what can be losslessly converted to UUIDv4 (122 bits).
	UUIDLen = 20
)

Variables

View Source
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")

Standard characters allowed in uniuri string.

Functions

func AllAuth

func AllAuth(auth ...map[string]int64) map[string]int64

将auth存储起来

func Auth

func Auth() gin.HandlerFunc

鉴权接口

func CheckVerify

func CheckVerify(ctx *gin.Context, code string) bool

func ClearAllSession

func ClearAllSession(ctx *gin.Context)

func Cors

func Cors() gin.HandlerFunc

* * @Description: 允許跨域限制 * @return: gin.HandlerFunc * @Author: Iori * @Date: 2022-07-26 16:04:04 *

func GetFuncMap

func GetFuncMap() template.FuncMap

func GetSession

func GetSession(ctx *gin.Context, k string) interface{}

func IsDecimals

func IsDecimals(str ...string) bool

纯小数

func IsEmail

func IsEmail(str ...string) bool

邮箱 最高30位

func IsEngishLowCase

func IsEngishLowCase(str ...string) bool

************************ 英文类型 ************************ 仅小写

func IsEnglish

func IsEnglish(str ...string) bool

大小写混合

func IsEnglishCap

func IsEnglishCap(str ...string) bool

仅大写

func IsID

func IsID(str ...string) bool

************************ 自定义类型 *********************** 数字+字母 不限制大小写 6~30位

func IsInteger

func IsInteger(str ...string) bool

************************ 数字类型 *********************** 纯整数

func IsMobile

func IsMobile(str ...string) bool

手提电话(不带前缀)最高11位

func IsPwd

func IsPwd(str ...string) bool

数字+字母+符号 6~30位

func IsTelephone

func IsTelephone(str ...string) bool

家用电话(不带前缀) 最高8位

func LoadRoleId

func LoadRoleId(ctx *gin.Context) interface{}

func LoadUser

func LoadUser(ctx *gin.Context) interface{}

func LoadVerify

func LoadVerify(ctx *gin.Context)

func Match

func Match(p string, s string) bool

func Md5Encode

func Md5Encode(arg0 string) string

func Md5EncodeV2

func Md5EncodeV2(arg0 string) string

func New

func New() string

New returns a new random string of the standard length, consisting of standard characters.

func NewLen

func NewLen(length int) string

NewLen returns a new random string of the provided length, consisting of standard characters.

func NewLenChars

func NewLenChars(length int, chars []byte) string

NewLenChars returns a new random string of the provided length, consisting of the provided byte slice of allowed characters (maximum 256).

func NoMethod

func NoMethod(ctx *gin.Context)

func NoRoute

func NoRoute(ctx *gin.Context)

对未定义的路由规则进行处理

func Result

func Result(ctx *gin.Context, code int32, data interface{}, msg string)

func ResultErrCode

func ResultErrCode(ctx *gin.Context, code int32, data interface{}, msg string)

func ResultFail

func ResultFail(ctx *gin.Context, err interface{})

func ResultFailData

func ResultFailData(ctx *gin.Context, data interface{}, err interface{})

func ResultList

func ResultList(ctx *gin.Context, data interface{}, total int64)

func ResultOk

func ResultOk(ctx *gin.Context, data interface{})

func ResultOkMsg

func ResultOkMsg(ctx *gin.Context, data interface{}, msg string)

func SaveRoleId

func SaveRoleId(ctx *gin.Context, roleId interface{})

func SaveUser

func SaveUser(ctx *gin.Context, user interface{})

func SetSession

func SetSession(ctx *gin.Context, k string, o interface{})

Types

type Controller

type Controller struct {
	Auth bool
	Data interface{}
}

type Image

type Image struct {
	*image.NRGBA
	// contains filtered or unexported fields
}

func NewImage

func NewImage(digits []byte, width, height int) *Image

func (*Image) WriteTo

func (img *Image) WriteTo(w io.Writer) (int64, error)

type JsonDate

type JsonDate time.Time

func (JsonDate) MarshalJSON

func (c JsonDate) MarshalJSON() ([]byte, error)

func (*JsonDate) UnmarshalJSON

func (p *JsonDate) UnmarshalJSON(data []byte) (err error)

type JsonDateTime

type JsonDateTime time.Time

func (JsonDateTime) MarshalJSON

func (c JsonDateTime) MarshalJSON() ([]byte, error)

func (JsonDateTime) String

func (c JsonDateTime) String() string

func (*JsonDateTime) UnmarshalJSON

func (p *JsonDateTime) UnmarshalJSON(data []byte) (err error)

type JsonTime

type JsonTime time.Time

func (JsonTime) MarshalJSON

func (c JsonTime) MarshalJSON() ([]byte, error)

func (JsonTime) String

func (c JsonTime) String() string

func (*JsonTime) UnmarshalJSON

func (p *JsonTime) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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