tools

package
v0.0.0-...-a32abf6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Unlicense Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(uid int64) (token string, err error)

func Diff2StructMap

func Diff2StructMap(origin, compare interface{}, tag string) (change map[string]interface{})

func Diff2StructMapAndFromTo

func Diff2StructMapAndFromTo(origin, compare interface{}, tag string) (change, fromTo map[string]interface{})

func DiffStruct

func DiffStruct(origin, compare interface{}, tag string) (diff string)

func DiffStructIsChange

func DiffStructIsChange(origin, compare interface{}) (isChange bool)

func FileToBase64

func FileToBase64(fileName, filePath string) (s string, err error)

func FindInArray

func FindInArray[T, K comparable](array []T, compare K, f func(item T, compare K) bool) bool

func GetExpireTime

func GetExpireTime() (ExpireHour time.Duration)

func GetExpiresAt

func GetExpiresAt() (expiresAt int64)

func Hash

func Hash(o string) (s string)

func Load

func Load()

func NewCron

func NewCron() *cron.Cron

func Reverse

func Reverse[T comparable](s []T) []T

func SaveFile

func SaveFile(fileName, fileBody, filePath string) (err error)

Types

type Claims

type Claims struct {
	*jwt.StandardClaims
	Payload
}

func VerifyToken

func VerifyToken(tokenString string) (claims *Claims, err error)

type Image

type Image interface {
	GetUrl(Name string) string
	GetToken() string
}

type MinioOss

type MinioOss struct {
	Mac *minio.Client
	// contains filtered or unexported fields
}

func NewMinioImage

func NewMinioImage(accessKey, secretKey, domain string) (q *MinioOss, err error)

func (*MinioOss) GetUrl

func (q *MinioOss) GetUrl(ctx context.Context, key string) (s string)

func (*MinioOss) NewToken

func (q *MinioOss) NewToken(bucket string) (t string)

func (*MinioOss) UploadFile

func (q *MinioOss) UploadFile(ctx context.Context, filename string, file []byte) (key string, err error)

type Oss

type Oss interface {
	NewToken(bucket string) string
	GetUrl(ctx context.Context, key string) string
	UploadFile(ctx context.Context, filename string, file []byte) (string, error)
}

func NewOss

func NewOss() (Oss, error)

type Payload

type Payload struct {
	Uid       int64
	TokenType string
}

type QiNiuiOss

type QiNiuiOss struct {
	Mac *qbox.Mac
	// contains filtered or unexported fields
}

func NewQiNiuOss

func NewQiNiuOss(accessKey, secretKey, domain string) (q *QiNiuiOss)

func (*QiNiuiOss) GetUrl

func (q *QiNiuiOss) GetUrl(key string) string

func (*QiNiuiOss) NewToken

func (q *QiNiuiOss) NewToken(bucket string) string

type SshSocket

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

func NewSshSocket

func NewSshSocket(username, password, host string, port int, hostId int64) (ss *SshSocket, err error)

func (*SshSocket) Close

func (s *SshSocket) Close() (err error)

func (*SshSocket) CombinedOutput

func (s *SshSocket) CombinedOutput(cmd string) (b []byte, err error)

func (*SshSocket) Run

func (s *SshSocket) Run(ws *websocket.Conn)

func (*SshSocket) Session

func (s *SshSocket) Session() (err error)

func (*SshSocket) SetSpeed

func (s *SshSocket) SetSpeed(speed int) (err error)

func (*SshSocket) Write

func (s *SshSocket) Write(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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