utils

package
v1.3.84 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFilterValueToFieldType added in v1.3.31

func ConvertFilterValueToFieldType(obj interface{}, filterField string, filterValue string) ([]interface{}, error)

func CopyFile

func CopyFile(sourceFile, destinationFile string) error

func FormatToHtmlTable

func FormatToHtmlTable(titles []string, datas ...any) string

func FormatToSql

func FormatToSql(data any) string

func GenerateKey added in v1.3.31

func GenerateKey() ([]byte, error)

func GetFieldValue added in v1.3.73

func GetFieldValue(sv any, fieldName string) (any, error)

func GetIpAddr added in v1.3.61

func GetIpAddr(deviceName string) (string, error)

func GetSignString added in v1.3.58

func GetSignString(r any) string

GetSignString ignore Sign in r

func HeadFirstLineFromFile added in v1.3.61

func HeadFirstLineFromFile(fileName string) (string, error)

func InArray added in v1.3.30

func InArray[T comparable](x T, ss []T) bool

func InRange added in v1.3.30

func InRange[T comparable](x T, ss ...T) bool

func IsDir

func IsDir(path string) (bool, error)

func MapToStruct

func MapToStruct(m map[string]interface{}, s interface{})

func MarshalJSONIgnoreTag added in v1.3.64

func MarshalJSONIgnoreTag(js any) ([]byte, error)

func Md5Sum

func Md5Sum(strToSign string) string

func NewRequestId

func NewRequestId() string

func RandomString

func RandomString(size int) string

func ReadCsvFile

func ReadCsvFile(fileName string, data interface{}, headerRows int) error

func Round

func Round(num float64, digits int) float64

Round 对 float64 进行四舍五入,保留指定的小数位数 digits 表示要保留的小数位数

func Sha1Sum added in v1.3.37

func Sha1Sum(strToSign string) string

func StructToMap

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

func StructToMapStrStr

func StructToMapStrStr(input interface{}) map[string]string

func ToPrettyString added in v1.3.52

func ToPrettyString(a any) string

func ToSnakeString

func ToSnakeString(s string) string

func ToString

func ToString(a any) string

ToString return "null" if a == nil

func TrimHttpStatusText added in v1.3.75

func TrimHttpStatusText(status int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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