Versions in this module Expand all Collapse all v1 v1.2.0 Aug 11, 2026 Changes in this version + const Byte + const ChinaTimeOffset + const ChinaTimeZone + const EByte + const EiByte + const GByte + const GiByte + const IByte + const IPv4Max + const IPv4Min + const KByte + const KiByte + const MByte + const MiByte + const PByte + const PiByte + const PtrSize + const TByte + const TiByte + var BigByte = big.NewInt(1) + var BigEByte = (&big.Int{}).Mul(BigPByte, bigSIExp) + var BigEiByte = (&big.Int{}).Mul(BigPiByte, bigIECExp) + var BigGByte = (&big.Int{}).Mul(BigMByte, bigSIExp) + var BigGiByte = (&big.Int{}).Mul(BigMiByte, bigIECExp) + var BigKByte = (&big.Int{}).Mul(BigSIByte, bigSIExp) + var BigKiByte = (&big.Int{}).Mul(BigByte, bigIECExp) + var BigMByte = (&big.Int{}).Mul(BigKByte, bigSIExp) + var BigMiByte = (&big.Int{}).Mul(BigKiByte, bigIECExp) + var BigPByte = (&big.Int{}).Mul(BigTByte, bigSIExp) + var BigPiByte = (&big.Int{}).Mul(BigTiByte, bigIECExp) + var BigSIByte = big.NewInt(1) + var BigTByte = (&big.Int{}).Mul(BigGByte, bigSIExp) + var BigTiByte = (&big.Int{}).Mul(BigGiByte, bigIECExp) + var BigYByte = (&big.Int{}).Mul(BigZByte, bigSIExp) + var BigYiByte = (&big.Int{}).Mul(BigZiByte, bigIECExp) + var BigZByte = (&big.Int{}).Mul(BigEByte, bigSIExp) + var BigZiByte = (&big.Int{}).Mul(BigEiByte, bigIECExp) + var ChinaTimeLocation = time.FixedZone(ChinaTimeZone, ChinaTimeOffset) + var ErrInvalidHostPort = errors.New("invalid Host or Port") + var Rand = NewRand() + var Seed = FastRand() + var StackTraceBufferSize = 4 << 10 + func B2S(b []byte) string + func B64Decode(s string) []byte + func B64Encode(b []byte) string + func B64UrlDecode(s string) []byte + func B64UrlEncode(b []byte) string + func BeginOfDay(t time.Time) time.Time + func BeginOfHour(t time.Time) time.Time + func BeginOfLastMonth(t time.Time) time.Time + func BeginOfLastWeek(t time.Time) time.Time + func BeginOfMinute(t time.Time) time.Time + func BeginOfMonth(t time.Time) time.Time + func BeginOfNextMonth(t time.Time) time.Time + func BeginOfNextWeek(t time.Time) time.Time + func BeginOfSecond(t time.Time) time.Time + func BeginOfTomorrow(t time.Time) time.Time + func BeginOfWeek(t time.Time) time.Time + func BeginOfYear(t time.Time) time.Time + func BeginOfYesterday(t time.Time) time.Time + func BigComma(b *big.Int) string + func BigCommaf(v *big.Float) string + func Bigoom(n, b *big.Int) (float64, int) + func CPUTicks() int64 + func CallPath() string + func CheckDomain(name string) error + func Comma(v int64) string + func Commaf(v float64) string + func Commai(v int) string + func Commau(v uint64) string + func CopyB2S(b []byte) string + func CopyBytes(b []byte) []byte + func CopyS2B(s string) []byte + func CopyString(s string) string + func CutBytes(s, sep []byte) (before, after []byte, found bool) + func CutString(s, sep string) (before, after string, found bool) + func DaysInMonth(year int, m time.Month) int + func DaysInYear(year int) int + func EncodeUUID(id []byte) []byte + func EndOfDay(t time.Time) time.Time + func EndOfHour(t time.Time) time.Time + func EndOfLastMonth(t time.Time) time.Time + func EndOfLastWeek(t time.Time) time.Time + func EndOfMinute(t time.Time) time.Time + func EndOfMonth(t time.Time) time.Time + func EndOfNextMonth(t time.Time) time.Time + func EndOfNextWeek(t time.Time) time.Time + func EndOfSecond(t time.Time) time.Time + func EndOfTomorrow(t time.Time) time.Time + func EndOfWeek(t time.Time) time.Time + func EndOfYear(t time.Time) time.Time + func EndOfYesterday(t time.Time) time.Time + func EqualFold(b, s string) bool + func EqualFoldBytes(b, s []byte) bool + func Executable(evalSymlinks ...bool) string + func ExecutableDir(evalSymlinks ...bool) string + func FastIntn(n int) int + func FastRand() uint32 + func FastRand64() uint64 + func FastRandn(n uint32) uint32 + func FastRandu() uint + func FirstString(s, sep string, defaultStr ...string) string + func GetBytes(v interface{}, defaultVal ...[]byte) []byte + func GetDomain(name string) string + func GetIPPort(addr net.Addr) (ip net.IP, port int, err error) + func GetInt(v interface{}, defaultInt ...int) int + func GetMonthDays(t time.Time) int + func GetNotInternalIPv4(ip, defaultIP net.IP, flag ...bool) net.IP + func GetNotInternalIPv4String(ip, defaultIP string, flag ...bool) string + func GetSafeB2S(b []byte, defaultVal ...string) string + func GetSafeBytes(b []byte, defaultVal ...[]byte) []byte + func GetSafeS2B(s string, defaultVal ...[]byte) []byte + func GetSafeString(s string, defaultVal ...string) string + func GetString(v interface{}, defaultVal ...string) string + func GoroutineID() (uint64, error) + func Gzip(data []byte) ([]byte, error) + func GzipLevel(data []byte, level int) (dst []byte, err error) + func HumanBaseBytes(v uint64, base float64, sizes []string) string + func HumanBigBytes(s *big.Int) string + func HumanBigIBytes(s *big.Int) string + func HumanBigKbps(s *big.Int) string + func HumanBytes(v uint64) string + func HumanGBMB(v uint64) string + func HumanIBytes(v uint64) string + func HumanIntBytes(v int) string + func HumanIntIBytes(v int) string + func HumanIntKbps(v int) string + func HumanKbps(v uint64) string + func ID() uint64 + func IPv42Long(ip net.IP) int + func IPv42LongLittle(ip net.IP) int + func IPv4String2Long(ip string) int + func IPv4String2LongLittle(ip string) int + func IPv62Int(ip net.IP) *big.Int + func IPv6String2Int(ip string) *big.Int + func InIPNet(ip net.IP, ipNets map[*net.IPNet]struct{}) bool + func InIPNetString(ip string, ipNets map[*net.IPNet]struct{}) bool + func InInts(slice []int, n int) bool + func InStrings(ss []string, s string) bool + func InitCSTLocation() (name string, loc *time.Location, cst *time.Location, ok bool) + func InitChinaLocation() *time.Location + func InitLocation(name string) (*time.Location, bool) + func Int2IPv6(ipInt *big.Int) net.IP + func Int2IPv6String(n *big.Int) string + func IsIP(ip string) bool + func IsIPv4(s string) bool + func IsIPv6(s string) bool + func IsInternalIPv4(ip net.IP) bool + func IsInternalIPv4String(ip string) bool + func IsLeapYear(year int) bool + func IsLetter(s string) bool + func IsLetterOrNumeric(s string) bool + func IsNumeric(s string) bool + func IsPrivateIP(ip net.IP) bool + func IsPrivateIPString(ip string) bool + func JoinBytes(b ...[]byte) []byte + func JoinString(s ...string) string + func JoinStringBytes(s ...string) []byte + func LastString(s, sep string, defaultStr ...string) string + func LeftPad(s, pad string, n int) string + func LeftPadBytes(b, pad []byte, n int) []byte + func Logn(n, b float64) float64 + func Long2IPv4(n int) net.IP + func Long2IPv4String(n int) string + func LongLittle2IPv4(n int) net.IP + func LongLittle2IPv4String(n int) string + func MaxInt(a, b int) int + func MinInt(a, b int) int + func MustBool(v interface{}) bool + func MustInt(v interface{}) int + func MustJSON(v interface{}) []byte + func MustJSONIndent(v interface{}) []byte + func MustJSONIndentString(v interface{}) string + func MustJSONString(v interface{}) string + func MustParseHumanBigBytes(s string, defaultVal ...*big.Int) *big.Int + func MustParseHumanBytes(s string, defaultVal ...uint64) uint64 + func MustString(v interface{}, timeLayout ...string) string + func NanoTime() int64 + func NewRand(seed ...int64) *rand.Rand + func NewSpinLock() sync.Locker + func Pad(s, pad string, n int) string + func PadBytes(s, pad []byte, n int) []byte + func ParseHostPort(s string) (net.IP, uint16, bool, error) + func ParseHumanBigBytes(s string) (*big.Int, error) + func ParseHumanBytes(s string) (uint64, error) + func ParseIP(s string) (net.IP, bool) + func ParseIPv4(ip string) net.IP + func ParseIPv6(ip string) net.IP + func ParseIPx(s string) (net.IP, bool) + func ParseIPxWithNumeric(s string) (net.IP, bool) + func ParseInts(s string) ([]int, error) + func RandAlphaBytes(n int) []byte + func RandAlphaString(n int) string + func RandBytes(n int) []byte + func RandBytesLetters(n int, letters string) []byte + func RandDecBytes(n int) []byte + func RandDecString(n int) string + func RandHexBytes(n int) []byte + func RandHexString(n int) string + func RandInt(min, max int) int + func RandString(n int) string + func RandUint32(min, max uint32) uint32 + func Recover(cb ...RecoveryCallback) + func RemoveRunes(s string, toRemove string) string + func RemoveString(ss []string, s string) ([]string, bool) + func ReplaceHost(a, b string) string + func Reverse(s string) string + func RightPad(s, pad string, n int) string + func RightPadBytes(b, pad []byte, n int) []byte + func Round(v float64, precision int) float64 + func RunPath() string + func RuneReverse(s string) string + func RuneSubString(s string, length int, suffix string) string + func S2B(s string) []byte + func SafeGo(fn func(), cb ...RecoveryCallback) + func SafeGoCommonFunc(args interface{}, fn func(args interface{}), cb ...RecoveryCallback) + func SafeGoWithContext(ctx context.Context, fn func(ctx context.Context), cb ...RecoveryCallback) + func SearchInt(slice []int, n int) int + func SearchString(ss []string, s string) int + func Sleep(ctx context.Context, interval time.Duration) error + func SplitHostPort(hostPort string) (host, port string) + func SumInt(v ...int) int + func ToLower(b string) string + func ToLowerBytes(b []byte) []byte + func ToUpper(b string) string + func ToUpperBytes(b []byte) []byte + func Trim(s string, cutset byte) string + func TrimBytes(b []byte, cutset byte) []byte + func TrimLeft(s string, cutset byte) string + func TrimLeftBytes(b []byte, cutset byte) []byte + func TrimRight(s string, cutset byte) string + func TrimRightBytes(b []byte, cutset byte) []byte + func TrimSlice(ss []string) []string + func TruncStr(s string, maxLen int, suffix string) string + func UUID() []byte + func UUIDShort() string + func UUIDSimple() string + func UUIDString() string + func Ungzip(data []byte) (src []byte, err error) + func Unzip(data []byte) (src []byte, err error) + func ValidOptionalPort(port string) bool + func WaitNextMinute(t ...time.Time) + func WaitNextMinuteWithTime(t ...time.Time) (now time.Time) + func WaitNextSecond(t ...time.Time) + func WaitNextSecondWithTime(t ...time.Time) (now time.Time) + func WaitSignal(sig ...os.Signal) os.Signal + func WaitUntilMinute(m int, t ...time.Time) + func WaitUntilSecond(s int, t ...time.Time) + func Zip(data []byte) ([]byte, error) + func ZipLevel(data []byte, level int) (dst []byte, err error) + type Bool struct + func NewBool(val bool) *Bool + func NewFalse() *Bool + func NewTrue() *Bool + func (x *Bool) CAS(old, new bool) bool + func (x *Bool) CompareAndSwap(old, new bool) (swapped bool) + func (x *Bool) Load() bool + func (x *Bool) MarshalJSON() ([]byte, error) + func (x *Bool) Store(val bool) + func (x *Bool) StoreFalse() + func (x *Bool) StoreTrue() + func (x *Bool) String() string + func (x *Bool) Swap(new bool) (old bool) + func (x *Bool) Toggle() (old bool) + func (x *Bool) UnmarshalJSON(b []byte) error + type NoCmp [0]func() + type NoCopy struct + func (*NoCopy) Lock() + func (*NoCopy) Unlock() + type RecoveryCallback func(err interface{}, trace []byte) + type TryMutex struct + func NewTryMutex() *TryMutex + func (m *TryMutex) Lock() + func (m *TryMutex) TryLock(timeout ...time.Duration) bool + func (m *TryMutex) Unlock()