helper

package
v0.0.0-...-999043c Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AesKey = []byte("0123456789abcdef")
View Source
var ConfigFile = "config.json"

Functions

func AesDecrypt

func AesDecrypt(crypted, key []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(origData, key []byte) ([]byte, error)

func CleanExtraCharacters

func CleanExtraCharacters(a string, b string) string

func CleanSuperfluousSpace

func CleanSuperfluousSpace(s string) string

func CreateUUID

func CreateUUID() string

func DefaultAesDecrypt

func DefaultAesDecrypt(crypted []byte) ([]byte, error)

func DefaultAesEncrypt

func DefaultAesEncrypt(origData []byte) ([]byte, error)

func Get

func Get(url string, p string) string

func GetConfig

func GetConfig(key string) interface{}

func GetConsulClientId

func GetConsulClientId() string

func GetFreePort

func GetFreePort() int

func GetLocalIP

func GetLocalIP() string

func GetSelfFilePath

func GetSelfFilePath() string

func GetStructByDb

func GetStructByDb(tableName string, packageName string, structName string) (string, error)

func InArray

func InArray(t string, arr []string) bool

func Interface2Interface

func Interface2Interface(in interface{}) (out interface{})

func Interface2Map

func Interface2Map(in interface{}, out map[string]interface{})

func Interface2Struct

func Interface2Struct(in interface{}, out interface{})

func IsUseConsul

func IsUseConsul() bool

func JsonByFile

func JsonByFile(file string, v interface{})

func JsonDbDriver

func JsonDbDriver() *db.Driver

func JsonDbDriverOpen

func JsonDbDriverOpen(parent db.Entity) *db.Driver

func JsonEncode

func JsonEncode(v interface{}) string

func JsonToFile

func JsonToFile(file string, v interface{}) bool

func LoadConfig

func LoadConfig(key string, i interface{})

func Md5

func Md5(data string) string

func Md5ToString

func Md5ToString(data string) string

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func PathExists

func PathExists(path string) bool

func Post

func Post(url string, p string) string

func PostRaw

func PostRaw(url string, data string) (string, error)

func RandomInt

func RandomInt(length int) int

func RandomStr

func RandomStr(length int) string

func SaveConfig

func SaveConfig(key string, i interface{})

func SetConsulClientId

func SetConsulClientId(id string)

func StartLogToFile

func StartLogToFile(dir string)

func Unzip

func Unzip(file string, path string) error

func UseConsul

func UseConsul()

Types

type HttpDo

type HttpDo struct {
	Url      string
	Data     map[string]string
	FileKey  string
	FileName string
	File     io.Reader
}

func (HttpDo) Get

func (that HttpDo) Get() ([]byte, error)

func (HttpDo) Post

func (that HttpDo) Post() ([]byte, error)

func (HttpDo) Request

func (that HttpDo) Request(method string) ([]byte, error)

type JsonDb

type JsonDb struct {
	UUID string `json:"uuid"`
}

func (*JsonDb) ID

func (that *JsonDb) ID() (jsonField string, value interface{})

type Log

type Log struct {
}

func GetInstanceLog

func GetInstanceLog() *Log

func (*Log) Out

func (l *Log) Out(args ...interface{})

Jump to

Keyboard shortcuts

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