utility

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 34 Imported by: 7

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

func FromBase64(data string) string

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

func GenId

func GenId(id string) string

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

func GenIndex added in v1.0.7

func GenIndex() int64

* * GenIndex * @return int64 *

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

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

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 PrintFunctionName

func PrintFunctionName() string

func QuickSort

func QuickSort(arr []int) []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 Traces

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

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

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

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