util

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESBase64Decrypt

func AESBase64Decrypt(encrypted, key, iv string) (clear string, err error)

aes decryot decode base64 encoded, encrypted data

func AESBase64Encrypt

func AESBase64Encrypt(clear, key, iv string) (encryoted string, err error)

aes encryot with PKCS5Padding and return base64 encoded string

func ContainString added in v1.0.5

func ContainString(list []string, e string) bool

func Contains

func Contains(list interface{}, e interface{}) bool

check if element exists in list

func DiffDay

func DiffDay(a, b interface{}) int

func Difference

func Difference(arrs ...interface{}) (reflect.Value, bool)

Difference returns a slice of values that are only present in one of the input slices

[1, 2, 2, 4, 6] & [2, 4, 5] >> [1, 5, 6]

[1, 1, 3, 4, 5, 6] >> [1, 3, 4, 5, 6]

func Distinct

func Distinct(arr interface{}) (reflect.Value, bool)

Distinct returns the unique vals of a slice

[1, 1, 2, 3] >> [1, 2, 3]

func FieldSlice

func FieldSlice(s interface{}, field string) (reflect.Value, bool)

export slice from list by field

func FormatTime

func FormatTime(ts interface{}) string

func Generate

func Generate() string

generate IMEI

func GenerateSessionId added in v1.0.5

func GenerateSessionId(seed string) string

func HmacSha1 added in v1.0.5

func HmacSha1(input string, secretKey string) string

func Intersect

func Intersect(arrs ...interface{}) (reflect.Value, bool)

Intersect returns a slice of values that are present in all of the input slices

[1, 1, 3, 4, 5, 6] & [2, 3, 6] >> [3, 6]

[1, 1, 3, 4, 5, 6] >> [1, 3, 4, 5, 6]

func IntersectInt added in v1.0.5

func IntersectInt(oldIds, newIds []uint32) (excludedIds, keptIds, addedIds []uint32)

This method allows to compute the Intersect of two list.

input:

oldIds			:	a list of old ids
newIds			:	a list of new ids

return:

excludedIds		:	the ids which are in old ids but not in new ids
keptIds			:	the ids which are both in old ids and new ids
addedIds		:	the ids which are in new ids but not in old olds

func IntersectString added in v1.0.5

func IntersectString(oldIds, newIds []string) (excludedIds, keptIds, addedIds []string)

func IntersectUuid added in v1.0.5

func IntersectUuid(oldIds, newIds [][]byte) (excludedIds [][]byte, keptIds [][]byte, addedIds [][]byte)

This method allows to compute the Intersect of two list.

input:

oldIds			:	a list of old ids
newIds			:	a list of new ids

return:

excludedIds		:	the ids which are in old ids but not in new ids
keptIds			:	the ids which are both in old ids and new ids
addedIds		:	the ids which are in new ids but not in old olds

func Md5Hash added in v1.0.5

func Md5Hash(text string) string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS5Unpadding

func PKCS5Unpadding(origData []byte) []byte

func ParseTime

func ParseTime(timeStr interface{}) (t time.Time)

func SHA512 added in v1.0.5

func SHA512(text string) string

generate encrypted password

func SameDay

func SameDay(a, b interface{}) bool

func Sha1Encrypt added in v1.0.5

func Sha1Encrypt(str string) string

func StringHashToUint32 added in v1.0.5

func StringHashToUint32(s string) uint32

func Substract

func Substract(arrs ...interface{}) (reflect.Value, bool)

Substract returns a slice of values that are only present in one of the input slices

[1, 2, 2, 4, 6] & [2, 4, 5] >> [1, 6]

[1, 1, 3, 4, 5, 6] >> [1, 3, 4, 5, 6]

func Union

func Union(arrs ...interface{}) (reflect.Value, bool)

Union returns a slice that contains the unique values of all the input slices

[1, 2, 2, 4, 6] & [2, 4, 5] >> [1, 2, 4, 5, 6]

[1, 1, 3, 4, 5, 6] >> [1, 3, 4, 5, 6]

func Validate

func Validate(imei string) bool

validate IMEL

Types

This section is empty.

Jump to

Keyboard shortcuts

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