utility

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 25 Imported by: 1

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 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 a string with the host and port * @param host string * @param port int * @return string *

func BannerTitle

func BannerTitle(name, version string, size int) string

* * BannerTitle return a string with the banner title * @param name string * @param version string * @param size int * @return string *

func BinarySearch

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

func Contains

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

* * Contains return true if the value is in the list * @param v interface{} * @param vals ...interface{} * @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 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 GetCodeVerify

func GetCodeVerify(length int) string

* * GetCodeVerify return a code verify * @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 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 NewId

func NewId() string

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

func Now

func Now() string

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

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 QuickSort

func QuickSort(arr []int) []int

func Quote

func Quote(val interface{}) any

* * QUote return a quoted value * @param val interface{} * @return any *

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 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 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

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