utils

package
v0.0.0-...-c79604e Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_CHAR = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
View Source
const NormalConsoleWidth = 80

Variables

This section is empty.

Functions

func CountSpaceInStringPrefix

func CountSpaceInStringPrefix(str string) int

func ErrorExit

func ErrorExit(msg string, code ...int) int

func Exit

func Exit(code ...int) int

func ExitByError

func ExitByError(err error, code ...int) int

func ExitByErrorMsg

func ExitByErrorMsg(msg string, code ...int) int

func Filter

func Filter[E any](src []E, callback func(E) bool) []E

func FormatTextToWidth

func FormatTextToWidth(text string, width int) string

func FormatTextToWidthAndPrefix

func FormatTextToWidthAndPrefix(text string, prefixWidth int, overallWidth int) string

func GetArgs0

func GetArgs0() string

func GetArgs0Name

func GetArgs0Name() string

func GetCallingFunctionInfo

func GetCallingFunctionInfo(skip int) (string, string, string, int)

func GetGoVersion

func GetGoVersion() (int64, int64, int64, error)

func GetGoVersionMajor

func GetGoVersionMajor() (int64, error)

func GetGoVersionMajorMust

func GetGoVersionMajorMust() int64

func GetGoVersionMinor

func GetGoVersionMinor() (int64, error)

func GetGoVersionMinorMust

func GetGoVersionMinorMust() int64

func GetGoVersionPatch

func GetGoVersionPatch() (int64, error)

func GetGoVersionPatchMust

func GetGoVersionPatchMust() int64

func GetSQLNullString

func GetSQLNullString(s sql.NullString) string

func GetSQLNullTimeUnix

func GetSQLNullTimeUnix(s sql.NullTime) int64

func HasInvisibleByteSlice

func HasInvisibleByteSlice(data []byte) bool

func HasInvisibleString

func HasInvisibleString(str string) bool

func HasUTF8BOM

func HasUTF8BOM(data []byte) bool

func HttpStatusOK

func HttpStatusOK(status int) bool

func InvalidPhone

func InvalidPhone(phone string) bool

func IsDir

func IsDir(path string) bool

func IsExists

func IsExists(path string) bool

func IsUTF8

func IsUTF8(b []byte) bool

func IsUTF8String

func IsUTF8String(s string) bool

func IsValidDomain

func IsValidDomain(domain string) bool

func IsValidEmail

func IsValidEmail(email string) bool

func IsValidIPv4CIDR

func IsValidIPv4CIDR(cidr string) bool

func IsValidIPv6CIDR

func IsValidIPv6CIDR(cidr string) bool

IsValidIPv6CIDR checks if the given string is a valid IPv6 CIDR notation.

func IsValidURLPath

func IsValidURLPath(path string) bool

func MakeDir

func MakeDir(path string) error

func ProcessPath

func ProcessPath(path string, defaultUrl ...string) string

func Rand

func Rand() *rand.Rand

func RandStr

func RandStr(length int) string

func RemoveBOMIfExists

func RemoveBOMIfExists(data []byte) []byte

func Restart

func Restart(newArgs ...string) (*os.Process, error)

func SHA256

func SHA256(data []byte) string

func SayGoodByef

func SayGoodByef(format string, args ...interface{})

func SayHellof

func SayHellof(format string, args ...interface{})

func SqlTimeNow

func SqlTimeNow() sql.NullTime

func SqlTimeNull

func SqlTimeNull() sql.NullTime

func ValidIPv4

func ValidIPv4(ipString string) bool

func ValidIPv6

func ValidIPv6(ipString string) bool

Types

type StringBool

type StringBool string

func (*StringBool) IsDisable

func (s *StringBool) IsDisable() bool

func (*StringBool) IsEnable

func (s *StringBool) IsEnable() bool

func (*StringBool) SetDefaultDisable

func (s *StringBool) SetDefaultDisable()

func (*StringBool) SetDefaultEanble

func (s *StringBool) SetDefaultEanble()

func (*StringBool) ToBool

func (s *StringBool) ToBool(defaultVal ...bool) (res bool)

func (*StringBool) ToString

func (s *StringBool) ToString() string

func (*StringBool) ToStringDefaultDisable

func (s *StringBool) ToStringDefaultDisable() string

func (*StringBool) ToStringDefaultEnable

func (s *StringBool) ToStringDefaultEnable() string

Jump to

Keyboard shortcuts

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