utility

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 36 Imported by: 4

Documentation

Index

Constants

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 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 DAY_SECOND = 60 * 60 * 24 * 1
View Source
const DELETE = "DELETE"
View Source
const FOUND = "Found"
View Source
const (
	HASH_COST = 5
)
View Source
const INSERT = "INSERT"
View Source
const NOT_FOUND = "Not found"
View Source
const QUEUE_STACK = "stack"
View Source
const ROWS = 30
View Source
const SELECt = "SELECT"
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 a string with the host and port * @param host string * @param port int * @return string *

func AppWait added in v0.1.18

func AppWait()

* * AppWait *

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

* * BinarySearch * @param arr []string, target string * @return 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)

* * DecryptoAES return a string with the value decrypted in aes * @param value string * @return string, error *

func Dijkstra

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

* * Dijkstra * @param graph [][]int, start int * @return []int *

func DivInt

func DivInt(a, b int64) int64

* * DivInt return the division of two numbers * @param a int64, b int64 * @return int64 *

func DivNum

func DivNum(a, b float64) float64

* * DivNum return the division of two numbers * @param a float64, b float64 * @return float64 *

func Encrypt

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

* * Encrypt return a string with the value encrypted in the crypto type * @param value string, cryptoType CryptoType * @return string, error *

func ExtractMencion

func ExtractMencion(str string) []string

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

func FromBase64

func FromBase64(data string) (string, error)

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

func FromBase64Raw added in v0.1.18

func FromBase64Raw(data string) string

* * FromBase64Raw * @param data string * @return string *

func GenId

func GenId(id string) string

* * GenId * @param id string * @return string *

func GenKey

func GenKey(id string) string

* * GenKey * @param id string * @return string *

func GeneratePortNumber

func GeneratePortNumber() int

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

func GetOTP

func GetOTP(length int) string

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

func GetPidByPort

func GetPidByPort(port int) int

* * GetPidByPort return the pid of a process by port * @param port int * @return int *

func GetRandom added in v0.1.1

func GetRandom(charset string, length int) string

* * GetRandom return a random string * @param charset string, length int * @return string *

func GetRandomString added in v0.1.1

func GetRandomString(length int) string

* * GetRandomString return a random string * @param length int * @return string *

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 Hash

func Hash(password string) (string, error)

* * Hash using bcrypt * @param password string * @return string, 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 Match

func Match(hashPassword, password string) bool

* * Match using bcrypt * @param hashPassword, password string * @return bool *

func Md5

func Md5(password string) string

* * Hash using md5 * @param password string * @return string *

func MinDistance

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

* * MinDistance * @param dist []int, visited []bool * @return 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 Now

func Now() string

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

func NowTime

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 PayloadDecoded

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

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

func PayloadEncoded

func PayloadEncoded(data et.Json) string

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

func QuickSort

func QuickSort(arr []int) []int

* * QuickSort * @param arr []int * @return []int *

func Quote

func Quote(val interface{}) any

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

func SerializeStruct

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

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

func SetQuotedChar

func SetQuotedChar(char string)

* * SetQuotedChar * @param char string *

func Sha256

func Sha256(password string) string

* * Hash using sha256 * @param password string * @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 ToBase64Raw added in v0.1.18

func ToBase64Raw(data string) string

* * ToBase64Raw * @param data string * @return string *

func UUID

func UUID() string

* * UUID * @return string *

func UUIndex

func UUIndex(tag string) int64

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

func Unquote

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

* * ValidEmail * @param val string * @return bool *

func ValidId

func ValidId(val string) bool

* * ValidId * @param val string * @return bool *

func ValidIn

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

* * ValidIn * @param val string, min int, in []string * @return bool *

func ValidInt

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

* * ValidInt * @param val int, notIn []int * @return bool *

func ValidKey

func ValidKey(val string) bool

* * ValidKey * @param val string * @return bool *

func ValidName

func ValidName(val string) bool

* * ValidName * @param val string * @return bool *

func ValidNum

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

* * ValidNum * @param val float64, notIn []float64 * @return bool *

func ValidPhone

func ValidPhone(val string) bool

* * ValidPhone * @param val string * @return bool *

func ValidStr

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

* * ValidStr * @param val string, min int, notIn []string * @return bool *

func ValidUUID

func ValidUUID(val string) bool

* * ValidUUID * @param val string * @return bool *

func ValidWord

func ValidWord(word string) bool

* * ValidWord * @param word string * @return bool *

func Validate added in v0.1.1

func Validate(expr, val string) bool

* * Validate * @param expr, value string * @return bool *

Types

type CryptoType

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

func GetCryptoType

func GetCryptoType(value string) CryptoType

* * GetCryptoType return a crypto type from a string * @param value string * @return CryptoType *

func (CryptoType) String

func (c CryptoType) String() string

* * String return string of crypto type * @return string *

type List added in v0.1.0

type List []interface{}

func NewList added in v0.1.0

func NewList() List

func (*List) Add added in v0.1.0

func (s *List) Add(val interface{})

func (*List) Contains added in v0.1.0

func (s *List) Contains(val interface{}) bool

func (*List) IndexOf added in v0.1.0

func (s *List) IndexOf(val interface{}) int

func (*List) Remove added in v0.1.0

func (s *List) Remove(val interface{})

func (*List) Size added in v0.1.0

func (s *List) Size() int

type Num

type Num float64

Jump to

Keyboard shortcuts

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