utility

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: MIT Imports: 36 Imported by: 3

Documentation

Index

Constants

View Source
const ACTIVE = "0"
View Source
const AFTER_DELETE = "AFTER_DELETE"
View Source
const AFTER_INSERT = "AFTER_INSERT"
View Source
const AFTER_STATE = "AFTER_STATE"
View Source
const AFTER_UPDATE = "AFTER_UPDATE"
View Source
const APPROVAL = "5"
View Source
const ARCHIVED = "1"
View Source
const BEFORE_DELETE = "BEFORE_DELETE"
View Source
const BEFORE_INSERT = "BEFORE_INSERT"
View Source
const BEFORE_STATE = "BEFORE_STATE"
View Source
const BEFORE_UPDATE = "BEFORE_UPDATE"
View Source
const CACHE_TIME = 60 * 60 * 24 * 1
View Source
const CANCELLED = "2"
View Source
const DAY_SECOND = 60 * 60 * 24 * 1
View Source
const DELETE = "DELETE"
View Source
const FOR_DELETE = "-2"
View Source
const FOUND = "Found"
View Source
const (
	HASH_COST = 5
)
View Source
const INSERT = "INSERT"
View Source
const IN_PROCESS = "3"
View Source
const NOT_FOUND = "Not found"
View Source
const OF_SYSTEM = "-1"
View Source
const PENDING_APPROVAL = "4"
View Source
const QUEUE_STACK = "stack"
View Source
const REFUSED = "6"
View Source
const ROWS = 30
View Source
const SELECt = "SELECT"
View Source
const STOP = "Stop"
View Source
const SYSID = "-1"
View Source
const UPDATE = "UPDATE"
View Source
const VALUE_NOT_BOOL = "Value is not bolean"

Variables

Functions

func Address

func Address(host string, port int) string

* * Address return a string with the host and port * @param host string * @param port int * @return string *

func BannerTitle

func BannerTitle(name string, size int) string

* * BannerTitle return the value in a string format * @param name string * @param size int * @return string *

func BinarySearch

func BinarySearch(arr []string, target string) int

func Contains

func Contains(v interface{}, vals ...any) bool

* * Contains return true if the value is in the list * @param v interface{} * @param vals ...any * @return bool *

func DecryptoAES

func DecryptoAES(value string) (string, error)

func Dijkstra

func Dijkstra(graph [][]int, start int) []int

func DivInt

func DivInt(a, b int64) int64

func DivNum

func DivNum(a, b float64) float64

func Encrypt

func Encrypt(value string, cryptoType CryptoType) (string, error)

func ExtractMencion

func ExtractMencion(str string) []string

* * ExtractMencion return the mentions in a string * @param str string * @return []string *

func FromBase64 added in v0.0.4

func FromBase64(data string) string

* * FromBase64 * @param data string * @return string *

func GenId

func GenId(id string) string

* * GenId return a new UUID * @param id string * @return string *

func GenKey added in v0.0.3

func GenKey(id string) string

* * GenKey return a new UUID * @param id string * @return string *

func GeneratePortNumber

func GeneratePortNumber() int

* * GeneratePortNumber return a random port number * @return int *

func GetOTP added in v0.0.4

func GetOTP(length int) string

* * GetOTP return a code verify * @param length int * @return string *

func GetPidByPort added in v1.0.3

func GetPidByPort(port int) int

func GoMod

func GoMod(atrib string) (string, error)

* * GoMod return the value of a go.mod attribute * @param atrib string * @return string * @return error *

func InInt

func InInt(val string, in []string) bool

* * InInt return true if the value is in the list * @param val string * @param in []string * @return bool *

func InStr

func InStr(val string, in []string) bool

* * InStr return true if the value is in the list * @param val string * @param in []string * @return bool *

func MinDistance

func MinDistance(dist []int, visited []bool) int

func More added in v0.0.3

func More(tag string, expiration time.Duration) int64

* * More return the next value of a serie * @param tag string * @return int *

func NanoId added in v0.0.9

func NanoId(n int) string

* * NanoId return a new NanoID * @return string *

func Now

func Now() string

* * Now return the current date * @return string *

func NowTime added in v0.0.4

func NowTime() time.Time

* * NowTime * @return time.Time *

func ParamQuote

func ParamQuote(str string, args ...any) string

* * ParamQuote return a string with the values replaced * @param str string * @param args ...any * @return string *

func Params

func Params(str string, args ...any) string

* * Params return a string with the values replaced * @param str string * @param args ...any * @return string *

func PasswordHash

func PasswordHash(password string) (string, error)

func PasswordMatch

func PasswordMatch(hashPassword string, password string) bool

func PasswordSha256 added in v1.0.1

func PasswordSha256(password string) string

func PayloadDecoded added in v0.0.4

func PayloadDecoded(token string) (et.Json, error)

* * PayloadDecoded * @param token string * @return et.Json *

func PayloadEncoded added in v0.0.4

func PayloadEncoded(data et.Json) string

* * PayloadEncoded * @param data et.Json * @return string *

func PrefixId added in v0.0.9

func PrefixId(prefix string) string

* * PrefixId return a new UUID with prefix * @param prefix string * @return string *

func PrintFunctionName added in v0.0.9

func PrintFunctionName() string

func QuickSort

func QuickSort(arr []int) []int

func Quote

func Quote(val interface{}) any

* * Quote * @param val interface{} * @return any *

func RecordId added in v1.0.1

func RecordId(tag, id string) string

* * RecordId return a new UUID * @param table string * @param id string * @return string *

func SerializeStruct added in v0.0.18

func SerializeStruct(s interface{}) ([]byte, error)

* * SerializeStruct * @param s interface{} * @return []byte * @return error *

func SetQuotedChar added in v0.0.9

func SetQuotedChar(char string)

* * SetQuotedChar * @param char string *

func SetSnowflakeNode added in v1.0.1

func SetSnowflakeNode(n int64)

* * SetSnowflakeNode * @param n int64 *

func Snowflake added in v1.0.1

func Snowflake() string

* * ShortUUID return a new ShortUUID * @return string *

func TimeDifference

func TimeDifference(dateInt, dateEnd any) time.Duration

* * TimeDifference return the difference between two dates * @param dateInt any * @param dateEnd any * @return time.Duration *

func ToBase64 added in v0.0.4

func ToBase64(data string) string

* * ToBase64 * @param data string * @return string *

func Traces added in v0.0.9

func Traces(kind, color string, err error) ([]string, error)

func ULID added in v0.0.9

func ULID() string

* * ULID return a new ULID * @return string *

func UUID

func UUID() string

* * UUID return a new UUID * @return string *

func UUIndex added in v0.0.3

func UUIndex(tag string) int64

* * UUIndex return the next value of a serie * @param tag string * @return int64 *

func Unquote added in v0.0.9

func Unquote(val interface{}) any

* * Unquote * @param val interface{} * @return any *

func ValidCode

func ValidCode(val string) bool

func ValidEmail

func ValidEmail(val string) bool

func ValidId

func ValidId(val string) bool

func ValidIn

func ValidIn(val string, min int, in []string) bool

func ValidInt

func ValidInt(val int, notIn []int) bool

func ValidKey

func ValidKey(val string) bool

func ValidName

func ValidName(val string) bool

func ValidNum

func ValidNum(val float64, notIn []float64) bool

func ValidPhone

func ValidPhone(val string) bool

func ValidStr

func ValidStr(val string, min int, notIn []string) bool

func ValidUUID

func ValidUUID(val string) bool

func ValidWord added in v1.0.3

func ValidWord(word string) bool

Types

type CryptoType

type CryptoType int
const (
	MD5 CryptoType = iota
	SHA1
	SHA256
	SHA512
	AES
)

func GetCryptoType

func GetCryptoType(value string) CryptoType

Type return a crypto type from a string

func (CryptoType) String

func (c CryptoType) String() string

String return string of crypto type

type Num

type Num float64

Jump to

Keyboard shortcuts

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