tools

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 36 Imported by: 0

README

tools

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *gorm.DB
View Source
var (
	SignalChan chan os.Signal
)

Functions

func AesDecryptSimple

func AesDecryptSimple(crypted []byte, key string, iv string) ([]byte, error)

解密

func AesEncryptSimple

func AesEncryptSimple(origData []byte, key string, iv string) ([]byte, error)

加密

func Base64Decode

func Base64Decode(str string) (string, error)

Base64解码方法

func Base64Encoder

func Base64Encoder(str string) string

Base64编码方法

func Compress

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

压缩文件

func CurlGet

func CurlGet(url string) ([]byte, error)

func CurlGetFile

func CurlGetFile(url string, filePath string) error

func CurlPost

func CurlPost(url, params string, types int) ([]byte, error)

func DeCompress

func DeCompress(zipFile, dest string) error

解压

func Dup

func Dup(path string)

func GetSignHex

func GetSignHex(params map[string]string) string

func GetSignMd5

func GetSignMd5(params map[string]string) string

func InitMySql

func InitMySql(config DbConfig) error

func MarkingPicture

func MarkingPicture(filepath, text string) (image.Image, error)

MarkingPicture for marking picture with text

func Md5

func Md5(text string) string

MD5方法

func MonitorSignal

func MonitorSignal()

func NewLogger

func NewLogger(filename, levels string) *zap.Logger

func SendMail

func SendMail(mailTo []string, subject, nickName string, body string, config MailConnConfig) error

func WaterMark

func WaterMark(img image.Image, markText string) (image.Image, error)

WaterMark for adding a watermark on the image

Types

type DbConfig

type DbConfig struct {
	User         string
	Pwd          string
	Addr         string
	Port         string
	Table        string
	Charset      string
	MaxIdleConns int
	MaxOpenConns int
}

type MailConnConfig

type MailConnConfig struct {
	User     string
	PassWord string
	Host     string
	Port     string
}

type ReCAPTCHAResult

type ReCAPTCHAResult struct {
	Success     bool     `json:"success"`
	ChallengeTs string   `json:"challenge_ts"`
	Hostname    string   `json:"hostname"`
	ErrorCodes  []string `json:"error-codes"`
}

func CheckReCAPTCHA

func CheckReCAPTCHA(ip, response, recaptchaSecret string) (bool, ReCAPTCHAResult, error)

type RedisMethod

type RedisMethod struct {
	Pool             *redis.Pool
	RedisHost        string
	RedisPort        string
	RedisPassword    string
	RedisDb          string
	RedisMaxIdle     int
	RedisMaxActive   int
	RedisIdleTimeout int
}
var RedisClient RedisMethod

func (*RedisMethod) Announce

func (r *RedisMethod) Announce(key, s string)

func (*RedisMethod) Del

func (r *RedisMethod) Del(key string)

func (*RedisMethod) Do

func (r *RedisMethod) Do(method string, arg ...interface{}) (reply interface{}, err error)

func (*RedisMethod) EXISTS

func (r *RedisMethod) EXISTS(key string) (int, error)

func (*RedisMethod) Expire

func (r *RedisMethod) Expire(key string, num int64) (interface{}, error)

func (*RedisMethod) Get

func (r *RedisMethod) Get(key string) (interface{}, error)

func (*RedisMethod) HDel

func (r *RedisMethod) HDel(key, field string) (bool, error)

func (*RedisMethod) HGet

func (r *RedisMethod) HGet(key, field string) (interface{}, error)

func (*RedisMethod) HIncrBy

func (r *RedisMethod) HIncrBy(key, field string, value int64) (bool, error)

func (*RedisMethod) HIncrByFloat

func (r *RedisMethod) HIncrByFloat(key, field string, value float64) (bool, error)

func (*RedisMethod) HKeys

func (r *RedisMethod) HKeys(key string) ([]string, error)

func (*RedisMethod) Incr

func (r *RedisMethod) Incr(key string) (interface{}, error)

func (*RedisMethod) Info

func (r *RedisMethod) Info() (string, error)

func (*RedisMethod) Lpush

func (r *RedisMethod) Lpush(key string, value interface{}) (bool, error)

func (*RedisMethod) Rpop

func (r *RedisMethod) Rpop(key string) (interface{}, error)

func (*RedisMethod) SAdd

func (r *RedisMethod) SAdd(key string, value string) (bool, error)

func (*RedisMethod) SMembers

func (r *RedisMethod) SMembers(key string) ([]string, error)

func (*RedisMethod) Set

func (r *RedisMethod) Set(key string, value interface{}, time int64) (bool, error)

Jump to

Keyboard shortcuts

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