utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JWT *jwt.JWT
View Source
var Validate *validator.Validate

Functions

func Compress

func Compress(files []*os.File, dest string) error

压缩文件 files 文件数组,可以是不同dir下的文件或者文件夹 dest 压缩文件存放地址

func DeCompress

func DeCompress(zipFile, dest string) error

解压

func GenerateID

func GenerateID() string

func GetAuthModel

func GetAuthModel(ctx *gin.Context) request.AuthModel

GetAuthModel GetAuthModel

func InitJWT

func InitJWT()

func InitPostgres

func InitPostgres(config cfg.PostgresConfiguration, debug bool) (db *gorm.DB, err error)

InitPostgres ...

func RandKey

func RandKey(ln int) string

func Return

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

Types

type Lock

type Lock interface {
	Unlock()
}

type RWLock

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

func NewRWLock

func NewRWLock() *RWLock

func (*RWLock) Lock

func (r *RWLock) Lock(key string) Lock

func (*RWLock) RLock

func (r *RWLock) RLock(key string) Lock

type RWUnlock

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

func (*RWUnlock) Unlock

func (r *RWUnlock) Unlock()

type UniversalReturn

type UniversalReturn struct {
	RequestID string      `json:"request_id,omitempty"` // 请求ID
	Code      string      `json:"code"`                 // 状态码  0 正常
	Message   string      `json:"message,omitempty"`    // 基础消息
	Data      interface{} `json:"data,omitempty"`       // 数据
}

UniversalReturn 通用返回

type Unlock

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

func (*Unlock) Unlock

func (r *Unlock) Unlock()

Jump to

Keyboard shortcuts

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