utility

package
v1.1.59 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 29 Imported by: 0

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 UPDATE = "UPDATE"
View Source
const VALUE_NOT_BOOL = "Value is not bolean"

Variables

This section is empty.

Functions

func Address

func Address(host string, port int) string

* * Address return the value in a string format * @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(c []string, v string) bool

* * Contains return true if the value is in the slice * @param pointer string * @return string *

func ContainsInt

func ContainsInt(c []int, v int) bool

* * ContainsInt return true if the value is in the slice * @param pointer string * @return string *

func DecryptMessage

func DecryptMessage(message 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 EncryptMessage

func EncryptMessage(message string) (string, error)

func ExtractMencion

func ExtractMencion(str string) []string

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

func FindIndex

func FindIndex(arr []string, valor string) int

* * FindIndex return the index of a value in a slice * @param arr []string * @param valor string * @return int *

func FromBase64

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

func GenKey(id string) string

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

func GeneratePortNumber

func GeneratePortNumber() int

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

func GetOTP

func GetOTP(length int) string

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

func GetPassword added in v1.1.42

func GetPassword(length int) string

* * GetOTP return a random number * @param length int * @return string *

func GoMod

func GoMod(atrib string) (string, error)

* * GoMod return the value in a string format * @param atrib string * @return string * @return error *

func HashSha256

func HashSha256(message string) string

func InInt

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

* * InInt return true if the value is in the slice * @param pointer string * @return string *

func InStr

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

* * InStr return true if the value is in the slice * @param pointer string * @return string *

func IsJsonBuild

func IsJsonBuild(str string) bool

* * IsJsonBuild return true if the string is a json * @param str string * @return bool *

func MinDistance

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

func More

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 v1.1.50

func NanoId(n int) string

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

func NewError added in v1.1.39

func NewError(message string) error

func NewErrorf added in v1.1.39

func NewErrorf(format string, args ...any) error

func NewId

func NewId() string

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

func Now

func Now() string

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

func NowTime

func NowTime() time.Time

* * NowTime * @return time.Time *

func OkOrNot

func OkOrNot(condition bool, ok interface{}, not interface{}) interface{}

* * OkOrNot return the value of the condition * @param condition bool * @param ok interface{} * @param not interface{} * @return interface{} *

func ParamQuote

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

* * ParamQuote return the value in a string format * @param str string * @param args ...any * @return string *

func Params

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

* * Params return the value in a string format * @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.1.7

func PasswordSha256(password string) string

func Pointer

func Pointer(collection string, id string) string

* * Pointer return a string with the format collection/id * @param collection string * @param id string * @return string *

func PrefixId added in v1.1.50

func PrefixId(prefix string) string

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

func PrintFunctionName added in v1.1.39

func PrintFunctionName() string

func QuickSort

func QuickSort(arr []int) []int

func Quote

func Quote(val interface{}) any

* * Quote return the value in a string format * @param val interface{} * @return any *

func ShortUUID added in v1.1.50

func ShortUUID() string

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

func SnowflakeID added in v1.1.50

func SnowflakeID() string

* * SnowflakeID return a new SnowflakeID * @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

func ToBase64(data string) string

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

func Traces added in v1.1.39

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

func ULID added in v1.1.50

func ULID() string

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

func UUID

func UUID() string

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

func UUIndex

func UUIndex(tag string) int64

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

func ValidCode

func ValidCode(val string, length int) 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 ValidNil

func ValidNil(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

Types

type Num

type Num float64

Jump to

Keyboard shortcuts

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