Documentation ¶
Index ¶
- Constants
- Variables
- func AnyToInt32(ipara any) int32
- func AnyToString(ipara any) string
- func Atobool(s string) (bool, error)
- func Atoi(s string) (int32, error)
- func Atoi16(s string) (int16, error)
- func Atoi64(s string) (int64, error)
- func Atoiu(s string) (uint32, error)
- func Base64DecodeStr(base64str string) []byte
- func Base64EncodeStr(bin []byte) string
- func Between[T zbcmn.Ordered](my, start, end T) bool
- func Bin2Str(bin []byte) string
- func Bytes2Ints[T zbcmn.Integer](no_copy bool, bytes []byte) []T
- func Bytes2Ints_[T zbcmn.Integer](no_copy bool, bytes ...byte) []T
- func Bytes2Str(no_copy bool, bytes []byte) string
- func BytesInt64(bytes []byte) int64
- func CastPTR(srcptr any, destype any) any
- func CountFunc(nlen int, cond func(i int) bool) int
- func DecryptDES_CBC(src, key []byte) ([]byte, error)
- func DecryptDES_ECB(src, key []byte) ([]byte, error)
- func DeepCopy(dst, src any) error
- func DelMulti[IDX zbcmn.Integer](nlen int, fassign func(i, j IDX), deletedidx ...IDX) (deletedcount int)
- func DelNotCond(nlen int, fassign func(i, j int), keepcond func(i int) bool, ...) bool
- func EncryptDES_CBC(src, key []byte) ([]byte, error)
- func EncryptDES_ECB(src, key []byte) ([]byte, error)
- func EscQuotes(str string, chars_esc string, 识别转义 bool) string
- func FetchIntArgInStr(str, prefix, sepchas string) (arg int, err error)
- func Fn[T any](tf T) func() T
- func GetMonthZeroTime() uint32
- func GetNextMonthZeroTime() uint32
- func GetNextWeekZeroTime() uint32
- func GetNextWeekdayZeroTime(weekday uint32) uint32
- func GetPreMonthZeroTime() uint32
- func GetPreWeekZeroTime() uint32
- func GetTick() int64
- func GetTodayWeekday() int32
- func GetTodayZeroTime() uint32
- func GetTomorrowZeroTime() uint32
- func GetWeekZeroTime() uint32
- func GetYesterdayZeroTime() uint32
- func I16toa(i int16) string
- func I64toa(i int64) string
- func IF[T any](cond bool, true_t T, false_t T) T
- func IFF[T any](cond bool, true_t func() T, false_t func() T) func() T
- func IPv4itoa(IPi uint32) string
- func InSet[T comparable](a T, set ...T) bool
- func Index[T comparable](arr []T, val T) int
- func IndexFunc(nlen int, cond func(i int) bool) int
- func IndexLastFunc(nlen int, cond func(i int) bool) int
- func IndexScope[T zbcmn.Ordered](a []T, _Left, _Right T) (int, int)
- func Int64Bytes(i64 int64) []byte
- func Ints2Bytes[T zbcmn.Integer](no_copy bool, ints []T) []byte
- func Ints2Bytes_[T zbcmn.Integer](no_copy bool, ints ...T) []byte
- func Itoa(i int32) string
- func Iutoa(i uint32) string
- func LenChaInStr(str string, idx int) (chalen int)
- func Lowerbound(nlen int, fmore_eq func(i int) bool) int
- func MakeUnique(nlen int, less func(i, j int) bool, swap func(i, j int), ...) (deletedcount int)
- func MakeUnique2(nlen int, less func(i, j int) bool, swap func(i, j int)) (deletedcount int)
- func MakeUniqueType[T zbcmn.Ordered](arr ...T) []T
- func Max[T zbcmn.Ordered](i1, i2 T) T
- func Md5Bin(src []byte) []byte
- func Md5Str(src string) string
- func Min[T zbcmn.Ordered](i1, i2 T) T
- func NewLenRandomChars(length int, chars []byte) string
- func NextChaInStr(str string, idx int) (nextcidx int)
- func Now() uint32
- func Now64() int64
- func NowStr() string
- func NowStr64() string
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func Parallel(n_ms, n_len, ntimes int, run func(idx int) bool) (retidx int)
- func Randn(n uint64) uint64
- func ReplaceAny(s, old_asciis string, new_ascii byte) string
- func Reverse(nlen int, fswap func(i, j int))
- func RsaDecrypt(ciphertext []byte, privateKey []byte) ([]byte, error)
- func RsaEncrypt(origData []byte, publicKey []byte) ([]byte, error)
- func RsaSign(signedtxt []byte, privateKey []byte) ([]byte, error)
- func RsaVerify(signedtxt, signdata []byte, publicKey []byte) error
- func Sha256Bin(src []byte) []byte
- func Sha256Str(src string) string
- func Sha512Bin(src []byte) []byte
- func Sha512Str(src string) string
- func Sort(nlen int, fless func(i, j int) bool, fswap func(i, j int))
- func SortArr[A zbcmn.Ordered](a ...A) []A
- func SplitByBrace(str, left_right_brace string) [3]string
- func SplitFields(s string, sepchas string, or_space bool) []string
- func SplitInt16s(s string, sepchas string, or_space bool) (retval []int16, reterr error)
- func SplitInt64s(s string, sepchas string, or_space bool) (retval []int64, reterr error)
- func SplitInts(s string, sepchas string, or_space bool) (retval []int32, reterr error)
- func SplitUInt64s(s string, sepchas string, or_space bool) (retval []uint64, reterr error)
- func Str2Bin(str string) ([]byte, error)
- func Str2Bytes(no_copy bool, s string) []byte
- func TimeAbs2Rel(tm time.Time) uint32
- func TimeAbs2Rel64(tm time.Time) int64
- func TimeAbs2Str(abs time.Time) string
- func TimeAbs2Str64(abs time.Time) string
- func TimeArrive(currtick int64, valuetick int64) bool
- func TimeExceed(currtick int64, valuetick int64) bool
- func TimeGetInv() time.Time
- func TimeIsValid(time time.Time) bool
- func TimeRel2Abs(rela uint32) time.Time
- func TimeRel2Abs64(rela int64) time.Time
- func TimeRel2Str(rela uint32) string
- func TimeRel2Str64(rela int64) string
- func TimeStr2Rel(tm string) uint32
- func TimedIndex[T comparable](n_ms int, arr []T, at T) (retidx int)
- func TraverseFunc(nlen int, skip func(i int) int)
- func UnsafeAtoi(s string) int32
- func UnsafeAtoi64(s string) int64
- func Upperbound(neln int, fmore func(j int) bool) int
- func ValidName(name string, maxlen int) bool
- func ValidStr(str string, maxlen int, 允许空格 bool) bool
- func VerifyCHNcard(cardno string) bool
- type Bitwise
- func (t *Bitwise) Bitlen() int
- func (t *Bitwise) Bitnot(idx int) bool
- func (t *Bitwise) Bitwise(nsize int) *Bitwise
- func (t *Bitwise) Fill(index int, val uint64) bool
- func (t *Bitwise) FromBytes(bs []byte, bitlen int) bool
- func (t *Bitwise) GetIndexVal(idx int) (index int, val uint64)
- func (t *Bitwise) IsMarked(idx int) bool
- func (t *Bitwise) Mark(idx int) bool
- func (t *Bitwise) MarkAll()
- func (t *Bitwise) Reset(idx int) bool
- func (t *Bitwise) ResetAll()
- func (t *Bitwise) ToBytes() []byte
- func (t *Bitwise) ToInt32s() []uint32
- func (t *Bitwise) UnsafeToBytes() []byte
- type BytesReader
- type ErrNotExist
- type Rand
- func (r *Rand) Float32() float32
- func (r *Rand) Float64() float64
- func (r *Rand) Int() int
- func (r *Rand) Int31() int32
- func (r *Rand) Int31n(n int32) int32
- func (r *Rand) Int63() int64
- func (r *Rand) Int63n(n int64) int64
- func (r *Rand) Intn(n int) int
- func (r *Rand) Perm(n int) []int
- func (r *Rand) Read(p []byte) (n int, err error)
- func (r *Rand) Seed(seed int64)
- func (r *Rand) Shuffle(n int, swap func(i, j int))
- func (r *Rand) Uint32() uint32
- func (r *Rand) Uint64() uint64
- type SQLMgr
- func (this *SQLMgr) GetDBC() *sql.DB
- func (this *SQLMgr) GetDBase() string
- func (this *SQLMgr) GetIP() string
- func (this *SQLMgr) GetPasswd() string
- func (this *SQLMgr) GetPort() uint16
- func (this *SQLMgr) GetUsrName() string
- func (this *SQLMgr) SQLMgr(dbcmax, idlemax int, usrname, passwd, db, ip string, port uint16) *SQLMgr
- type Source
- type Source64
- type StrBuilder
Constants ¶
const DateLayout = "2006-01-02"
const HoMSLayout = "15:04:05"
const InvalidCharInName = "@#$%&*()<>,;./?:\"'\\|+="
const TimeBase = "2012-01-01 00:00:00" //这天是星期天,世界末日后新的纪元开始
const TimeInvalid = "2011-12-31 23:59:59"
const TimeLayout = "2006-01-02 15:04:05"
const TimeLayoutM = "2006-01-02 15:04"
const TimeLayoutm = "2006-01-02 15:04:05.000"
Variables ¶
var AsciiChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+,.?/:;{}[]`~")
var NotExist = &ErrNotExist{error: fmt.Errorf("Not Exist.")}
var NumChars = []byte("0123456789")
Functions ¶
func AnyToInt32 ¶
func AnyToString ¶
func BytesInt64 ¶
func DelMulti ¶
func DelMulti[IDX zbcmn.Integer](nlen int, fassign func(i, j IDX), deletedidx ...IDX) (deletedcount int)
DelMulti 删除序列数据中多个下标的数据,调用方需自行缩短序列的长度去掉末尾的deletedcount个元素
func DelNotCond ¶
func DelNotCond(nlen int, fassign func(i, j int), keepcond func(i int) bool, finish func(deletedcount int)) bool
DelNotCond 删除不符合条件的多个序列元素,调用方需在finish中去掉末尾的deletedcount个元素
func FetchIntArgInStr ¶
func GetNextWeekdayZeroTime ¶
GetNextWeekdayZeroTime 获取最近一个周几的零点时间戳(周日为7)
func IndexLastFunc ¶
IndexFunc 反向搜索符合条件的项目,返回第一个下标
func IndexScope ¶
IndexScope 返回已排序序列[]T中介于半闭包区间[_Left,_Right)的下标范围
func LenChaInStr ¶
func Lowerbound ¶
Lowerbound 二分查找,复杂度O(n)=log2_n 返回>={搜索值}的最小索引,fmore_eq:=func(i int)bool{return arr[i]>={搜索值}}
func MakeUnique ¶
func MakeUnique(nlen int, less func(i, j int) bool, swap func(i, j int), equal func(i, j int) bool, assign func(i, j int)) (deletedcount int)
MakeUnique 算法工具函数 使 序列数据 去重复
func MakeUnique2 ¶
MakeUnique2 简化版的MakeUnique 使 序列数据 去重复
func MakeUniqueType ¶
MakeUniqueType 使内置可排序类型 序列数据 去重复
func NewLenRandomChars ¶
func NextChaInStr ¶
func Parallel ¶
Parallel 并行限时运行,返回最先run(idx)为true的索引 n_ms 毫秒数,没有找到或查找超时,retidx返回-1 ntimes 子routine run()多少次检查一次break,根据run()的重度程度决定,轻度run一般设置10-100,重度run设置1-10
func ReplaceAny ¶
RelaceAny从s中搜索任意一个old_asciis中的每一个ascii码字符,搜索到了使用new_ascii进行替换
func SplitByBrace ¶
返回值:left, in_brace, right
func SplitInt16s ¶
func SplitInt64s ¶
func SplitUInt64s ¶
func TimeAbs2Str ¶
func TimeAbs2Str64 ¶
func TimeArrive ¶
func TimeExceed ¶
func TimeRel2Str ¶
func TimeRel2Str64 ¶
func TimeStr2Rel ¶
func TimedIndex ¶
func TimedIndex[T comparable](n_ms int, arr []T, at T) (retidx int)
TimedIndex 并发限时查找,返回最先查找到的元素的索引 n_ms 毫秒数,没有找到或查找超时,返回-1
func UnsafeAtoi ¶
func UnsafeAtoi64 ¶
func Upperbound ¶
Upperbound 二分查找,复杂度O(n)=log2_n 返回>{搜索值}的最小索引,fmore:=func(i int)bool{return arr[i]>{搜索值}}
func VerifyCHNcard ¶
Types ¶
type Bitwise ¶
type Bitwise struct {
// contains filtered or unexported fields
}
Bitwise 按bit操作的大数结构
func (*Bitwise) GetIndexVal ¶
GetIndexVal 获取idx位所在的uint64索引index和uint64值
func (*Bitwise) UnsafeToBytes ¶
UnsafeToBytes 不安全的连续内存强转byte序列
type BytesReader ¶
type BytesReader []byte
type ErrNotExist ¶
type ErrNotExist struct {
// contains filtered or unexported fields
}
搜索str中prefix开头,sepchas结尾或到末尾的子串,子串转换为整数
type Rand ¶
type Rand struct {
// contains filtered or unexported fields
}
A Rand is a source of random numbers.
type SQLMgr ¶
type SQLMgr struct {
// contains filtered or unexported fields
}
func (*SQLMgr) GetUsrName ¶
type Source ¶
A Source represents a source of uniformly-distributed pseudo-random int64 values in the range [0, 1<<63).
type Source64 ¶
A Source64 is a Source that can also generate uniformly-distributed pseudo-random uint64 values in the range [0, 1<<64) directly. If a Rand r's underlying Source s implements Source64, then r.Uint64 returns the result of one call to s.Uint64 instead of making two calls to s.Int63.
type StrBuilder ¶
func NewBuilder ¶
func NewBuilder(buf []byte) (ret *StrBuilder)
func NewBuilderString ¶
func NewBuilderString(s string) (ret *StrBuilder)