utils

package
v0.0.0-...-23c13d2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Newekey   = "2GrE5hsXx0URawilALpj6zNnQ47odFqm"
	Newescret = "1389bcefgktuvyBCDHIJKMOPSTVWYZ"
)

Functions

func AuthToken

func AuthToken(tokenString string) (string, error)

解析token

func BoolToInt

func BoolToInt(b bool) int

func Camel2Case

func Camel2Case(name string) string

驼峰式写法转为下划线写法

func Decrypt

func Decrypt(password string, obtenationIterations int, cipherText string, salt []byte) (string, error)

PBE解密

func DownImg

func DownImg(url string) (string, error)

func EncodeMD5

func EncodeMD5(value string) string

func Encrypt

func Encrypt(password string, obtenationIterations int, plainText string, salt []byte) (string, error)

PBE加密

func GetUUID

func GetUUID() string

func InArrar

func InArrar(key string, arr []string) bool

func JoinInt

func JoinInt(ints []int, sep string) string

func JoinInt64

func JoinInt64(ints []int64, sep string) string

func Lcfirst

func Lcfirst(str string) string

首字母小写

func MD5Sum

func MD5Sum(txt string) (sum string)

func MapToStatus

func MapToStatus(a interface{}, b map[string]interface{}, c interface{}) error

func NeweDecode

func NeweDecode(str string) int64

解密

func NeweEncode

func NeweEncode(num int64) string

加密

func RandKey

func RandKey(length int) (string, string)

生成密钥

func SetToken

func SetToken(uuid string) (string, error)

生成TOken

func SplitInt

func SplitInt(str, sep string) []int

func SplitInt64

func SplitInt64(str, sep string) []int64

func StAtoB

func StAtoB(a, b, c interface{}) error

a 数据源 b 新的结构体 c 指针

func Struct2Map

func Struct2Map(obj interface{}) map[string]interface{}

func Ucfirst

func Ucfirst(str string) string

首字母大写

func WriteImg

func WriteImg(src multipart.File) (string, error)

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i interface{}) *Buffer

type PageList

type PageList struct {
	List     interface{} `gorm:"-" json:"list"`
	Page     int         `gorm:"-" json:"page" form:"page"`         //当前页
	PageSize int         `gorm:"-" json:"pageSize" form:"pageSize"` //每页数量
	Total    int64       `gorm:"-" json:"total"`                    //总条数
}

func (*PageList) GetOffice

func (p *PageList) GetOffice() int

Jump to

Keyboard shortcuts

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