utils

package
v0.0.0-...-c4618b4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ISO8601TimeCompile = regexp.MustCompile(`^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\+\d{4}$`)
)

Functions

func Abs2

func Abs2(x int64) int64

Abs2 绝对值

func AddDaysHoursMinutes

func AddDaysHoursMinutes(dateStr string, days int, hours int, minutes int) string

AddDaysHoursMinutes add

func ChangeBjTimeToISO8601

func ChangeBjTimeToISO8601(value string) string

ChangeBjTimeToISO8601 date format 2006-01-02 15:04:05

func ChangeISO8601ToBjTime

func ChangeISO8601ToBjTime(value string) string

ChangeISO8601ToBjTime change to bj time

func ChangeInterfaceToIDArray

func ChangeInterfaceToIDArray(obj interface{}) []string

ChangeInterfaceToIDArray change interface to string array

func ChangeInterfaceToValueArray

func ChangeInterfaceToValueArray(obj interface{}) []string

ChangeInterfaceToValueArray change interface to string array

func ChangeObjectToMap

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

ChangeObjectToMap change object to map

func ChangeObjectToMapList

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

ChangeObjectToMapList change object to list map

func ChangeObjectToStringMap

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

ChangeObjectToStringMap change object to string map

func ChangeStringArrayToString

func ChangeStringArrayToString(strs []string) string

ChangeStringArrayToString change string array to string

func Contain

func Contain(arr []string, data string) bool

Contain Is arr has data

func Contains

func Contains(arr1 []interface{}, arr2 []interface{}) bool

Contains Is arr1 contain arr2

func CopyProperties

func CopyProperties(dst, src interface{}) (err error)

CopyProperties copy properties to dest

func Decode

func Decode(data []byte, to interface{}) error

Decode decode []byte to object

func EmailAddressValid

func EmailAddressValid(email *string) bool

EmailAddressValid 邮箱格式检查

func Encode

func Encode(data interface{}) ([]byte, error)

Encode encode object to []byte

func ExprAnyInclude

func ExprAnyInclude(isArray bool, value1 interface{}, value2 interface{}) bool

ExprAnyInclude expr any include

func ExprCompare

func ExprCompare(value1 interface{}, value2 interface{}) int

ExprCompare expr compare

func ExprInclude

func ExprInclude(isArray bool, value1 interface{}, value2 interface{}) bool

ExprInclude expr include

func ExprNull

func ExprNull(isArray bool, value1 interface{}) bool

ExprNull expr null

func FormatValue

func FormatValue(value string, valueType string) interface{}

FormatValue format value

func GetAsString

func GetAsString(v interface{}) string

GetAsString 类型转换

func GetFieldValue

func GetFieldValue(data map[string]interface{}, fieldKey string) interface{}

GetFieldValue get field value from data

func GetMapKeys

func GetMapKeys(data map[string]interface{}) []string

GetMapKeys get map keys

func HasEmoji

func HasEmoji(s string) bool

HasEmoji HasEmoji

func ISO8601FmtCheck

func ISO8601FmtCheck(fmt *string) bool

ISO8601FmtCheck 时间格式检查 fmt: 2022-04-22T05:42:17+0000

func Intersect

func Intersect(arr1 []interface{}, arr2 []interface{}) bool

Intersect arr1 and arr2 is intersect

func IntersectString

func IntersectString(arr1 []string, arr2 []string) bool

IntersectString arr1 and arr2 is intersect

func IsNil

func IsNil(i interface{}) bool

IsNil is nil

func IsNotNil

func IsNotNil(i interface{}) bool

IsNotNil is not nil

func MergeMap

func MergeMap(mObj ...map[string]interface{}) map[string]interface{}

MergeMap merge map

func RecursionGetValue

func RecursionGetValue(data interface{}, fields []string) interface{}

RecursionGetValue 递归获取值

func RemoveReplicaSliceString

func RemoveReplicaSliceString(slc []string) []string

RemoveReplicaSliceString slice(string类型)元素去重

func SliceInsert

func SliceInsert(s []interface{}, index int, value interface{}) []interface{}

SliceInsert 在Slice的指定位置插入元素

func SliceRemoveElement

func SliceRemoveElement(objs []string, obj string) []string

SliceRemoveElement remove

func String2Int

func String2Int(s *string) *int

String2Int string转int

func StringJoin

func StringJoin(arr []string) string

StringJoin string join

func StringJoins

func StringJoins(strs ...string) string

StringJoins string join

func Struct2Bytes

func Struct2Bytes(reqData interface{}) (*bytes.Buffer, error)

Struct2Bytes 结构体转换为字节

func Strval

func Strval(value interface{}) string

Strval change to string

func StrvalAndType

func StrvalAndType(value interface{}) (string, string)

StrvalAndType change to string and return type

func UnicodeEmojiCode

func UnicodeEmojiCode(s string) string

UnicodeEmojiCode encode

func UnicodeEmojiDecode

func UnicodeEmojiDecode(s string) string

UnicodeEmojiDecode decode

Types

This section is empty.

Jump to

Keyboard shortcuts

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