util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrlRegex   = `https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`
	EmailRegex = `[a-z0-9_\.-]+\@[\da-z\.-]+\.[a-z\.]{2,6}`
)
View Source
const HourLayout = "2006-01-02 15:04"

Variables

This section is empty.

Functions

func BoolInt added in v0.0.25

func BoolInt(b bool) int

func BoolToString added in v0.1.1

func BoolToString(i bool) string

func ByteToString

func ByteToString(b []byte) string

func DataMasking

func DataMasking(data string) string

DataMasking Data Masking

func Duration

func Duration(invocation time.Time, name string)

func ExtractUUID

func ExtractUUID(path string) string

ExtractUUID extract path

func FirstToUpper added in v0.0.26

func FirstToUpper(str string) string

func GeneratePassword

func GeneratePassword(length int, containChars string) string

GeneratePassword containChars : "lowercase|uppercase|numbers|hyphen|underline|space|specials|brackets|no_similar"

func GetAvailablePort

func GetAvailablePort() int

GetAvailablePort returns a port at random

func GetFDCount

func GetFDCount() uint64

func GetLocalIP4

func GetLocalIP4() (ip string)

GetLocalIP4 gets local ip address.

func GetSocketCount

func GetSocketCount() uint64

func ImageToBase64 added in v0.0.25

func ImageToBase64(b []byte) string

ImageToBase64 image base64 encoding

func In added in v0.2.1

func In(s1 []string, check string) bool

func Inject added in v0.0.25

func Inject(target interface{}, data map[string]interface{})

func IsAnnually added in v0.0.25

func IsAnnually(check, last, now string) (bool, error)

func IsApartDay added in v0.0.25

func IsApartDay(check, last, now string, day int) (bool, error)

func IsDaily added in v0.0.25

func IsDaily(check, last, now string) (bool, error)

func IsIPv4

func IsIPv4(host string) bool

func IsMonthly added in v0.0.25

func IsMonthly(check, last, now string) (bool, error)

func IsUrl

func IsUrl(text string) bool

func IsWeekly added in v0.0.25

func IsWeekly(check, last, now string) (bool, error)

func Now added in v0.0.25

func Now() string

func Round

func Round(val float64, precision int) float64

func StringSliceDiff

func StringSliceDiff(s1, s2 []string) []string

func StringToBool added in v0.1.1

func StringToBool(i string) bool

func StringToByte

func StringToByte(s string) (b []byte)

func ToBase64 added in v0.0.25

func ToBase64(b []byte) string

ToBase64 base64 encoding

func UUID added in v0.2.1

func UUID() string

UUID generates a random ID for a message

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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