util

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64

func Base64(params string) string

先base64,然后MD5

func Base64Bytes

func Base64Bytes(bytes []byte) string

先base64,然后MD5

func Base64MD5

func Base64MD5(params string) string

先base64,然后MD5

func BoolAddr added in v0.0.15

func BoolAddr(b bool) *bool

func C2Camel added in v0.0.3

func C2Camel(str string) string

C转驼峰

func Camel2C added in v0.0.3

func Camel2C(str string) string

驼峰转C

func Capitalize

func Capitalize(str string) string

字符首字母大写转换

func ConditionString

func ConditionString(condition bool, f1 interface{}, f2 interface{}) string

func Contains

func Contains(container interface{}, obj interface{}) (bool, error)

func ContainsAll

func ContainsAll(container interface{}, objs []interface{}) (bool, error)

func ContainsAny

func ContainsAny(container interface{}, objs []interface{}) (bool, error)

func CopyFields

func CopyFields(dest interface{}, src interface{}, fields ...string) (err error)

按名字和类型复制(&a,b)b->a

func CopyFieldsExcept

func CopyFieldsExcept(dest interface{}, src interface{}, fields ...string) (err error)

按名字和类型复制(&a,b)b->a

func CreateSqlResFormatFactory

func CreateSqlResFormatFactory() *sqlResFormatTree

func DbFieldName added in v0.0.3

func DbFieldName(s string) string

func DbFields added in v0.0.3

func DbFields(kv map[string]interface{}) map[string]interface{}

func DefaultString

func DefaultString(s string, defaultValue string) string

func DeleteElement

func DeleteElement(src []string, elem string) []string

func DeleteElements

func DeleteElements(src []string, elems []string) []string

func FillFields added in v0.0.3

func FillFields(dest interface{}, src interface{}, fields ...string) (err error)

按名字和类型复制(&a,b)b->a: a.field为空的取a.field

func Filter

func Filter(container interface{}, objs []interface{}) (interface{}, error)

func First added in v0.0.3

func First[T any](items []T, filter func(T) bool) T

func FormatParamterContent added in v0.0.8

func FormatParamterContent(content string, params map[string]string) string

func GenerateRandomNumeric added in v0.0.14

func GenerateRandomNumeric(length int) string

func GenerateRandomString

func GenerateRandomString(length int) string

func GetRecordField added in v0.0.15

func GetRecordField(record interface{}, path string) (interface{}, bool)

func GetRecordFieldValue added in v0.0.15

func GetRecordFieldValue[T any](record interface{}, path string, v T) T

func Int32Addr

func Int32Addr(i int32) *int32

func Int64Addr

func Int64Addr(i int64) *int64

func IntAddr

func IntAddr(i int) *int

func MD5

func MD5(params string) string

func MapStruct

func MapStruct(src map[string]interface{}, dest interface{})

func MergeFields added in v0.0.3

func MergeFields(dest interface{}, src interface{}, fields ...string) (err error)

按名字和类型合并(&a,b)b->a: field值取不为空的

func NewInternationalTelephoneValidator added in v0.0.30

func NewInternationalTelephoneValidator(field string) validation.Validator

func NotNullString

func NotNullString(s *string) string

func Nullable added in v0.0.4

func Nullable(s *string) *string

func RemoveRepByMap

func RemoveRepByMap(slc []string) []string

func SHA1

func SHA1(data string) string

func StringAddr

func StringAddr(s string) *string

func StringValue

func StringValue(s *string) string

func Struct2Map added in v0.0.15

func Struct2Map(src interface{}) map[string]interface{}

func SubString

func SubString(str string, begin, length int) string

func TimeAddr

func TimeAddr(t time.Time) *time.Time

func TimeValue

func TimeValue(t *time.Time) time.Time

func UUID

func UUID() string

func Unzip

func Unzip(zipFile string, destDir string) ([]string, error)

解压

func VariableName added in v0.0.3

func VariableName(str string) string

func ZipFiles

func ZipFiles(filename string, files []string, oldForm, newForm string) error

Types

type InternationalTelephone added in v0.0.30

type InternationalTelephone struct {
	validation.Match
	Key string
}

Tel check telephone struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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