utils

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: LGPL-2.1 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs added in v1.3.2

func Abs(a uint64, b uint64) uint64

get absolute difference

func AddressToHex added in v1.2.0

func AddressToHex(addr string) string

func CheckEmpty added in v1.2.0

func CheckEmpty(s interface{}) error

func CompressToGzip added in v1.2.0

func CompressToGzip(input []byte) ([]byte, error)

func Contains

func Contains(s []string, str string) bool

func CopyStructValues added in v1.2.0

func CopyStructValues(src, dst interface{}) error

func DecompressGzip added in v1.2.0

func DecompressGzip(compressedData []byte) ([]byte, error)

func EnsureNotEmpty added in v1.2.0

func EnsureNotEmpty(s interface{}) any

func Find added in v1.2.16

func Find[T any](slice []T, predicate func(T) bool) (T, bool)

func GetFieldValueByName added in v1.2.16

func GetFieldValueByName(s interface{}, fieldName string) interface{}

func IfThenElse

func IfThenElse[T any](condition bool, a T, b T) T

func IsAlphaLowerNumericDot

func IsAlphaLowerNumericDot(str string) bool

func IsAlphaNumericDot

func IsAlphaNumericDot(str string) bool

func IsAlphaNumericDotNoNumberPrefix

func IsAlphaNumericDotNoNumberPrefix(str string) bool

func IsDomain

func IsDomain(str string) bool

func IsNumericInt added in v1.2.0

func IsNumericInt(s string) bool

func Lcg added in v1.2.0

func Lcg(seed uint64) *big.Int

func ParseQueryString

func ParseQueryString(c *gin.Context) (*[]byte, error)

func RandomAplhaNumString added in v1.2.0

func RandomAplhaNumString(length int) string

func RandomHexString added in v1.2.0

func RandomHexString(length int) string

func RandomString added in v1.2.0

func RandomString(length int) string

func ReadJSONFromFile added in v1.2.0

func ReadJSONFromFile(filePath string) (map[string]interface{}, error)

func SafePointerValue added in v1.2.0

func SafePointerValue[T any](b *T, defaultValue T) T

func SetDefaultValues added in v1.2.16

func SetDefaultValues(s interface{})

func StructToMap added in v1.2.0

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

func TimestampMilli

func TimestampMilli() uint64

func To256Bits added in v1.2.0

func To256Bits(b []byte) []byte

func ToStringSlice added in v1.2.16

func ToStringSlice(slice []interface{}) []string

func ToUint256 added in v1.2.0

func ToUint256(num *big.Int) []byte

func Uint64ToUint256 added in v1.2.0

func Uint64ToUint256(num uint64) []byte

func UuidToBytes added in v1.2.0

func UuidToBytes(uuid string) []byte

func WriteJSONToFile added in v1.2.0

func WriteJSONToFile(filePath string, data map[string]interface{}) error

writeJSON writes the given map as JSON to a file.

func WriteToCSV added in v1.2.16

func WriteToCSV(filePath string, data [][]string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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