Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(num int) int
- func AbsF(num float64) float64
- func Add[T int | float64](num1, num2 T) T
- func AddStruct(structInstance any, fields map[string]any) any
- func AppendFile(path string, data []string) error
- func AreaCir[T int | float64](radius T) float64
- func AreaCone[T Number](radius, height T) float64
- func AreaCube[T int | float64](side T) T
- func AreaCyl[T Number](radius, height T) float64
- func AreaEllipse[T Number](major, minor T) float64
- func AreaParallelogram[T int | float64](base, height T) T
- func AreaPolygon(lenSide float64, numSide int) float64
- func AreaRect[T int | float64](length, width T) T
- func AreaRhombus[T int | float64](diag1, diag2 T) T
- func AreaSphere(radius int) float64
- func AreaSphereF(radius float64) float64
- func AreaSquare[T int | float64](side T) T
- func AreaTrapezoid[T Number](base1, base2, height T) float64
- func AreaTri[T int | float64](base, height T) T
- func At(s string, index int) string
- func Banner(font IFontDouble, s string)
- func BarChart(options *IBarChart)
- func Bool2Str(data bool) string
- func Bytes2Str(data []byte) string
- func CamelCase(s string) string
- func Capitalize(sentence string) string
- func Cbrt[T int | float64](number T) T
- func Ceil(num float64) int
- func CheckPort(protocol, hostname string, port int) bool
- func CheckUrl(url string) (bool, int, error)
- func Chunk[T comparable](array []T, size int) [][]T
- func Clamp(value, min, max int) int
- func CleanFile(path string) error
- func CloneStruct(structInstance any) any
- func Cls()
- func Cmd(defaultCmd string, windowsCmd ...string)
- func CodePoint(input string) []int
- func CodePointAt(s string, index int) int
- func Compact[T any](arr []T) []T
- func ComparePassword(password, receivedPassword string) error
- func ConTimeUrl(url string) (float64, error)
- func Concat(s ...string) string
- func Confirm(label string) (bool, error)
- func CopyFile(oldPath, newPath string) error
- func Cos(angle int) float64
- func CosF(angle float64) float64
- func Count(s string, substr ...string) int
- func CreateCanvas(size int, hexColor string) (*image.RGBA, error)
- func CreateDir(dir string) error
- func CreateFile(path string) error
- func CreatePath(relativePath string) error
- func CtxCancel() (context.Context, context.CancelFunc)
- func CurrentDir() (string, error)
- func CustomCase(s, sep string) string
- func DashDate(date ...any) string
- func Day() int
- func DecodeData(input []byte) ([]byte, error)
- func DecodeUrl(s string) string
- func DecryptFile(source string, password []byte)
- func DeferWrapper(mainFunc func() error, cleanupFunc func()) error
- func DetectErr(err any) string
- func DiagCube(side int) float64
- func DiagCubeF(side float64) float64
- func DiagRect[T int | float64](length, width T) T
- func DiagSquare[T Number](side T) 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 Div[T int | float64](num1, num2 T) T
- func DotDate(date ...any) string
- func Drop[T comparable](arr []T, n ...int) []T
- func EncodeData(input []byte) ([]byte, error)
- func EncodeUrl(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 Err(err any) error
- func ErrMsg(message string, err error) error
- func Esc(s string) string
- func Extract(zipFile, destFolder string) error
- func Factorial(num int) int
- func Fatal(msg error, err ...any)
- func Fill[T comparable](arr []T, value T, start, end int) []T
- func FilterBy[T comparable](arr []T, f func(T) bool) []T
- func FindBy[T comparable](arr []T, f func(T) bool) T
- func FirstIdx(s string, substr string) int
- func Flatten(input any) []any
- func Float2Str(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 GetCtx() context.Context
- func GetStruct(structInstance any, fieldName string) any
- func GetTags(structInstance any) []string
- func Go2Md(inputPath, outputPath string)
- func HasEmptyInStruct(structInstance any, fieldName string) bool
- func HasInStruct(structInstance any, fieldName string) bool
- func Header(w http.ResponseWriter, r *http.Request)
- func HeaderUrl(url string) (http.Header, error)
- func HealthCheck()
- func Help(name string, options []*IHelpOptions)
- func Hex2Hlsa(hex string) (float64, float64, float64, float64, error)
- func Hex2Rgba(hex string) (color.RGBA, error)
- func HierarchyDir(dir string) ([]string, error)
- func Hlsa2Rgba(h, l, s, a float64) color.RGBA
- func Hour() int
- func Hue2Rgb(p, q, t float64) float64
- func ISODate(date ...any) string
- func IdxSubStr(s, substr string) (int, int)
- func InRange(value, min, 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 Int2Str(data int) string
- func Intersect[T comparable](slices ...[]T) []T
- func IntervalFunc(fn func(), timeout int)
- func IsArray(v any) bool
- func IsBool(v any) bool
- func IsByte(v any) bool
- func IsChannel(v any) bool
- func IsComplex(v any) 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 any) bool
- func IsEqualArr[T comparable](a, b []T) bool
- func IsError(v any) bool
- func IsEven(num int) bool
- func IsExistDir(dir string) (bool, error)
- func IsExistFile(path string) (bool, error)
- func IsFloat(v any) bool
- func IsFunc(v any) bool
- func IsGmail(emailStr string) (bool, error)
- func IsInt(v any) bool
- func IsLetter[T byte | rune](char T) bool
- func IsLower[T byte | rune](char T) bool
- func IsMap(v any) bool
- func IsMatchReg(regex, chain string) bool
- func IsNil(v any) bool
- func IsNumber(v any) 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 any) bool
- func IsPrime(num int) bool
- func IsRune(v any) bool
- func IsSlice(v any) bool
- func IsString(v any) bool
- func IsStruct(v any) bool
- func IsUUID(input string) (bool, error)
- func IsUintptr(v any) bool
- func IsUnInt(v any) bool
- func IsUndefined(v any) bool
- func IsUnsafePointer(v any) bool
- func IsUpper[T byte | rune](char T) bool
- func IsUsername(username string) (bool, error)
- func IsYahoo(emailStr string) (bool, error)
- func IsZero(v any) 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 LPad(s string, addAmount int, padChar byte) string
- func LTrim(s string) string
- func LastIdx(s string, substr string) int
- func Least[T comparable](arr []T) T
- func LineChart(options *ILineChart)
- func Lines(s string) int
- func LoadBalancer(proxyPort string, backends []ILb)
- func LockFunc(callback any) any
- 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 ...any) 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 Map2Str[T string | []string](data map[string]T) string
- func MapBy[T comparable, R comparable](arr []T, f func(T) R) []R
- func MatchIdxReg(regex, chain string) int
- func MatchReg(regex, chain string) []string
- func Max[T int | float64](nums ...T) T
- func MaxArr[T Number | string](arr []T) T
- func Mean[T int | float64](nums ...T) T
- func Median[T int | float64](nums ...T) T
- func Merge[T comparable](arr ...[]T) []T
- func MergeStruct(structs ...any) any
- func Micro() int64
- func Micro2Time(micro int64) time.Time
- func Milli() int64
- func Milli2Time(milli int64) time.Time
- func Min[T int | float64](nums ...T) T
- func MinArr[T Number | string](arr []T) T
- func Minute() int
- func Mod(num1, num2 int) int
- func ModF(num1, num2 float64) float64
- func Mode[T int | float64](nums ...T) T
- func Mongo(ctx context.Context, uri string) (*mongo.Client, error)
- func Month() int
- func MonthDate(date ...any) string
- func Most[T comparable](arr []T) T
- func Multi[T int | float64](nums ...T) T
- func Nano() int64
- func Nano2Time(nano int64) time.Time
- func NormalDate(date ...any) string
- func OpenUrl(url string)
- func OutputColor[T any](color string, output T)
- func OutputError(output string, err string)
- func OutputSuccess(output string)
- func Panic(msg error, err ...any)
- func ParallelizeFunc(functions ...func())
- func PeriCir[T int | float64](radius T) float64
- func PeriCube[T int | float64](side T) T
- func PeriRect[T int | float64](length, width T) T
- func PeriSquare[T int | float64](side T) T
- func PeriTri[T int | float64](side1, side2, side3 T) T
- func PieChart(options *IPieChart)
- func Png2Jpg(input, output string) error
- func Pop[T comparable](arr []T, n ...int) []T
- func Pow[T int | float64](base, exp T) T
- func Pow2[T int | float64](base T) T
- func Pow2F(base float64) float64
- func Pow3(base int) int
- func Pow3F(base float64) float64
- func Print(args ...any)
- func PrintUsage(name string, options []*IHelpOptions)
- func Printf(format string, args ...any)
- func Println(args ...any)
- func Profile(cpuprofile, memprofile string)
- func Proxy(port string, urls []string)
- func Push[T comparable](arr []T, values ...T) []T
- func Pytago[T int | float64](side1, side2 T) T
- func RPad(s string, addAmount int, padChar byte) string
- func RTrim(s string) string
- func RWLockFunc(callback any) any
- 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 ReadTOML[T any](path string, configuration *T) error
- func ReadYAML[T any](path string, configuration *T) error
- func Redis(addr, pass string, dbNo ...int) *redis.Client
- func RedisCloud(uri string) *redis.Client
- func RejectBy[T comparable](arr []T, f func(T) bool) []T
- func RemainFunc(fn func(), attempts int)
- func RemoveDir(dir string) error
- func RemoveFile(path string) error
- 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 ReverseArr[T comparable](arr []T) []T
- func ReverseDate(date ...any) string
- func Rgba2Hlsa(r, g, b, a uint8) (float64, float64, float64, float64)
- func RmStruct(structInstance any, fields ...string) any
- func Root[T int | float64](number, n T) T
- 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 Rune2Str(data rune) string
- func ScanPort(protocol, hostname string, start, end int)
- func ScatterChart(options *IScatterChart)
- func Second() int
- func Select(label string, options []string) (string, error)
- func SetCtx(ctx context.Context)
- func SetStruct(structInstance any, fieldName string, value any)
- func Shift[T comparable](arr []T, n ...int) []T
- func Shuffle[T comparable](arr []T)
- func Sin(angle int) float64
- func SinF(angle float64) float64
- func SleepH(hour int)
- func SleepM(minute int)
- func SleepS(second int)
- func Slice(s string, index ...int) string
- func SliceArr[T comparable](arr []T, start, end int) ([]T, error)
- func SnakeCase(s string) string
- func Sort(input any) any
- func SortNum[T Number](nums []T) []T
- func SpaceCase(s string) string
- func SpaceDate(date ...any) string
- func Speed(distance, time float64) float64
- func Splice(s string, start, replaceCount int, items ...string) string
- func SpliceArr[T comparable](arr []T, start, deleteCount int, items ...T) []T
- func Split(s string, separator string) []string
- func Sprint(args ...any) string
- func Sprintf(format string, args ...any) string
- func Sprintln(args ...any) string
- func Sqrt[T int | float64](number T) T
- func Starter()
- func StartsWith(s string, substr string) bool
- func Str2Bool(data string) bool
- func Str2Bytes(data string) []byte
- func Str2Float(data string) float64
- func Str2Int(data string) int
- func Strs2Bytes(data []string) []byte
- func Struct2Map(data any) map[string]any
- func Struct2Str(data any) string
- func Sub[T int | float64](num1, num2 T) T
- func SubStr(s string, start int, length ...int) string
- func Sum[T int | float64](nums ...T) T
- func Take[T comparable](arr []T, n int) []T
- func Tan(angle int) float64
- func TanF(angle float64) float64
- func TerminalClock()
- func Time(distance, speed float64) float64
- func Time2Str(t time.Time) string
- func ToHour(hour int) time.Duration
- func ToMinute(minute int) time.Duration
- func ToSecond(second int) time.Duration
- func ToStr(data any) string
- func Trim(s string) string
- func TrimBlank(s string) string
- func TrimPre(s, prefix string) string
- func TrimSuf(s, suffix string) string
- func Truncate(s string, length int, omission ...string) string
- func TruncateFile(path string, size int64) error
- func UTCDate(date ...any) string
- func UUID() string
- func UnderlineDate(date ...any) string
- func Unesc(s string) string
- func UniqueArr[T comparable](arr []T) []T
- func Unix() int64
- func Unshift[T comparable](arr []T, values ...T) []T
- func UploadMulti(w http.ResponseWriter, r *http.Request, servePath, storePath string)
- func UploadSingle(w http.ResponseWriter, r *http.Request, servePath, storePath string)
- func Upper[T byte | rune](char T) T
- func UpperFirst(s string) string
- func Uppers(s string) string
- func Validate(ctxBind func() error, ctxReq func() context.Context, req any) error
- func VolCone[T Number](radius, height T) float64
- func VolCube(side int) int
- func VolCubeF(side float64) float64
- func VolCyl[T Number](radius, height T) float64
- func VolRect[T int | float64](length, width, height T) T
- 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 any)
- 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 ...any)
- func WriteLogDefault(logID, logMessage, output string)
- func WritePath(relativePath string, content []byte) error
- func Year() int
- func Zip(zipFileName string, files []string) error
- type DelayedResult
- type FileInfoStruct
- type Function
- type IBarChart
- type IBarChartItem
- type ICPU
- type ICron
- type IDisk
- type IFontDouble
- type IHeader
- type IHelpActionBool
- type IHelpActionInt
- type IHelpActionStr
- type IHelpOptions
- type IHost
- type IIo
- type ILCache
- type ILb
- type ILbConf
- type ILineChart
- type ILineChartItem
- type ILog
- type IMemory
- type IPartition
- type IPieChart
- type IPieChartItem
- type IScatterChart
- type IServer
- type ITCache
- type ITest
- type IUser
- type Number
- type Pagination
- func (p *Pagination) GetFirstPage() int
- func (p *Pagination) GetHasMore(totalCount int) bool
- func (p *Pagination) GetLastPage() int
- func (p *Pagination) GetNextPage() int
- func (p *Pagination) GetOffset() int
- func (p *Pagination) GetOrderBy() string
- func (p *Pagination) GetPage() int
- func (p *Pagination) GetPrevPage() int
- func (p *Pagination) GetQueryString() string
- func (p *Pagination) GetSize() int
- func (p *Pagination) GetTotalPages() int
- func (p *Pagination) SetOrderBy(orderByQuery string)
- func (p *Pagination) SetPage(pageQuery string) error
- func (p *Pagination) SetSize(sizeQuery string) error
- 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 ( // EmptyReg = `^$` // SpaceReg = `\s+` // WordNumReg = `^[a-zA-Z0-9]+$` UsernameReg = `^[a-zA-Z0-9_]{3,20}$` EmailLenReg = `^.{8,32}$` PhoneReg = `^\+\d{1,2}\s?\(\d{1,4}\)\s?\d{1,6}-\d{1,6}$` 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 DefaultPageSize = 10
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 = IFontDouble{
`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 AppendFile ¶
func AreaEllipse ¶
func AreaParallelogram ¶
func AreaPolygon ¶
func AreaRhombus ¶
func AreaSphere ¶
func AreaSphereF ¶
func AreaSquare ¶
func AreaTrapezoid ¶
func Banner ¶
func Banner(font IFontDouble, s string)
func Capitalize ¶
func Chunk ¶
func Chunk[T comparable](array []T, size int) [][]T
func CloneStruct ¶
func CodePointAt ¶
func ComparePassword ¶ added in v1.1.0
func ConTimeUrl ¶ added in v1.1.0
func CreateFile ¶
func CreatePath ¶
func CurrentDir ¶
func CustomCase ¶
func DecodeData ¶
func DecryptFile ¶
func DeferWrapper ¶
func DiagSquare ¶ added in v1.1.0
func Diff ¶
func Diff[T comparable](a, b []T) []T
func Drop ¶
func Drop[T comparable](arr []T, n ...int) []T
func EncodeData ¶
func EncryptFile ¶
func EncryptPassword ¶
func Equal ¶
func Equal[T comparable](a, b []T) bool
func Fill ¶ added in v1.1.0
func Fill[T comparable](arr []T, value T, start, end int) []T
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 ForBy ¶
func ForBy[T comparable](arr []T, f func(T))
func FromCodePoint ¶
func FromCodePointAt ¶
func HasEmptyInStruct ¶
func HasInStruct ¶
func HealthCheck ¶
func HealthCheck()
func Help ¶
func Help(name string, options []*IHelpOptions)
func HierarchyDir ¶
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 Intersect ¶
func Intersect[T comparable](slices ...[]T) []T
func IntervalFunc ¶
func IntervalFunc(fn func(), timeout int)
func IsEqualArr ¶ added in v1.1.0
func IsEqualArr[T comparable](a, b []T) bool
func IsExistDir ¶
func IsExistFile ¶
func IsMatchReg ¶
func IsPassword ¶
func IsPerfectSquare ¶
func IsUndefined ¶
func IsUnsafePointer ¶
func IsUsername ¶
func KeyBy ¶
func KeyBy[T comparable](arr []T, f func(T) bool) int
func Least ¶ added in v1.1.0
func Least[T comparable](arr []T) T
func LineChart ¶ added in v1.1.0
func LineChart(options *ILineChart)
func LoadBalancer ¶
func LowerFirst ¶
func MapBy ¶
func MapBy[T comparable, R comparable](arr []T, f func(T) R) []R
func MatchIdxReg ¶ added in v1.1.0
func Merge ¶
func Merge[T comparable](arr ...[]T) []T
func MergeStruct ¶
func Micro2Time ¶ added in v1.1.0
func Milli2Time ¶ added in v1.1.0
func Most ¶
func Most[T comparable](arr []T) T
func NormalDate ¶
func OutputColor ¶
func OutputError ¶
func OutputSuccess ¶
func OutputSuccess(output string)
func ParallelizeFunc ¶
func ParallelizeFunc(functions ...func())
func PeriSquare ¶
func Pop ¶ added in v1.1.0
func Pop[T comparable](arr []T, n ...int) []T
func PrintUsage ¶
func PrintUsage(name string, options []*IHelpOptions)
func Push ¶ added in v1.1.0
func Push[T comparable](arr []T, values ...T) []T
func RWLockFunc ¶
func ReadFileByLine ¶
func ReadFileObj ¶
func RedisCloud ¶ added in v1.1.0
func RedisCloud(uri string) *redis.Client
func RejectBy ¶
func RejectBy[T comparable](arr []T, f func(T) bool) []T
func RemainFunc ¶
func RemainFunc(fn func(), attempts int)
func RemoveFile ¶
func RenameFile ¶
func ReverseArr ¶ added in v1.1.0
func ReverseArr[T comparable](arr []T) []T
func ReverseDate ¶
func ScatterChart ¶ added in v1.1.0
func ScatterChart(options *IScatterChart)
func Shift ¶ added in v1.1.0
func Shift[T comparable](arr []T, n ...int) []T
func Shuffle ¶ added in v1.1.0
func Shuffle[T comparable](arr []T)
func SliceArr ¶ added in v1.1.0
func SliceArr[T comparable](arr []T, start, end int) ([]T, error)
func SpliceArr ¶ added in v1.1.0
func SpliceArr[T comparable](arr []T, start, deleteCount int, items ...T) []T
func StartsWith ¶
func Strs2Bytes ¶ added in v1.1.0
func Struct2Map ¶ added in v1.1.0
func Struct2Str ¶ added in v1.1.0
func Take ¶ added in v1.1.0
func Take[T comparable](arr []T, n int) []T
func TerminalClock ¶
func TerminalClock()
func TruncateFile ¶
func UnderlineDate ¶
func UniqueArr ¶ added in v1.1.0
func UniqueArr[T comparable](arr []T) []T
func Unshift ¶ added in v1.1.0
func Unshift[T comparable](arr []T, values ...T) []T
func UploadMulti ¶ added in v1.1.0
func UploadMulti(w http.ResponseWriter, r *http.Request, servePath, storePath string)
func UploadSingle ¶ added in v1.1.0
func UploadSingle(w http.ResponseWriter, r *http.Request, servePath, storePath string)
func UpperFirst ¶
func VolSphereF ¶
func WriteAccessLog ¶
func WriteAccessLog(msg string)
func WriteErrorLog ¶
func WriteFileObj ¶
func WriteInfoLog ¶
func WriteInfoLog(msg string)
func WriteLogDefault ¶
func WriteLogDefault(logID, logMessage, output string)
Types ¶
type DelayedResult ¶
Delay
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 any 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 IBarChart ¶ added in v1.1.0
type IBarChart struct { Output string Title string Subtitle string XAxis []string Items []IBarChartItem }
type IBarChartItem ¶
type ICPU ¶
type ICron ¶ added in v1.1.0
type ICron struct {
// contains filtered or unexported fields
}
type IDisk ¶
type IFontDouble ¶ added in v1.1.0
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 IHost ¶ added in v1.1.0
type IIo ¶ added in v1.1.0
type ILCache ¶ added in v1.1.0
func (*ILCache) FlushLCache ¶ added in v1.1.0
func (c *ILCache) FlushLCache()
type ILineChart ¶ added in v1.1.0
type ILineChart struct { Output string Title string Subtitle string XAxis []string Items []ILineChartItem }
type ILineChartItem ¶
type IMemory ¶ added in v1.1.0
type IMemory struct { VirtualTotal uint64 VirtualAvailable uint64 VirtualUsed uint64 VirtualUsedPercent float64 VirtualFree uint64 VirtualActive uint64 VirtualInactive uint64 VirtualWired uint64 VirtualLaundry uint64 VirtualBuffers uint64 VirtualCached uint64 VirtualWriteBack uint64 VirtualDirty uint64 VirtualWriteBackTmp uint64 VirtualSlab uint64 VirtualSreclaimable uint64 VirtualSunreclaim uint64 VirtualPageTables uint64 VirtualSwapCached uint64 VirtualCommitLimit uint64 VirtualCommittedAS uint64 VirtualHighTotal uint64 VirtualHighFree uint64 VirtualLowTotal uint64 VirtualLowFree uint64 VirtualMapped uint64 VirtualMallocTotal uint64 VirtualMallocUsed uint64 VirtualMallocChunk uint64 VirtualHugePagesTotal uint64 VirtualHugePagesFree uint64 VirtualHugePagesRsvd uint64 VirtualHugePagesSurp uint64 VirtualHugePageSize uint64 VirtualAnonHugePages uint64 SwapTotal uint64 SwapUsed uint64 SwapFree uint64 SwapUsedPercent float64 SwapSin uint64 SwapSout uint64 SwapPgIn uint64 SwapPgOut uint64 SwapPgFault uint64 SwapPgMajFault uint64 }
type IPartition ¶ added in v1.1.0
func Partition ¶ added in v1.1.0
func Partition() ([]*IPartition, error)
type IPieChartItem ¶
type IScatterChart ¶ added in v1.1.0
type IServer ¶ added in v1.1.0
type ITCache ¶ added in v1.1.0
func (*ITCache) FlushTCache ¶ added in v1.1.0
func (c *ITCache) FlushTCache()
type Pagination ¶ added in v1.1.0
type Pagination struct { Size int // Items per page Page int // Current page OrderBy string // Sorting order (e.g., "asc", "desc") Total int // Total number of items available }
func NewPagination ¶ added in v1.1.0
func NewPagination(size, page int) *Pagination
func (*Pagination) GetFirstPage ¶ added in v1.1.0
func (p *Pagination) GetFirstPage() int
func (*Pagination) GetHasMore ¶ added in v1.1.0
func (p *Pagination) GetHasMore(totalCount int) bool
func (*Pagination) GetLastPage ¶ added in v1.1.0
func (p *Pagination) GetLastPage() int
func (*Pagination) GetNextPage ¶ added in v1.1.0
func (p *Pagination) GetNextPage() int
func (*Pagination) GetOffset ¶ added in v1.1.0
func (p *Pagination) GetOffset() int
func (*Pagination) GetOrderBy ¶ added in v1.1.0
func (p *Pagination) GetOrderBy() string
func (*Pagination) GetPage ¶ added in v1.1.0
func (p *Pagination) GetPage() int
func (*Pagination) GetPrevPage ¶ added in v1.1.0
func (p *Pagination) GetPrevPage() int
func (*Pagination) GetQueryString ¶ added in v1.1.0
func (p *Pagination) GetQueryString() string
func (*Pagination) GetSize ¶ added in v1.1.0
func (p *Pagination) GetSize() int
func (*Pagination) GetTotalPages ¶ added in v1.1.0
func (p *Pagination) GetTotalPages() int
func (*Pagination) SetOrderBy ¶ added in v1.1.0
func (p *Pagination) SetOrderBy(orderByQuery string)
func (*Pagination) SetPage ¶ added in v1.1.0
func (p *Pagination) SetPage(pageQuery string) error
func (*Pagination) SetSize ¶ added in v1.1.0
func (p *Pagination) SetSize(sizeQuery string) error
Source Files
¶
- api.go
- array.go
- cache.go
- chart.go
- color.go
- config.go
- connection.go
- console.go
- constants.go
- context.go
- cron.go
- crypto.go
- date.go
- error.go
- function.go
- http.go
- io.go
- logger.go
- math.go
- media.go
- number.go
- os.go
- print.go
- random.go
- regex.go
- server.go
- shared.go
- string.go
- struct.go
- time.go
- type.go
- utilities.go
Click to show internal directories.
Click to hide internal directories.