tools

package
v0.0.0-...-9c17c29 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Base64Encoding = ToBase64
View Source
var DefaultAesKey = []byte("01234567890123456789012345678901")

Functions

func AesDecrypt

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

func AesDecryptBase64

func AesDecryptBase64(data string) (string, error)

AesDecryptBase64 AesDecrypt + base64

func AesDecryptBase64WithKey

func AesDecryptBase64WithKey(data string, key []byte) (string, error)

func AesDecryptRawBase64

func AesDecryptRawBase64(data string) (string, error)

AesDecryptRawBase64 AesDecrypt + base64

func AesDecryptRawBase64WithKey

func AesDecryptRawBase64WithKey(data string, key []byte) (string, error)

func AesEncrypt

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

func AesEncryptBase64

func AesEncryptBase64(data string) (string, error)

AesEncryptBase64 AesEncrypt + base64

func AesEncryptBase64WithKey

func AesEncryptBase64WithKey(data string, key []byte) (string, error)

func AesEncryptRawBase64

func AesEncryptRawBase64(data string) (string, error)

AesEncryptRawBase64 AesEncrypt + base64

func AesEncryptRawBase64WithKey

func AesEncryptRawBase64WithKey(data string, key []byte) (string, error)

func Base64Decoding

func Base64Decoding(str string) (string, error)

func Brotil

func Brotil(data []byte) ([]byte, error)

func ContainTag

func ContainTag(tag reflect.StructTag, tagName string) bool

func DeByte

func DeByte(bytes []byte, v interface{}) (err error)

func DoTagFunc

func DoTagFunc(v interface{}, fnObjs []FnObj) (err error)

func ExecTemplate

func ExecTemplate(path string, dataMap map[string]interface{}) (res []byte, err error)

func FileExist

func FileExist(path string) bool

func FileModTime

func FileModTime(path string) (time.Time, error)

func FileSize

func FileSize(path string) (int64, error)

func GenerateId

func GenerateId(prefix string) string

func Gunzip

func Gunzip(data []byte) ([]byte, error)

func Gzip

func Gzip(data []byte) ([]byte, error)

func LoadConfig

func LoadConfig(filename string, v interface{}) error

func MD5

func MD5(str string) string

func Marshal

func Marshal(v interface{}) (bytes []byte, err error)

func MatchReg

func MatchReg(s, reg string) bool

func Mkdir

func Mkdir(path string, perm os.FileMode) (e error)

func RandInt

func RandInt(v1, v2 int) int

func ReflectCommonGet

func ReflectCommonGet(structField reflect.StructField, vValue reflect.Value) (values []string)

func ReflectCommonSet

func ReflectCommonSet(structField reflect.StructField, vValue reflect.Value, values []string) (err error)

func RegFind

func RegFind(s, reg string) []string

func RegReplace

func RegReplace(str string, reg string, newStr string) string

RegReplace 正则表达式替换

func SetDefaultValueIfNil

func SetDefaultValueIfNil(structField reflect.StructField, vValue reflect.Value, data interface{}) (err error)

func StringSliceContains

func StringSliceContains(slice []string, str string) bool

func StringSliceLike

func StringSliceLike(slice []string, str string) bool

func ToBase64

func ToBase64(str string) string

func ToByte

func ToByte(v interface{}) (bytes []byte, err error)

func ToCamel

func ToCamel(str string) (camel string)

func ToCamelByte

func ToCamelByte(src []byte) []byte

ToCamelByte converts snake_case to camelCase with high performance using bytes

func ToFloat64

func ToFloat64(s string) float64

ToFloat64 converts a string to float64

func ToInt

func ToInt(s string) int

ToInt converts a string to int

func ToJson

func ToJson(v interface{}) string

func ToString

func ToString(value interface{}) string

func ToUint64

func ToUint64(s string) uint64

ToUint64 converts a string to uint64

func UUID

func UUID() string

func UnBrotil

func UnBrotil(data []byte) ([]byte, error)

func Unmarshal

func Unmarshal(bytes []byte, v interface{}) (err error)

func UnmarshalFileYaml

func UnmarshalFileYaml(filename string, v interface{}) error

Types

type FnObj

type FnObj struct {
	Fn   func(reflect.StructField, reflect.Value, interface{}) error
	Data interface{}
}

Directories

Path Synopsis
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/.
package jsonpath is a template engine using jsonpath syntax, which can be seen at http://goessner.net/articles/JsonPath/.
forked/golang/template
This package is copied from Go library text/template.
This package is copied from Go library text/template.

Jump to

Keyboard shortcuts

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