Documentation ¶
Index ¶
- Constants
- Variables
- func Abs(num int) int
- func AbsF(num float64) float64
- func Add(num1, num2 int) int
- func AddF(num1, num2 float64) float64
- func AddStruct(structInstance interface{}, fields map[string]interface{}) interface{}
- func AppendFile(path string, data []string) error
- func AreaCircle(radius int) float64
- func AreaCircleF(radius float64) float64
- func AreaCone(radius, height int) float64
- func AreaConeF(radius, height float64) float64
- func AreaCube(side int) int
- func AreaCubeF(side float64) float64
- func AreaCylinder(radius, height int) float64
- func AreaCylinderF(radius, height float64) float64
- func AreaEllipse(major, minor int) float64
- func AreaEllipseF(major, minor float64) float64
- func AreaParallelogram(base, height int) int
- func AreaParallelogramF(base, height float64) float64
- func AreaPolygon(lenSide float64, numSide int) float64
- func AreaRect(length, width int) int
- func AreaRectF(length, width float64) float64
- func AreaRhombus(diag1, diag2 int) int
- func AreaRhombusF(diag1, diag2 float64) float64
- func AreaSphere(radius int) float64
- func AreaSphereF(radius float64) float64
- func AreaSquare(side int) int
- func AreaSquareF(side float64) float64
- func AreaTrapezoid(base1, base2, height int) float64
- func AreaTrapezoidF(base1, base2, height float64) float64
- func AreaTriangle(base, height int) int
- func AreaTriangleF(base, height float64) float64
- func At(s string, index int) string
- func Banner(font IFontBannerType, s string)
- func BoolToString(data bool) string
- func BytesToString(data []byte) string
- func CamelCase(s string) string
- func Capitalize(sentence string) string
- func Cbrt(number int) int
- func CbrtF(number float64) float64
- func Ceil(num float64) int
- func CheckHref(url string) (bool, error)
- func CheckHrefStatusCode(url string) (int, error)
- func CheckPort(protocol, hostname string, port int) bool
- func Chunk[T comparable](array []T, size int) [][]T
- func Clamp(value int, min int, max int) int
- func CleanFile(path string) error
- func CloneStruct(structInstance interface{}) interface{}
- func Cls()
- func Cmd(defaultCmmand string, windowsCmmand ...string)
- func CodePoint(input string) []int
- func CodePointAt(s string, index int) int
- func Compact[T interface{}](arr []T) []T
- func Concat(s ...string) string
- func Confirm(label string) (bool, error)
- func ConnectMinio(ctx context.Context, conf MinioConf) (*minio.Client, error)
- func ConnectMongo(ctx context.Context, uri string) (*mongo.Client, error)
- func ConnectRedis(addr, pass string, dbNo ...int) *redis.Client
- func ConnectRedisUri(uri string) *redis.Client
- func CopyFile(oldPath, newPath string) error
- func Cos(angle int) float64
- func CosF(angle float64) float64
- func Count(s string, substr ...string) int
- func CreateBarChart(options *IBarChartOpts)
- func CreateCanvas(size int, hexColor string) (*image.RGBA, error)
- func CreateDir(dir string) error
- func CreateFile(path string) error
- func CreateLineChart(options *ILineChartOpts)
- func CreatePath(relativePath string) error
- func CreatePieChart(options *IPieChartOpts)
- func CurrentDir() (string, error)
- func CustomCase(s, sep string) string
- func DashDate(date ...interface{}) string
- func Day() int
- func DecodeData(input []byte) ([]byte, error)
- func DecodeHref(s string) string
- func DecryptFile(source string, password []byte)
- func DecryptPassword(password, receivedPassword string) error
- func DeferWrapper(mainFunc func() error, cleanupFunc func()) error
- func DetectError(err interface{}) string
- func DiagRect(length, width int) float64
- func DiagRectF(length, width float64) float64
- func Diff[T comparable](a, b []T) []T
- func DiffTime(t1, t2 time.Time) time.Duration
- func DiffTimeNow(startTime time.Time) time.Duration
- func Distance(speed, time float64) float64
- func Divide(num1, num2 int) int
- func DivideF(num1, num2 float64) float64
- func DotDate(date ...interface{}) string
- func Drop[T comparable](arr []T, n ...int) []T
- func EncodeData(input []byte) ([]byte, error)
- func EncodeHref(s string) string
- func EncryptFile(source string, password []byte)
- func EncryptPassword(password string) (string, error)
- func EndsWith(s string, substr string) bool
- func Equal[T comparable](a, b T) bool
- func Escape(s string) string
- func FIndex(s string, substr string) int
- func Factorial(num int) int
- func FilterBy[T comparable](arr []T, f func(T) bool) []T
- func FindBy[T comparable](arr []T, f func(T) bool) T
- func FirstUpperCase(s string) string
- func FloatToString(data float64) string
- func Floor(num float64) int
- func ForBy[T comparable](arr []T, f func(T))
- func FromCodePoint(codePoint ...int) string
- func FromCodePointAt(codePoint int) string
- func GetStruct(structInstance interface{}, fieldName string) interface{}
- func GetTagName(structInstance interface{}) []string
- func Go2Md(inputFilePath string, outputFilePath string)
- func HasEmptyInStruct(structInstance interface{}, fieldName string) bool
- func HasInStruct(structInstance interface{}, fieldName string) bool
- func HealthCheck()
- func Help(name string, options []*IHelpOptions)
- func HexToRGBA(hex string) (color.RGBA, error)
- func HierarchyDir(dir string) ([]string, error)
- func Hour() int
- func HrefConnectTime(url string) (float64, error)
- func HrefHeader(url string) (http.Header, error)
- func ISODate(date ...interface{}) string
- func InRange(value int, min int, max int) bool
- func Includes(s string, substr string) bool
- func IncludesArr[T comparable](array []T, value T) bool
- func IndexBy[T comparable](arr []T, f func(T) bool) int
- func IndexOfArr[T comparable](arr []T, value T) int
- func IndexSubStr(s, substr string) (int, int)
- func IntToString(data int) string
- func Intersect[T comparable](slices ...[]T) []T
- func IntervalFunc(fn func(), timeout int)
- func IsArray(v interface{}) bool
- func IsBool(v interface{}) bool
- func IsByte(v interface{}) bool
- func IsChannel(v interface{}) bool
- func IsComplex(v interface{}) bool
- func IsDigit[T byte | rune](char T) bool
- func IsEdu(emailStr string) (bool, error)
- func IsEmail(emailStr, customDomain string) (bool, error)
- func IsEmpty(v interface{}) bool
- func IsError(v interface{}) bool
- func IsEven(num int) bool
- func IsExistDir(dir string) (bool, error)
- func IsExistFile(path string) (bool, error)
- func IsFloat(v interface{}) bool
- func IsFunc(v interface{}) bool
- func IsGmail(emailStr string) (bool, error)
- func IsInt(v interface{}) bool
- func IsLetter[T byte | rune](char T) bool
- func IsLower[T byte | rune](char T) bool
- func IsMap(v interface{}) bool
- func IsMatchReg(regex, chain string) bool
- func IsNil(v interface{}) bool
- func IsNumber(v interface{}) bool
- func IsOdd(num int) bool
- func IsOutlook(emailStr string) (bool, error)
- func IsPassword(password string) (bool, error)
- func IsPerfectSquare(num int) bool
- func IsPhone(phone string) (bool, error)
- func IsPointer(v interface{}) bool
- func IsPrime(num int) bool
- func IsRune(v interface{}) bool
- func IsSlice(v interface{}) bool
- func IsString(v interface{}) bool
- func IsStruct(v interface{}) bool
- func IsUUID(input string) (bool, error)
- func IsUintptr(v interface{}) bool
- func IsUnInt(v interface{}) bool
- func IsUndefined(v interface{}) bool
- func IsUnsafePointer(v interface{}) bool
- func IsUpper[T byte | rune](char T) bool
- func IsUsername(username string) (bool, error)
- func IsYahoo(emailStr string) (bool, error)
- func IsZero(v interface{}) bool
- func Join(s []string, separator string) string
- func KebabCase(s string) string
- func KeyBy[T comparable](arr []T, f func(T) bool) int
- func LIndex(s string, substr string) int
- func LTrim(s string) string
- func Lines(s string) int
- func LoadBalancer(proxyPort string, backends []IBackend)
- func LockFunc(callback interface{}) interface{}
- func Log(number, base int) int
- func Log10(number int) int
- func Log10F(number float64) float64
- func Log2(number int) int
- func Log2F(number float64) float64
- func LogF(number, base float64) float64
- func LongDate(date ...interface{}) string
- func Lower[T byte | rune](char T) T
- func LowerFirst(s string) string
- func Lowers(s string) string
- func LsDir(dir string) ([]string, error)
- func MapAsString[T string | []string](data map[string]T) string
- func MapBy[T comparable, R comparable](arr []T, f func(T) R) []R
- func MatchIndexReg(regex, chain string) int
- func MatchReg(regex, chain string) []string
- func Max(nums ...int) int
- func MaxArr[...](arr []T) T
- func MaxF(nums ...float64) float64
- func Mean(nums ...int) int
- func MeanF(nums ...float64) float64
- func Merge[T comparable](arr ...[]T) []T
- func MergeStruct(structs ...interface{}) interface{}
- func Min(nums ...int) int
- func MinArr[...](arr []T) T
- func MinF(nums ...float64) float64
- func Minute() int
- func Month() int
- func MonthDate(date ...interface{}) string
- func Most[T comparable](arr []T) T
- func Multi(nums ...int) int
- func MultiF(nums ...float64) float64
- func NormalDate(date ...interface{}) string
- func OpenHref(url string)
- func OutputColor[T interface{}](color string, output T)
- func OutputError(output string, err string)
- func OutputSuccess(output string)
- func PNGToJPG(input, output string) error
- func PadEnd(s string, addAmount int, padChar byte) string
- func PadStart(s string, addAmount int, padChar byte) string
- func ParallelizeFunc(functions ...func())
- func PeriCircle(radius int) float64
- func PeriCircleF(radius float64) float64
- func PeriCube(side int) int
- func PeriCubeF(side float64) float64
- func PeriRect(length, width int) int
- func PeriRectF(length, width float64) float64
- func PeriSquare(side int) int
- func PeriSquareF(side float64) float64
- func PeriTriangle(side1, side2, side3 int) int
- func PeriTriangleF(side1, side2, side3 float64) float64
- func Pow(base, exp int) int
- func Pow2(base int) int
- func Pow2F(base float64) float64
- func Pow3(base int) int
- func Pow3F(base float64) float64
- func PowF(base, exp float64) float64
- func Print(args ...interface{})
- func PrintUsage(name string, options []*IHelpOptions)
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func Profile(cpuprofile, memprofile string)
- func Proxy(port string, urls []string)
- func Pytago(side1, side2 int) float64
- func PytagoF(side1, side2 float64) float64
- func RTrim(s string) string
- func RWLockFunc(callback interface{}) interface{}
- func RandDigit(n int) string
- func RandID() string
- func RandNum(min, max int) int
- func RandStr(n int) string
- func ReadFileByLine(path string) ([]string, error)
- func ReadFileObj[T any](path string) ([]T, error)
- func ReadJSON[T any](path string, configuration *T) error
- func ReadPath(relativePath string) ([]byte, error)
- func ReadRequest(ctxBind func() error, ctxReq func() context.Context, req interface{}) error
- func ReadTOML[T any](path string, configuration *T) error
- func ReadYAML[T any](path string, configuration *T) error
- func RejectBy[T comparable](arr []T, f func(T) bool) []T
- func RemainFunc(fn func(), attempts int)
- func Remainder(num1, num2 int) int
- func RemoveDir(dir string) error
- func RemoveFile(path string) error
- func RemoveStruct(structInstance interface{}, fields ...string) interface{}
- func RenameFile(oldPath, newPath string) error
- func Repeat(s string, count int) string
- func Replace(s string, old string, new string) string
- func RetryFunc(fn func() error, attempts int, sleep int) (err error)
- func Reverse(s string) string
- func ReverseDate(date ...interface{}) string
- func Root(number, n int) int
- func RootF(number, n float64) float64
- func RotateLog(output string, maxFileSize ...int64)
- func Round(num float64) int
- func RunJob(duration, stopAfter uint64, callback func())
- func RunTimeFunc(startTime time.Time, task func()) time.Duration
- func RuneToString(data rune) string
- func ScanPort(protocol, hostname string, start, end int)
- func Second() int
- func Select(label string, options []string) (string, error)
- func SetCtx(ctx context.Context)
- func SetStruct(structInstance interface{}, fieldName string, value interface{})
- func Sin(angle int) float64
- func SinF(angle float64) float64
- func SleepHour(hour int)
- func SleepMinute(minute int)
- func SleepSecond(second int)
- func Slice(s string, index ...int) string
- func SnakeCase(s string) string
- func SpaceCase(s string) string
- func SpaceDate(date ...interface{}) string
- func Speed(distance, time float64) float64
- func Splice(s string, start, replaceCount int, items ...string) string
- func Split(s string, separator string) []string
- func Sprint(args ...interface{}) string
- func Sprintf(format string, args ...interface{}) string
- func Sprintln(args ...interface{}) string
- func Sqrt(number int) int
- func SqrtF(number float64) float64
- func Starter()
- func StartsWith(s string, substr string) bool
- func StringToBool(data string) bool
- func StringToBytes(data string) []byte
- func StringToFloat(data string) float64
- func StringToInt(data string) int
- func StringsToBytes(data []string) []byte
- func StructToMap(data interface{}) map[string]interface{}
- func StructToString(data interface{}) string
- func Sub(num1, num2 int) int
- func SubF(num1, num2 float64) float64
- func SubStr(s string, start int, length ...int) string
- func Sum(nums ...int) int
- func SumArr[...](arr []T) T
- func SumF(nums ...float64) float64
- func Tan(angle int) float64
- func TanF(angle float64) float64
- func TerminalClock()
- func Time(distance, speed float64) float64
- func ToHour(hour int) time.Duration
- func ToMinute(minute int) time.Duration
- func ToSecond(second int) time.Duration
- func ToString(data interface{}) string
- func Trim(s string) string
- func TrimBlank(s string) string
- func TrimPrefix(s, prefix string) string
- func TrimSuffix(s, suffix string) string
- func Truncate(s string, length int, omission ...string) string
- func TruncateFile(path string, size int64) error
- func UTCDate(date ...interface{}) string
- func UUID() string
- func UnderlineDate(date ...interface{}) string
- func Unescape(s string) string
- func Unix() int64
- func UnixMicro() int64
- func UnixMicroToTime(micro int64) time.Time
- func UnixMilli() int64
- func UnixMilliToTime(milli int64) time.Time
- func UnixNano() int64
- func UnixNanoToTime(nano int64) time.Time
- func Unzip(zipFile, destFolder string) error
- func Upper[T byte | rune](char T) T
- func UpperFirst(s string) string
- func Uppers(s string) string
- func VolCone(radius, height int) float64
- func VolConeF(radius, height float64) float64
- func VolCube(side int) int
- func VolCubeF(side float64) float64
- func VolCylinder(radius, height int) float64
- func VolCylinderF(radius, height float64) float64
- func VolRect(length, width, height int) int
- func VolRectF(length, width, height float64) float64
- func VolSphere(radius int) float64
- func VolSphereF(radius float64) float64
- func Weekday() int
- func Words(s string) []string
- func WriteAccessLog(msg string)
- func WriteErrorLog(msg string, err interface{})
- func WriteFile(path string, data []string) error
- func WriteFileObj[T any](path string, data T) error
- func WriteInfoLog(msg string)
- func WriteLog(prefix, msg, filePath string, err ...interface{})
- func WriteLogDefault(logID, logMessage, output string)
- func WritePath(relativePath string, content []byte) error
- func Year() int
- func Zip(zipFileName string, files []string) error
- type Ctx
- type DelayedResult
- type FileInfoStruct
- type Function
- type IBackend
- type IBarChartItem
- type IBarChartOpts
- type ICPU
- type ICronJob
- type IDisk
- type IFontBannerType
- type IGracefulShutdown
- type IHelpActionBool
- type IHelpActionInt
- type IHelpActionStr
- type IHelpOptions
- type ILbConfig
- type ILineChartItem
- type ILineChartOpts
- type ILocalCache
- type ILog
- type IPieChartItem
- type IPieChartOpts
- type ISystem
- type ITest
- type ITmpCache
- type MinioConf
- type PgDB
Constants ¶
View Source
const ( INFO_LOG_PREFIX string = "[INFO]" ERROR_LOG_PREFIX string = "[ERROR]" ACCESS_LOG_PREFIX string = "[ACCESS]" )
View Source
const ( CHAIN_STR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}[]|:<>?/.,';][=-`~" CHAIN_NUM = "0123456789" )
View Source
const ( ERROR_LOG_PATH = "logs/error.log" INFO_LOG_PATH = "logs/info.log" ACCESS_LOG_PATH = "logs/access.log" )
View Source
const ( DESC_TEST = "Expected %v but it got %v" DESC_CONSOLE = "Unsupported action type" )
View Source
const ( // These maybe not supported by all terminals DEFAULT_CONSOLE string = "\033[0m" RED_CONSOLE string = "\033[31m" GREEN_CONSOLE string = "\033[32m" YELLOW_CONSOLE string = "\033[33m" PURPLE_CONSOLE string = "\033[34m" PINK_CONSOLE string = "\033[35m" CYAN_CONSOLE string = "\033[36m" WHITE_CONSOLE string = "\033[97m" ORANGE_CONSOLE string = "\033[38;5;208m" BLUE_CONSOLE string = "\033[38;5;27m" MAGENTA_CONSOLE string = "\033[38;5;13m" GRAY_CONSOLE string = "\033[37m" )
View Source
const ( PasswordLenReg = `^.{8,32}$` PasswordLowerReg = `[a-z]` PasswordUpperReg = `[A-Z]` PasswordDigitReg = `\d` PasswordSpecialReg = `[!@#$%^&*]` )
View Source
const ( DESC_CREATE_FAILED string = "create failed" DESC_GET_FAILED string = "get failed" DESC_UPDATE_FAILED string = "update failed" DESC_DELETE_FAILED string = "delete failed" DESC_CREATE_SUCCESS string = "create successfully" DESC_GET_SUCCESS string = "get successfully" DESC_UPDATE_SUCCESS string = "update successfully" DESC_DELETE_SUCCESS string = "delete successfully" DESC_NOT_FOUND_DATA string = "not found data" DESC_EMPTY_DATA string = "empty data" DESC_INVALID_DATA string = "invalid data" )
View Source
const ( // basic symbols SCOPE_SYM string = " ⦿ " INPUT_SYM string = " » " AGAIN_SYM string = " ↺ " EXIT_SYM string = " ↵ " INFO_SYM string = " ⚠ " QUESTION_SYM string = " ? " SPAN_HOR_SYM string = " ↔ " SPAN_VER_SYM string = " ↕ " MORE_SYM string = " ... " OK_SYM string = " ✔ " NO_SYM string = " ✘ " CROSS_SYM string = " ✖ " ITEM_SYM string = " ➤ " COPYRIGHT_SYM string = " © " TRADEMARK_SYM string = " ™ " REGISTER_SYM string = " ® " AT_SYM string = " @ " NUMERO_SYM string = " № " )
View Source
const ( // arrow symbols TO_RIGHT_CON string = " → " TO_LEFT_SYM string = " ← " TO_UP_SYM string = " ↑ " TO_DOWN_SYM string = " ↓ " ARROW3_SYM string = " ⇨ " ARROW4_SYM string = " ⇾ " ARROW5_SYM string = " ⇛ " ARROW6_SYM string = " ⇝ " ARROW7_SYM string = " ⇢ " ARROW8_SYM string = " ⇥ " LEFT_SYM string = " ◀ " RIGHT_SYM string = " ▶ " UP_SYM string = " ▲ " DOWN_SYM string = " ▼ " )
View Source
const ( // math symbols PLUS_SYM string = " + " MINUS_SYM string = " - " MULT_SYM string = " * " DIV_SYM string = " / " MOD_SYM string = " % " OR_SYM string = " | " AND_SYM string = " & " NOT_EQUAL_SYM2 string = " != " LESS_SYM string = " < " GREATER_SYM string = " > " LESS_EQUAL_SYM2 string = " <= " GREATER_EQUAL_SYM2 string = " >= " APPROX_EQUAL_SYM2 string = " ~= " ASSIGN_SYM string = " = " PLUS_ASSIGN_SYM string = " += " MINUS_ASSIGN_SYM string = " -= " MULT_ASSIGN_SYM string = " *= " DIV_ASSIGN_SYM string = " /= " SECTION_SYM string = " § " PI_SYM string = " π " INFINITY_SYM string = " ∞ " NOT_EQUAL_SYM string = " ≠ " LESS_EQUAL_SYM string = " ≤ " GREATER_EQUAL_SYM string = " ≥ " APPROX_EQUAL_SYM string = " ≈ " PLUSMINUS_SYM string = " ± " NOT_SYM string = " ¬ " NANO_SYM string = " n " MILLI_SYM string = " m " KILO_SYM string = " k " MEGA_SYM string = " M " GIGA_SYM string = " G " TERA_SYM string = " T " PICO_SYM string = " p " FEMTO_SYM string = " f " ATTO_SYM string = " a " ZEPTO_SYM string = " z " YOCTO_SYM string = " y " SQUARED_SYM string = " ² " CUBED_SYM string = " ³ " POWER_6_SYM string = " ⁶ " POWER_9_SYM string = " ⁹ " POWER_12_SYM string = " ¹² " SQUARE_ROOT_SYM string = " √ " CUBE_ROOT_SYM string = " ∛ " // set symbols EMPTY_SET_SYM string = " ∅ " SUBSET_SYM string = " ⊂ " SUBSET_EQUAL_SYM string = " ⊆ " SUPERSET_SYM string = " ⊃ " SUPERSET_EQUAL_SYM string = " ⊇ " INTERSECTION_SYM string = " ∩ " UNION_SYM string = " ∪ " // logic symbols EXISTS_SYM string = " ∃ " FORALL_SYM string = " ∀ " NOT_EXISTS_SYM string = " ∄ " NOT_FORALL_SYM string = " ∁ " IMPLIES_SYM string = " ⇒ " IMPLIES2_SYM string = " ⟹ " IMPLIES3_SYM string = " ⟼ " IMPLIES4_SYM string = " ⟾ " IMPLIES5_SYM string = " ⟺ " IMPLIES6_SYM string = " ⟸ " IMPLIES7_SYM string = " ⇔ " IMPLIES8_SYM string = " ⇎ " IMPLIES9_SYM string = " ⇏ " IMPLIES10_SYM string = " ⇍ " IMPLIES13_SYM string = " ⇐ " IMPLIES15_SYM string = " ⇌ " )
View Source
const ( // physics symbols OHM_SYM string = " Ω " ANGSTROM_SYM string = " Å " DEGREE_C_SYM string = " ℃ " DEGREE_F_SYM string = " ℉ " DEGREE_SYM string = " ° " DEGREE_K_SYM string = " K " DEGREE_R_SYM string = " °R " DEGREE_REAUMUR_SYM string = " °Ré " DEGREE_RANKINE_SYM string = " °Ra " DEGREE_NEWTON_SYM string = " °N " DEGREE_DELISLE_SYM string = " °De " DEGREE_ROMER_SYM string = " °Rø " DEGREE_GALILEO_SYM string = " °G " )
View Source
const ( // chemistry symbols DEGREE_BAUME_SYM string = " °Bé " DEGREE_TWADDELL_SYM string = " °Tw " )
View Source
const ( // greek symbols ALPHA_SYM string = " α " BETA_SYM string = " β " GAMMA_SYM string = " γ " DELTA_SYM string = " δ " EPSILON_SYM string = " ε " ZETA_SYM string = " ζ " ETA_SYM string = " η " THETA_SYM string = " θ " IOTA_SYM string = " ι " KAPPA_SYM string = " κ " LAMBDA_SYM string = " λ " MU_SYM string = " μ " NU_SYM string = " ν " XI_SYM string = " ξ " OMICRON_SYM string = " ο " PI_SYM2 string = " π " RHO_SYM string = " ρ " SIGMA_SYM string = " σ " TAU_SYM string = " τ " UPSILON_SYM string = " υ " PHI_SYM string = " φ " CHI_SYM string = " χ " PSI_SYM string = " ψ " OMEGA_SYM string = " ω " )
View Source
const ( // geometric symbols DOT_SYM string = " • " CIRCLE_SYM string = " ○ " SQUARE_SYM string = " ■ " TRIANGLE_SYM string = " △ " QUADRANGLE_SYM string = " □ " PENTAGON_SYM string = " ⬟ " HEXAGON_SYM string = " ⬡ " HEPTAGON_SYM string = " ⬢ " OCTAGON_SYM string = " ⬣ " ENNEAGON_SYM string = " ⬤ " DECAGON_SYM string = " ⬥ " HEXAGON2_SYM string = " ⬦ " HEPTAGON2_SYM string = " ⬧ " OCTAGON2_SYM string = " ⬨ " ENNEAGON2_SYM string = " ⬩ " DECAGON2_SYM string = " ⬪ " HEXAGON3_SYM string = " ⬫ " HEPTAGON3_SYM string = " ⬬ " OCTAGON3_SYM string = " ⬭ " ENNEAGON3_SYM string = " ⬮ " DECAGON3_SYM string = " ⬯ " HEXAGON4_SYM string = " ⬰ " HEPTAGON4_SYM string = " ⬱ " OCTAGON4_SYM string = " ⬲ " ENNEAGON4_SYM string = " ⬳ " DECAGON4_SYM string = " ⬴ " )
View Source
const ( // currency symbols POUND_SYM string = " £ " YEN_SYM string = " ¥ " EURO_SYM string = " € " CENT_SYM string = " ¢ " DOLLAR_SYM string = " $ " CURRENCY_SYM string = " ¤ " PERMILLE_SYM string = " ‰ " PERMYRIAD_SYM string = " ‱ " VIETNAM_SYM string = " ₫ " ROUBLE_SYM string = " ₽ " BAHT_SYM string = " ฿ " INDIAN_SYM string = " ₹ " RIAL_SYM string = " ﷼ " LIRA_SYM string = " ₤ " DRACHMA_SYM string = " ₯ " NAIRA_SYM string = " ₦ " PESETA_SYM string = " ₧ " RUPEE_SYM string = " ₨ " FRANC_SYM string = " ₣ " LEU_SYM string = " ₗ " AFGHANI_SYM string = " ؋ " )
View Source
const ( // card symbols CLUB_SYM string = " ♣ " DIAMOND_SYM string = " ♦ " HEART_SYM string = " ♥ " SPADE_SYM string = " ♠ " )
View Source
const ( // chess symbols WHITE_KING_SYM string = " ♔ " WHITE_QUEEN_SYM string = " ♕ " WHITE_ROOK_SYM string = " ♖ " WHITE_BISHOP_SYM string = " ♗ " WHITE_KNIGHT_SYM string = " ♘ " WHITE_PAWN_SYM string = " ♙ " BLACK_KING_SYM string = " ♚ " BLACK_QUEEN_SYM string = " ♛ " BLACK_ROOK_SYM string = " ♜ " BLACK_BISHOP_SYM string = " ♝ " BLACK_KNIGHT_SYM string = " ♞ " BLACK_PAWN_SYM string = " ♟ " )
View Source
const ( // weather symbols SUNNY_SYM string = " ☀ " CLOUDY_SYM string = " ☁ " RAIN_SYM string = " ☂ " SNOW_SYM string = " ☃ " THUNDERSTORM_SYM string = " ☇ " SUNNY_CLOUDY_SYM string = " ☼ " RAIN_CLOUDY_SYM string = " ☂☁ " SNOW_CLOUDY_SYM string = " ☃☁ " THUNDERSTORM_CLOUDY string = " ☇☁ " SUNNY_RAIN_SYM string = " ☀☂ " SUNNY_SNOW_SYM string = " ☀☃ " SUNNY_THUNDERSTORM_SYM string = " ☀☇ " CLOUDY_RAIN_SYM string = " ☁☂ " CLOUDY_SNOW_SYM string = " ☁☃ " CLOUDY_THUNDERSTORM string = " ☁☇ " RAIN_SNOW_SYM string = " ☂☃ " RAIN_THUNDERSTORM_SYM string = " ☂☇ " SNOW_THUNDERSTORM_SYM string = " ☃☇ " )
View Source
const ( // astrological symbols SUN_SYM string = " ☉ " MOON_SYM string = " ☽ " MERCURY_SYM string = " ☿ " VENUS_SYM string = " ♀ " EARTH_SYM string = " ⊕ " MARS_SYM string = " ♂ " JUPITER_SYM string = " ♃ " SATURN_SYM string = " ♄ " URANUS_SYM string = " ♅ " NEPTUNE_SYM string = " ♆ " PLUTO_SYM string = " ♇ " CONJUNCTION_SYM string = " ☌ " OPPOSITION_SYM string = " ☍ " SEXTILE_SYM string = " ⚹ " TRINE_SYM string = " ⚸ " ASC_NODE_SYM string = " ☊ " DESC_NODE_SYM string = " ☋ " BLACK_MOON_SYM string = " ☾ " )
View Source
const ( // religious symbols CHRISTIAN_SYM string = " ✝ " JEWISH_SYM string = " ✡ " ISLAMIC_SYM string = " ☪ " YIN_YANG_SYM string = " ☯ " )
View Source
const (
EmailLenReg = `^.{8,32}$`
)
View Source
const (
PhoneReg = `^\+\d{1,2}\s?\(\d{1,4}\)\s?\d{1,6}-\d{1,6}$`
)
View Source
const (
UsernameReg = `^[a-zA-Z0-9_]{3,20}$`
)
Variables ¶
View Source
var ( ErrorRequiredUuid error = errors.New("uuid is required") ErrorInvalidUuid error = errors.New("uuid is invalid") ErrorInvalidEmail error = errors.New("email is invalid") ErrorEmailLength error = errors.New("email must be between 8 and 32 characters long") ErrorInvalidUsername error = errors.New("username is invalid, must be between 3 and 20 characters long and only contains letters, numbers and underscore") ErrorInvalidPassword error = errors.New("password is invalid, must be between 8 and 32 characters long and contains at least one lowercase letter, one uppercase letter, one digit and one special character") ErrorPasswordLength error = errors.New("password must be between 8 and 32 characters long") ErrorPasswordEmptyLower error = errors.New("password must contain at least one lowercase letter") ErrorPasswordEmptyUpper error = errors.New("password must contain at least one uppercase letter") ErrorPasswordEmptyDigit error = errors.New("password must contain at least one digit") ErrorPasswordEmptySpecial error = errors.New("password must contain at least one special character") ErrorHashPassword error = errors.New("error when encrypt password") ErrorComparePassword error = errors.New("password not match") ErrorInvalidPhone error = errors.New("phone is invalid") )
View Source
var CtxBg = context.Background()
View Source
var DOUBLE_ALPHA = IFontBannerType{
`A`: {
`╔═╗`,
`╠═╣`,
`╩ ╩`,
},
`B`: {
`╔╗ `,
`╠╩╗`,
`╚═╝`,
},
`C`: {
`╔═╗`,
`║ `,
`╚═╝`,
},
`D`: {
`╦═╗`,
`║ ║`,
`╩═╝`,
},
`E`: {
`╔═╗`,
`║╣ `,
`╚═╝`,
},
`F`: {
`╔═╗`,
`║╣ `,
`╩ `,
},
`G`: {
`╔═╗`,
`║ ╦`,
`╚═╝`,
},
`H`: {
`╦ ╦`,
`╠═╣`,
`╩ ╩`,
},
`I`: {
` ╦ `,
` ║ `,
` ╩ `,
},
`J`: {
`╦═╦`,
` ║`,
` ═╝`,
},
`K`: {
`╦ ╦`,
`╠═╔╝`,
`╝ ╚`,
},
`L`: {
`╦ `,
`║ `,
`╩═╝`,
},
`M`: {
`╔╗╔╗`,
`║║║║`,
`╝╚╝╚`,
},
`N`: {
`╔╗╔`,
`║║║`,
`╝╚╝`,
},
`O`: {
`╔═╗`,
`║ ║`,
`╚═╝`,
},
`P`: {
`╔═╗`,
`╠═╝`,
`╩ `,
},
`Q`: {
`╔═╗`,
`║ ║`,
`╚═╚═`,
},
`R`: {
`╔═╗`,
`╠╔╝`,
`╝╚╝`,
},
`S`: {
`╔═╗`,
`╚═╗`,
`╚═╝`,
},
`T`: {
`╔╦╗`,
` ║ `,
` ╩ `,
},
`U`: {
`╦ ╦`,
`║ ║`,
`╚═╝`,
},
`V`: {
`╦ ╦`,
`╚╗ ╔╝`,
` ╚╔╝`,
},
`W`: {
`╦ ╦`,
`║║║`,
`╚╩╝`,
},
`X`: {
`╚╔╝`,
`╔╝╗`,
},
`Y`: {
`╦ ╦`,
`╚╔╝`,
` ╩ `,
},
`Z`: {
`╔═╗`,
`╔═╝`,
`╚═╝`,
},
`0`: {
`╔═╗`,
`║ ║`,
`╚═╝`,
},
`1`: {
` ╦ `,
` ║ `,
` ╩ `,
},
`2`: {
`╔═╗`,
`╔═╝`,
`╚══`,
},
`3`: {
`╔═╗`,
`╚═╗`,
`╚═╝`,
},
`4`: {
`╦ ╦`,
`╚═╣`,
` ╩`,
},
`5`: {
`╔═╗`,
`╚═╗`,
`╚═╝`,
},
`6`: {
`╔═╗`,
`╠═╗`,
`╚═╝`,
},
`7`: {
`╔═╗`,
` ═║`,
` ╩`,
},
`8`: {
`╔═╗`,
`╠═╣`,
`╚═╝`,
},
`9`: {
`╔═╗`,
`╚═╣`,
`╚═╝`,
},
}
Functions ¶
func AddStruct ¶
func AddStruct(structInstance interface{}, fields map[string]interface{}) interface{}
func AppendFile ¶
func AreaCircle ¶
func AreaCircleF ¶
func AreaCylinder ¶
func AreaCylinderF ¶
func AreaEllipse ¶
func AreaEllipseF ¶
func AreaParallelogram ¶
func AreaParallelogramF ¶
func AreaPolygon ¶
func AreaRhombus ¶
func AreaRhombusF ¶
func AreaSphere ¶
func AreaSphereF ¶
func AreaSquare ¶
func AreaSquareF ¶
func AreaTrapezoid ¶
func AreaTrapezoidF ¶
func AreaTriangle ¶
func AreaTriangleF ¶
func Banner ¶
func Banner(font IFontBannerType, s string)
func BoolToString ¶
func BytesToString ¶
func Capitalize ¶
func CheckHrefStatusCode ¶
func Chunk ¶
func Chunk[T comparable](array []T, size int) [][]T
func CloneStruct ¶
func CloneStruct(structInstance interface{}) interface{}
func CodePointAt ¶
func ConnectRedis ¶
func ConnectRedisUri ¶
func ConnectRedisUri(uri string) *redis.Client
func CreateBarChart ¶
func CreateBarChart(options *IBarChartOpts)
func CreateFile ¶
func CreateLineChart ¶
func CreateLineChart(options *ILineChartOpts)
func CreatePath ¶
func CreatePieChart ¶
func CreatePieChart(options *IPieChartOpts)
func CurrentDir ¶
func CustomCase ¶
func DecodeData ¶
func DecodeHref ¶
func DecryptFile ¶
func DecryptPassword ¶
func DeferWrapper ¶
func DetectError ¶
func DetectError(err interface{}) string
func Diff ¶
func Diff[T comparable](a, b []T) []T
func Drop ¶
func Drop[T comparable](arr []T, n ...int) []T
func EncodeData ¶
func EncodeHref ¶
func EncryptFile ¶
func EncryptPassword ¶
func Equal ¶
func Equal[T comparable](a, b T) bool
func FilterBy ¶
func FilterBy[T comparable](arr []T, f func(T) bool) []T
func FindBy ¶
func FindBy[T comparable](arr []T, f func(T) bool) T
func FirstUpperCase ¶
func FloatToString ¶
func ForBy ¶
func ForBy[T comparable](arr []T, f func(T))
func FromCodePoint ¶
func FromCodePointAt ¶
func GetTagName ¶
func GetTagName(structInstance interface{}) []string
func HasEmptyInStruct ¶
func HasInStruct ¶
func HealthCheck ¶
func HealthCheck()
func Help ¶
func Help(name string, options []*IHelpOptions)
func HierarchyDir ¶
func HrefConnectTime ¶
func IncludesArr ¶
func IncludesArr[T comparable](array []T, value T) bool
func IndexBy ¶
func IndexBy[T comparable](arr []T, f func(T) bool) int
func IndexOfArr ¶
func IndexOfArr[T comparable](arr []T, value T) int
func IndexSubStr ¶
func IntToString ¶
func Intersect ¶
func Intersect[T comparable](slices ...[]T) []T
func IntervalFunc ¶
func IntervalFunc(fn func(), timeout int)
func IsExistDir ¶
func IsExistFile ¶
func IsMatchReg ¶
func IsPassword ¶
func IsPerfectSquare ¶
func IsUndefined ¶
func IsUndefined(v interface{}) bool
func IsUnsafePointer ¶
func IsUnsafePointer(v interface{}) bool
func IsUsername ¶
func KeyBy ¶
func KeyBy[T comparable](arr []T, f func(T) bool) int
func LoadBalancer ¶
func LowerFirst ¶
func MapAsString ¶
MapAsString is not yet in example
func MapBy ¶
func MapBy[T comparable, R comparable](arr []T, f func(T) R) []R
func MatchIndexReg ¶
func Merge ¶
func Merge[T comparable](arr ...[]T) []T
func MergeStruct ¶
func MergeStruct(structs ...interface{}) interface{}
func Most ¶
func Most[T comparable](arr []T) T
func NormalDate ¶
func NormalDate(date ...interface{}) string
func OutputColor ¶
func OutputColor[T interface{}](color string, output T)
func OutputError ¶
func OutputSuccess ¶
func OutputSuccess(output string)
func ParallelizeFunc ¶
func ParallelizeFunc(functions ...func())
func PeriCircle ¶
func PeriCircleF ¶
func PeriSquare ¶
func PeriSquareF ¶
func PeriTriangle ¶
func PeriTriangleF ¶
func PrintUsage ¶
func PrintUsage(name string, options []*IHelpOptions)
func RWLockFunc ¶
func RWLockFunc(callback interface{}) interface{}
func ReadFileByLine ¶
func ReadFileObj ¶
func ReadRequest ¶
func RejectBy ¶
func RejectBy[T comparable](arr []T, f func(T) bool) []T
func RemainFunc ¶
func RemainFunc(fn func(), attempts int)
func RemoveFile ¶
func RemoveStruct ¶
func RemoveStruct(structInstance interface{}, fields ...string) interface{}
func RenameFile ¶
func ReverseDate ¶
func ReverseDate(date ...interface{}) string
func RuneToString ¶
func SleepMinute ¶
func SleepMinute(minute int)
func SleepSecond ¶
func SleepSecond(second int)
func StartsWith ¶
func StringToBool ¶
func StringToBytes ¶
func StringToFloat ¶
func StringToInt ¶
func StringsToBytes ¶
func StructToMap ¶
func StructToMap(data interface{}) map[string]interface{}
func StructToString ¶
func StructToString(data interface{}) string
func TerminalClock ¶
func TerminalClock()
func TrimPrefix ¶
func TrimSuffix ¶
func TruncateFile ¶
func UnderlineDate ¶
func UnderlineDate(date ...interface{}) string
func UnixMicroToTime ¶
func UnixMilliToTime ¶
func UnixNanoToTime ¶
func UpperFirst ¶
func VolCylinder ¶
func VolCylinderF ¶
func VolSphereF ¶
func WriteAccessLog ¶
func WriteAccessLog(msg string)
func WriteErrorLog ¶
func WriteErrorLog(msg string, err interface{})
func WriteFileObj ¶
func WriteInfoLog ¶
func WriteInfoLog(msg string)
func WriteLogDefault ¶
func WriteLogDefault(logID, logMessage, output string)
Types ¶
type DelayedResult ¶
func DelayF ¶
func DelayF[T any](f func() T, timeout int) DelayedResult[T]
func DelayFunc ¶
func DelayFunc(f func(), timeout int) DelayedResult[struct{}]
type FileInfoStruct ¶
type FileInfoStruct struct { Name string Size int64 Mode os.FileMode ModTime string IsDir bool Sys interface{} All os.FileInfo }
func FileInfo ¶
func FileInfo(path string) (*FileInfoStruct, error)
type Function ¶
func ExtractFunctions ¶
func (*Function) HighlightBody ¶
func (*Function) HighlightDesc ¶
func (*Function) HighlightImport ¶
func (*Function) HighlightName ¶
type IBackend ¶
type IBarChartItem ¶
type IBarChartOpts ¶
type IBarChartOpts struct { Output string Title string Subtitle string XAxis []string Items []IBarChartItem }
type ICronJob ¶
type ICronJob struct {
// contains filtered or unexported fields
}
func NewCronJob ¶
type IFontBannerType ¶
type IGracefulShutdown ¶
type IGracefulShutdown struct { Port string StartMsg string ShutdownMsg string SleepTimout time.Duration HeaderTimeout time.Duration }
func (*IGracefulShutdown) GracefulShutdown ¶
func (igs *IGracefulShutdown) GracefulShutdown()
type IHelpActionBool ¶
type IHelpActionBool struct {
Action func(bool)
}
type IHelpActionInt ¶
type IHelpActionInt struct {
Action func(int)
}
type IHelpActionStr ¶
type IHelpActionStr struct {
Action func(string)
}
type IHelpOptions ¶
type ILineChartItem ¶
type ILineChartOpts ¶
type ILineChartOpts struct { Output string Title string Subtitle string XAxis []string Items []ILineChartItem }
type ILocalCache ¶
func NewLocalCache ¶
func NewLocalCache() *ILocalCache
func (*ILocalCache) AllLocalCache ¶
func (c *ILocalCache) AllLocalCache() map[string]string
func (*ILocalCache) DelLocalCache ¶
func (c *ILocalCache) DelLocalCache(key string)
func (*ILocalCache) FlushLocalCache ¶
func (c *ILocalCache) FlushLocalCache()
func (*ILocalCache) GetLocalCache ¶
func (c *ILocalCache) GetLocalCache(key string) (string, error)
func (*ILocalCache) SetLocalCache ¶
func (c *ILocalCache) SetLocalCache(key, value string)
type IPieChartItem ¶
type IPieChartOpts ¶
type ISystem ¶
type ITmpCache ¶
func NewTmpCache ¶
func (*ITmpCache) AllTmpCache ¶
func (*ITmpCache) DelTmpCache ¶
func (*ITmpCache) FlushTmpCache ¶
func (c *ITmpCache) FlushTmpCache()
func (*ITmpCache) GetTmpCache ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.