Documentation ¶
Index ¶
- Constants
- Variables
- func AbsDuration(t1 time.Duration) time.Duration
- func AbsInt(x int) int
- func AddPrefixForWidth(src string, width int, prefix string) string
- func AddSuffixForWidth(src string, width int, suffix string) string
- func AppendAllFile(srcFile string, dataFile string) error
- func AppendFile(fileName string, fileData []byte) (int, error)
- func AppendFileEx(fileName string, fileData []byte, forceDir bool) (int, error)
- func BetweenTime(t1, t2 time.Time) time.Duration
- func Binary2Hex(bt []byte) string
- func BitTrimPrefix(v uint64, bitN byte) uint64
- func Bool2Byte(v bool) byte
- func Bool2Str(v bool) string
- func BufStart(buf []byte, start, l int) []byte
- func BufToHexStr(buf []byte, l int, spliterstr string) string
- func BytesAppendUInt64_LE(buf []byte, v uint64) []byte
- func BytesCheckGrow(buf []byte, n int) []byte
- func BytesCheckSize(buf []byte, start, l int) []byte
- func CRC24Q(buf []byte, len int) uint32
- func CRC24QBuf(buf []byte) uint32
- func Cfmod(x, y float64) float64
- func CheckAddPrefix(s, prefix string) (added bool, rval string)
- func CheckAddQuoteChr(s string, prefix, suffix rune) string
- func CheckAddSuffix(s, suffix string) (added bool, rval string)
- func CheckAllStrsIsNotEmpty(strs ...string) bool
- func CheckByteIn(v byte, sets ...byte) bool
- func CheckGetStrlist(strs []string, idx int, def string) string
- func CheckGetValInlst(lst []interface{}, idx int, def interface{}) interface{}
- func CheckRotateFile(filename string) error
- func CheckRotateFileAfterCreateFile(filename string) (fn *os.File, err error)
- func CheckTrimPrefix(s, prefix string) (bool, string)
- func CheckTrimQuoteChr(s string, prefix, suffix byte) (bool, string)
- func CheckTrimQuoteString(s string, prefix, suffix string) (bool, string)
- func CheckTrimSuffix(s, suffix string) (bool, string)
- func CloneBytes(src []byte, offset int, l int) []byte
- func CloneBytesEx(src []byte, offset int, l int) []byte
- func CmpAndSetBitValue(ival uint64, bitN byte, cmpbitVal, newbitVal byte) (changed bool, newval uint64)
- func CombineFilePath(parts ...string) string
- func CombineIfFirstNotEmpty(s1, s2 string) string
- func CombineIfNotEmpty(s1, s2 string) string
- func CompareIgnoreCase(s1, s2 string) int
- func ContainElement(s string, ele string, sep rune) (rval bool)
- func CopyFile(src, dst string) (w int64, err error)
- func CreateIfExistsThenRename(name string) (*os.File, string, error)
- func CreateRewrite(fileName string) (*os.File, error)
- func CutIfMore(s string, n int, moreflagstr string) string
- func CutLeft(s string, n int) (cut string, remain string)
- func CutNPrefixFunc(s string, idx int, cutflag byte, CheckCutBreakFunc func(c rune) bool) (cut string, remain string)
- func CutNSuffixFunc(s string, idx int, cutflag byte, CheckCutBreakFunc func(c rune) bool) (cut string, remain string)
- func CutPrefixByRune(s string, idx int, cutflag byte, c rune) (cut string, remain string)
- func CutPrefixFunc(s string, cutflag byte, CheckCutBreakFunc func(c rune) bool) (cut string, remain string)
- func CutSuffixByRune(s string, idx int, cutflag byte, c rune) (cut string, remain string)
- func CutSuffixFunc(s string, cutflag byte, CheckCutBreakFunc func(c rune) bool) (cut string, remain string)
- func DateString(val time.Time) string
- func DateTimeIDString(val time.Time) string
- func DateTimeString(val time.Time) string
- func DateTimeString2(val time.Time) string
- func DateTimeString3(val time.Time) string
- func DateTimeStringForShortShow(val time.Time) string
- func DateTimeStringForShow(val time.Time) string
- func DateYYMM(val time.Time) string
- func DateYYYYMM(val time.Time) string
- func DateYYYYMMDD(val time.Time) string
- func DayOfYear(atime time.Time) string
- func DecimalToAny(num, n, count int) string
- func DecodeCRCBuf(src []byte) []byte
- func DeferCatchPanic(args ...interface{})
- func DelNonAsciiChar(s []byte) string
- func DelNonAsciiCharEx(s []byte, splitchar byte) string
- func DelNonChineseChar(s string) string
- func DelNonChineseCharEx(s string, splitchar rune) string
- func DelNonPrintChar(s string) string
- func DeleteBuf(buf []byte, startidx, n int) (newBuf []byte)
- func DeleteFileNameExt(fileName string) string
- func DeleteFileOrDir(strPath string) error
- func DeleteStrlstEle(strs []string, fn func(s string) bool) []string
- func DetectBOMType(data []byte) int
- func DurationStr(d time.Duration) string
- func EnablePanicRecordFile(logpath string)
- func EncodeCRCBuf(src []byte) []byte
- func EndOfADay(day time.Time) time.Time
- func EscapeJsonStr(str string) string
- func EscapeJsonStrSimple(str string) string
- func EscapeSQLStr(str string) string
- func EscapeStr4Line(str string) string
- func ExecCmdLine(cmdLine string, arg_spliter string) error
- func ExecCmdNoWait(cmdLine string) (*exec.Cmd, error)
- func ExecCmdNoWaitNoSettingIO(cmdLine string) (*exec.Cmd, error)
- func ExecShell(cmdLine string) error
- func ExecShellAndNoWait(cmdLine string) error
- func ExecShellOutput(cmd string) (err error, str string)
- func ExecShellWithIO(cmdLine string, rd io.Reader, outstd, outerr io.Writer) error
- func ExecShellWithStdIO(cmdLine string) error
- func ExecWithStdIO(cmdLine string) error
- func ExtractFileName(fileName string) string
- func ExtractFileNameWithOutPathAndExt(fileName string) string
- func ExtractFilePath(fileName string) string
- func FastByte2String(bt []byte) string
- func FileIs(fileName string) int
- func FileIsExists(fileName string) bool
- func FileMTime(fp string) (time.Time, error)
- func FileNameAddfix(fileName, prefix, suffix string) string
- func FileSize(fp string) (int64, error)
- func FindNonElement(s1, s2 string, sep rune) string
- func FixintervalLastTime(t time.Time, fixinterval time.Duration) time.Time
- func FixintervalNextTime(t time.Time, fixinterval time.Duration) time.Time
- func FixintervalOffsetTime(t time.Time, fixinterval time.Duration, offsetN int) time.Time
- func Float32ToStr(val float64) string
- func Float64ToStr(val float64) string
- func ForceAllPath(strPath string) error
- func ForceCreateFilePath(fileName string) error
- func ForceCreatePath(strPath string) bool
- func FormatFloatVlst(fmtstr string, singalw int, totalwidth int, args ...float64) string
- func GetAbsPath(basePath, relaPath string) (string, error)
- func GetAreaBK(s string, start, end string, idx int) string
- func GetBetween(str string, start, end string, idx int) string
- func GetBetweenEx(str string, start, end string, idx int) (ok bool, val string)
- func GetBitG(buf []byte, startBitN int, l int) float64
- func GetBitI16(buf []byte, startBitN int, l int) int16
- func GetBitI32(buf []byte, startBitN int, l int) int32
- func GetBitI64(buf []byte, startBitN int, l int) int64
- func GetBitI8(buf []byte, startBitN int, l int) int8
- func GetBitOnU32(v uint32) (n byte)
- func GetBitOnU64(v uint64) (n byte)
- func GetBitU(buf []byte, startBitN int, l int) uint32
- func GetBitU16(buf []byte, startBitN int, l int) uint16
- func GetBitU64(buf []byte, startBitN int, l int) uint64
- func GetBitU8(buf []byte, startBitN int, l int) byte
- func GetBitV_U32(v uint32, bitN byte) byte
- func GetBitV_U64(v uint64, bitN byte) byte
- func GetBitValue(ival uint64, bitN byte) byte
- func GetBitValue0(ival uint64, bitN byte) byte
- func GetBoolValue(val interface{}, def bool) bool
- func GetCurrentDirectory() (path string, err error)
- func GetCurrentGoRoutineID() uint64
- func GetCurrentWorkingPath() (path string)
- func GetDateTimeValue(val interface{}, def time.Time) time.Time
- func GetDayOfWeek(val time.Time) byte
- func GetDecimalBitN(v int64, n int64) int
- func GetDecimalBitNEx(v int64, n int64) int
- func GetExecShellCmd(cmdLine string) *exec.Cmd
- func GetExecuteFileDirectory() (path string)
- func GetExecuteFileName() (name string)
- func GetFirstFromVars(arg interface{}) interface{}
- func GetFloat64Value(val interface{}, def float64) float64
- func GetIdxFloat64ValFromVars(arg interface{}, idx int, def float64) float64
- func GetIdxIntValFromVars(arg interface{}, idx int, def int) int
- func GetIdxStrValFromVarsDef(arg interface{}, idx int, def string) string
- func GetIdxValFromVars(arg interface{}, idx int) interface{}
- func GetIdxValFromVarsDef(arg interface{}, idx int, def interface{}) interface{}
- func GetInt32Value(val interface{}, def int32) int32
- func GetInt64Value(val interface{}, def int64) int64
- func GetLastNumStr(str string, maxl int) string
- func GetMonthDayN(year, month int) int
- func GetNewFileUseIncSN(fileName string) string
- func GetRelativePath(basePath, path2 string) (string, error)
- func GetStrValue(val interface{}, def string) string
- func GetU64BitsU(v uint64, startBit, endBit int) uint64
- func GetU64BitsU_L(v uint64, startBit, l int) uint64
- func GetU8BitValue0(ival byte, bitN byte) byte
- func HEX2BCD(val int) (int, error)
- func HEX2BCDDef(val, def int) int
- func HashStr(str string) int64
- func HaveAnyGBK(data []byte) bool
- func HexStrToBuf(hexstr string) []byte
- func HexToDateTime(hex string, def time.Time) time.Time
- func HexToInt(hex string) int
- func HexValue(chr rune) int
- func HumanDuration(dura time.Duration) string
- func HumanFilesize(sizebytes int64) string
- func HumanFilesizeU(sizebytes uint64) string
- func HumanSizeStrToSize(str string) int64
- func HumanTimeStr(secs int64) string
- func HumanTimeStrFromMinutes(minutes int64, spliter string) string
- func HumanTimeStrFromMinutesInt(minutes int, spliter string) string
- func IncDay(atime time.Time, num int) time.Time
- func IncMonth(atime time.Time, num int) time.Time
- func IncYear(atime time.Time, num int) time.Time
- func InsertBeforeLineFile(fileName string, idx_before_line int64, fileData []byte) error
- func InsertBuf(buf []byte, startidx int, val []byte) (newBuf []byte)
- func Int64_BEBytes(val int64) []byte
- func Int64_FromBEBytes(val []byte) int64
- func Int8ListToStrs(lst []int8, sep string) string
- func IntFromU(v uint64, bitN byte) int64
- func IsAsciiPrintByte(c byte) bool
- func IsAsciiPrintChar(chr rune) bool
- func IsAsciiPrintStr(src string) bool
- func IsChineseChar(c rune) bool
- func IsHexChar(chr rune) bool
- func IsHexStr(src string) bool
- func IsInMultiSection(exp, s string) string
- func IsInSection(exp, s string) bool
- func IsLeapYear(year int) bool
- func IsLinux() bool
- func IsPrintStr(src string) bool
- func IsSameDay(time1, time2 time.Time) bool
- func IsSameMonth(time1, time2 time.Time) bool
- func IsWindows() bool
- func JoinDateAndTime(dateT, timeT time.Time) time.Time
- func JoinDateAndTimeStr(dateT time.Time, timestr string) time.Time
- func JoinDateAndTimeStrFormat(dateT time.Time, timestr, timestr_format string) time.Time
- func JoinIfNoEmpty(chk string, sep string, args ...string) string
- func LastChrCnt(s string, c byte) int
- func LeftStr(s string, n int) string
- func LocationCopy(t1, loctime time.Time) time.Time
- func LogPrintf(s string, args ...interface{})
- func MD5(str string) string
- func MD5Buf(data []byte) string
- func MD5SumFile(filePath string) string
- func MSecOfDuration(time time.Duration) int64
- func MakeVars(arg ...interface{}) interface{}
- func MapEncode(strMap map[string]string, kvsep, itmsep string, escapeflag bool, bb io.Writer)
- func MaxTime(t0 time.Time, t1 time.Time) time.Time
- func MillisecondOf(start, end time.Time) int64
- func MinInt(a, b int) int
- func MinTime(t0 time.Time, t1 time.Time) time.Time
- func MinuteOfDuration(time time.Duration) int64
- func NewFileData(fileName string, fileData []byte) (int, error)
- func NewFileFromReader(fileName string, reader io.Reader) (int, error)
- func NewFileNameIfExistsThenIncSN(fileName string) string
- func NextMonthV(month int) int
- func NextMonthYM(y, m int) (y1, m1 int)
- func NowIDString() string
- func NowString() string
- func NowStringEx() string
- func ObjectHexAddr(v interface{}) string
- func PanicRecordFile(err interface{}, args ...interface{})
- func ParseDuraStr(s string) time.Duration
- func ParseDuration(timeExp string) time.Duration
- func ParseTimeFmt(strPattern string, _t time.Time) string
- func ParserJsonEscapeStr(escapedstr string) string
- func PathBase(path string) string
- func PathEscape(s string) string
- func PathExists(path string) (bool, error)
- func PathUnescape(s string) (string, error)
- func QueryEscape(s string) string
- func QueryUnescape(s string) (string, error)
- func RandBuf(len int) []byte
- func RandFloat64(f float64) float64
- func RandHexString(len int) string
- func RandKeyString(len int) string
- func RandNumString(len int) string
- func RandNumStringWithout4(len int) string
- func RandPass0String(len int) string
- func RangeByteFromHexStr(hexstr string, cb func(v byte) bool) int
- func RangeFiles(path string, maxlevel int, fn func(path string, file os.FileInfo) bool, ...) error
- func RangeStringSep(s string, sep rune, cb func(idx int, s1 string) bool) int
- func RangeStringSep2(s string, cb func(idx int, s1 string) bool, sep0, sep1 rune) int
- func RangeStringSplit(s string, sep string, cb func(idx int, s string) bool) int
- func ReadDir(dirname string) ([]os.FileInfo, error)
- func ReadFile(fileName string) ([]byte, error)
- func ReadFileBlockBuf(fileName string, cb func(block []byte) bool, makebuffunc func() []byte) (int64, error)
- func ReadFileBlockBufOffset(fileName string, offset int64, cb func(block []byte) bool, ...) (int64, error)
- func ReadFileLine(fileName string, cb func(idx int64, line []byte) bool) (int64, error)
- func ReadLBytes(r io.Reader, buf []byte, l int) error
- func ReadPerLine(reader io.Reader, cb func(idx int64, line []byte) bool) (int64, error)
- func ReadPerLineEx(reader io.Reader, cb func(idx int64, line []byte) bool) (int64, error)
- func ReadPerLineFile(filename string, offset int64, cb func(idx int64, line []byte) bool) (int64, error)
- func RenameFile(afile string, newFileName string) error
- func ReplaceAll(s string, old, new string) string
- func ReplaceArea(s string, start, end string, new string) string
- func ReplaceMultiAny2One(s string, any, new string) string
- func ReplaceMultiSpace2One(s string, new string) string
- func ReplaceNonAsciiChar(s []byte, newchr byte) string
- func ReplaceNonChineseChar(s string, newchr rune) string
- func ReplaceNonPrintChar(s string, newchr rune) string
- func ReplaceReg(s string, regP string, new string) (string, error)
- func ReverseBytes(buf []byte)
- func RewriteFile(fileName string, fileData []byte) error
- func RewriteFileFunc(fileName string, fn func(w *os.File) error) error
- func Round32(f float32, n int) float32
- func Round64(f float64, n int) float64
- func RoundTime_Second(t time.Time) time.Time
- func SOD(atime time.Time) float64
- func SearchAFile(path string, currlevel, maxlevel int, ...) (string, error)
- func SearchAFileEx(path string, currlevel, maxlevel int, ...) (string, os.FileInfo)
- func SearchFiles(path string, currlevel, maxlevel int, ...) (string, error)
- func SecondBetween(t1, t2 time.Time) float64
- func SecondOf(start time.Time, end time.Time) int64
- func SecondSub(start, end time.Time) float64
- func SetBitI32(buf []byte, startBitN int, l int, val int32)
- func SetBitI64(buf []byte, startBitN int, l int, val int64)
- func SetBitI8(buf []byte, startBitN int, l int, val int8)
- func SetBitU16(buf []byte, startBitN int, l int, val uint16)
- func SetBitU32(buf []byte, startBitN int, l int, val uint32)
- func SetBitU64(buf []byte, startBitN int, l int, val uint64)
- func SetBitU8(buf []byte, startBitN int, l int, val uint8)
- func SetBitValue(ival uint64, bitN byte, bitVal bool) uint64
- func SetBitValue0(ival uint64, bitN byte, bitVal bool) uint64
- func SetLogOutput(fn func(calldepth int, lvl int8, sender string, s string))
- func SetU8BitValue0(ival byte, bitN byte, bitVal bool) byte
- func Size2GB(sizebytes uint64) float64
- func SizeStrToSize(str string) int64
- func Split2PathAndFileName(fileName string) (dir string, name string)
- func Split2Str(s, sep string) (s1, s2 string)
- func Split2StrV1(s string, sep byte) (s1, s2 string)
- func Split3Str(s, sep string) (s1, s2, s3 string)
- func SplitNumericAndRemain(str string) (numstr, remain string)
- func SplitQuantifiersUnits(s string) (qua string, unit string)
- func SplitStrWidth(s string, width int) (rval []string)
- func StartOfADay(day time.Time) time.Time
- func StartOfAMonth(day time.Time) time.Time
- func Str2lst(s string, sep string, itmprefix, itmsuffix rune, tolower, emptyignore bool) []string
- func StrIndex(s string, strlst ...string) int
- func StrIndexIgnoreCase(s string, strlst ...string) int
- func StrNextSerialNo(str string, maxl int, inc int) string
- func StrTo3Float64(str string, sep string) (f1, f2, f3 float64)
- func StrToFloat32Def(s string, defval float32) float32
- func StrToFloat64Def(s string, defval float64) float64
- func StrToInt64Def(s string, defval int64) int64
- func StrToInt8Def(s string, defval int8) int8
- func StrToInt8List(str string, sep string) (rval []int8)
- func StrToIntDef(s string, defval int) int
- func StrToInts(str string, sep string) (rval []int)
- func StrToNumSuffix(str string, mult int64) int64
- func StrToTimeDef(str, format string, location *time.Location, def time.Time) time.Time
- func StrToUInt8List(str string, sep string) (rval []byte)
- func StringsRangeFunc(strs []string, cb func(idx int64, elestr string) bool) (int64, error)
- func SwapBytes(buf []byte) []byte
- func SyncMapLength(amap *sync.Map) int
- func TimeBetween(t0 time.Time, start time.Time, end time.Time) bool
- func TimeInLocalToday(val time.Time) time.Duration
- func TimeInUtcToday(val time.Time) time.Duration
- func TimeIsUnixZero(t time.Time) bool
- func TimeString3(val time.Time) string
- func ToHourChr(atime time.Time) string
- func ToHourChrUpcase(atime time.Time) string
- func ToUTCTime(src time.Time) time.Time
- func TodayIDString() string
- func TodayStr() string
- func Trim(s string) string
- func TrimPrefixBuf(buf []byte, prefix []byte) (rval []byte, changed bool)
- func TrimPrefixBytes(buf []byte, byteset ...byte) []byte
- func TrimRightByte(buf []byte, rightByte byte) []byte
- func TrimRightBytes(buf []byte, rightByte ...byte) []byte
- func TryCreateFileAndRenameIfFileExists(fileName string) (newfile *os.File, ret_err error)
- func TryStrToBool(str string, def bool) bool
- func TryStrToTime(str string, location *time.Location, def time.Time) time.Time
- func TryStrToTimeDefZero(str string, location *time.Location) (rval time.Time)
- func UInt16_BEBytes(val uint16) []byte
- func UInt16_FromBEBytes(buf []byte) uint16
- func UInt16_FromLEBytes(buf []byte) uint16
- func UInt16_LEBytes(val uint16) []byte
- func UInt32_BEBytes(val uint32) []byte
- func UInt32_FromBEBytes(buf []byte) uint32
- func UInt32_LEBytes(val uint32) []byte
- func UInt64_BEBytes(val uint64) []byte
- func UInt64_FromBEBytes(val []byte) uint64
- func UInt8ListToStrs(lst []byte, sep string) string
- func UnEscapeJSONStr(bvalue []byte) []byte
- func UnEscapeStr4Line(str string) string
- func WriteBuf_BE_Float64(val float64, outBuf []byte)
- func WriteBuf_LE_Float64(val float64, outBuf []byte)
- func XorBytes(buf []byte) byte
- type BytesBuilder
- func (b *BytesBuilder) AppendBufFromBase64Str(base64str string) (int, error)
- func (b *BytesBuilder) AppendBuilder(b0 *BytesBuilder)
- func (this *BytesBuilder) AppendFixedStr(s string, fixedw int, suffix string) *BytesBuilder
- func (this *BytesBuilder) AppendFixedStrWithZeroByte(s string, fixedw int) *BytesBuilder
- func (b *BytesBuilder) AppendIfNotEmpty(s string) *BytesBuilder
- func (b *BytesBuilder) AppendLine(s string) *BytesBuilder
- func (b *BytesBuilder) AppendRinexV(fv float64, digitN int, width int, zeroEmptyflag bool) *BytesBuilder
- func (b *BytesBuilder) AppendStr(s string) *BytesBuilder
- func (b *BytesBuilder) AppendStrPrefixForWidth(s string, width int, prefix string) *BytesBuilder
- func (b *BytesBuilder) AppendStrSuffixForWidth(s string, width int, suffix string) *BytesBuilder
- func (b *BytesBuilder) AppendStrs(strs ...string) *BytesBuilder
- func (b *BytesBuilder) AppendStrsWithSpliter(spliter string, strs ...string) *BytesBuilder
- func (b *BytesBuilder) Appendf(s string, args ...interface{}) *BytesBuilder
- func (b *BytesBuilder) Appendf_PrefixFixed(w int, prefix string, s string, args ...interface{}) *BytesBuilder
- func (b *BytesBuilder) Base64String() string
- func (b *BytesBuilder) BufAsHexStr(start, l int, spliter string) string
- func (this *BytesBuilder) Buff(start, l int) []byte
- func (this *BytesBuilder) BuffEx(start, endidx int) []byte
- func (this *BytesBuilder) BuffTrimRight(start, l int, rightBytes ...byte) []byte
- func (this *BytesBuilder) Byte(idx int) byte
- func (this *BytesBuilder) ByteOr(idx int, v byte) byte
- func (this *BytesBuilder) Bytes() []byte
- func (b *BytesBuilder) Cap() int
- func (b *BytesBuilder) CheckSize(startidx int, l int)
- func (b *BytesBuilder) Cleanup()
- func (this *BytesBuilder) Clone() *BytesBuilder
- func (this *BytesBuilder) CloneBuf() []byte
- func (this *BytesBuilder) CopyFrom(src *BytesBuilder) *BytesBuilder
- func (this *BytesBuilder) Delete(startidx, n int) *BytesBuilder
- func (this *BytesBuilder) Delete2End(idx int) *BytesBuilder
- func (b *BytesBuilder) GetBitI(startidx int, startBitN, l int) int
- func (b *BytesBuilder) GetBitU(startidx int, startBitN, l int) uint32
- func (b *BytesBuilder) GetBitU16(startidx int, startBitN, l int) uint16
- func (b *BytesBuilder) GetBitU64(startidx int, startBitN, l int) uint64
- func (b *BytesBuilder) GetBitUAsInt(startidx int, startBitN, l int) int
- func (b *BytesBuilder) Grow(n int)
- func (this *BytesBuilder) HasSuffix(suffix []byte) bool
- func (b *BytesBuilder) HexString(spliter string) string
- func (this *BytesBuilder) Index(startidx int, sub []byte) int
- func (this *BytesBuilder) IndexByte(startidx int, v byte) int
- func (this *BytesBuilder) IndexFunc(startidx int, fn func(v rune) bool) int
- func (this *BytesBuilder) Insert(startidx int, val []byte) *BytesBuilder
- func (this *BytesBuilder) InsertByte(startidx int, val byte) *BytesBuilder
- func (b *BytesBuilder) Len() int
- func (this *BytesBuilder) Replace(startidx int, val []byte) *BytesBuilder
- func (this *BytesBuilder) ReplaceUInt16_BE(startidx int, val uint16) *BytesBuilder
- func (this *BytesBuilder) ReplaceUInt16_LE(startidx int, val uint16) *BytesBuilder
- func (this *BytesBuilder) ReplaceUInt32_BE(startidx int, val uint32) *BytesBuilder
- func (this *BytesBuilder) ReplaceUInt32_LE(startidx int, val uint32) *BytesBuilder
- func (b *BytesBuilder) Reset()
- func (this *BytesBuilder) SaveToFile(fileName string) error
- func (b *BytesBuilder) SetBitI16(startidx int, startBitN int, l int, val int16)
- func (b *BytesBuilder) SetBitI32(startidx int, startBitN int, l int, val int32)
- func (b *BytesBuilder) SetBitI64(startidx int, startBitN int, l int, val int64)
- func (b *BytesBuilder) SetBitU16(startidx int, startBitN, l int, v uint16)
- func (b *BytesBuilder) SetBitU32(startidx int, startBitN, l int, v uint32)
- func (b *BytesBuilder) SetBitU64(startidx int, startBitN, l int, v uint64)
- func (b *BytesBuilder) SetBitU8(startidx int, startBitN, l int, v byte)
- func (b *BytesBuilder) StatusString() string
- func (this *BytesBuilder) Str2FixedBytes(s string, fixedw int) []byte
- func (b *BytesBuilder) String() string
- func (this *BytesBuilder) UInt64_BE(val uint64) *BytesBuilder
- func (this *BytesBuilder) Uint16_BE(startidx int) uint16
- func (this *BytesBuilder) Uint16_LE(startidx int) uint16
- func (this *BytesBuilder) Uint32_BE(startidx int) uint32
- func (this *BytesBuilder) Uint32_LE(startidx int) uint32
- func (this *BytesBuilder) Uint64_BE(startidx int) uint64
- func (b *BytesBuilder) Write(p []byte) (int, error)
- func (b *BytesBuilder) WriteByte(c byte) error
- func (b *BytesBuilder) WriteBytes(p ...byte)
- func (b *BytesBuilder) WriteRune(r rune) (int, error)
- func (b *BytesBuilder) WriteString(s string) (int, error)
- func (this *BytesBuilder) WriteUInt16_BE(val uint16) *BytesBuilder
- func (this *BytesBuilder) WriteUInt16_LE(val uint16) *BytesBuilder
- func (this *BytesBuilder) WriteUInt32_BE(val uint32) *BytesBuilder
- func (this *BytesBuilder) WriteUInt32_LE(val uint32) *BytesBuilder
- func (this *BytesBuilder) WriteUInt64_BE(val uint64) *BytesBuilder
- func (b *BytesBuilder) WriteWithHexStr(hexStr string, maxl int) int
- type CacheFile
- func (this *CacheFile) CheckOpen() error
- func (this *CacheFile) Close() error
- func (this *CacheFile) Flush()
- func (this *CacheFile) GetFileName() string
- func (this *CacheFile) GetFileSize() int
- func (this *CacheFile) Write(buf []byte) (int, error)
- func (this *CacheFile) WriteString(s string) (int, error)
- type ConnString
- type ConnectObjectRefStorage
- func (this *ConnectObjectRefStorage) CheckGetRef(connstr string) *ObjectInnerRef
- func (this *ConnectObjectRefStorage) GetStatus(args ...string) string
- func (this *ConnectObjectRefStorage) Range(filter func(obj interface{}) bool, lessfn func(iobj, jobj interface{}) bool, ...)
- func (this *ConnectObjectRefStorage) ReleaseRef(itm *ObjectInnerRef)
- type DElement
- type DLinkNode
- type DLinklist
- func (this *DLinklist) Append(node *DLinkNode)
- func (this *DLinklist) AppendValue(v interface{})
- func (this *DLinklist) Count() int32
- func (this *DLinklist) FetchNext() *DLinkNode
- func (this *DLinklist) FetchPre() *DLinkNode
- func (this *DLinklist) First() *DLinkNode
- func (this *DLinklist) InsertToFirst(node *DLinkNode)
- func (this *DLinklist) List() []interface{}
- func (this *DLinklist) Nodes() []*DLinkNode
- func (this *DLinklist) Range(cb func(val interface{}) bool) int
- func (this *DLinklist) RangeEx(cb func(idx int, val interface{}, removeit *bool) bool, ...) int
- func (this *DLinklist) Remove(node *DLinkNode) bool
- func (this *DLinklist) RemoveFirst() *DLinkNode
- func (this *DLinklist) RemoveLast() *DLinkNode
- func (this *DLinklist) SeekFirst() *DLinkNode
- func (this *DLinklist) SeekLast() *DLinkNode
- type DList
- func (l *DList) Back() *DElement
- func (l *DList) Front() *DElement
- func (l *DList) Init() *DList
- func (l *DList) InsertAfter(v interface{}, mark *DElement) *DElement
- func (l *DList) InsertBefore(v interface{}, mark *DElement) *DElement
- func (l *DList) Len() int
- func (l *DList) MoveAfter(e, mark *DElement)
- func (l *DList) MoveBefore(e, mark *DElement)
- func (l *DList) MoveToBack(e *DElement)
- func (l *DList) MoveToFront(e *DElement)
- func (l *DList) PushBack(v interface{}) *DElement
- func (l *DList) PushBackDList(other *DList)
- func (l *DList) PushFront(v interface{}) *DElement
- func (l *DList) PushFrontDList(other *DList)
- func (l *DList) Remove(e *DElement) interface{}
- type DiskStatus
- type EscapeError
- type ICheckStart
- type IStatusGet
- type InvalidHostError
- type ObjectInnerRef
- type ReadFileSession
- type StrMap
- func (this StrMap) CopyFrom(src StrMap)
- func (this StrMap) DeleteByKeylst(keylst ...string) (r int)
- func (this StrMap) Encode(kvspliter string, itmspliter string) string
- func (this StrMap) ExecReplace(s string) string
- func (this StrMap) Float64ByName(k string, def float64) float64
- func (this StrMap) Int16ByName(k string, def int16) int16
- func (this StrMap) Int8ByName(k string, def int8) int8
- func (this StrMap) IntByName(k string, def int) int
- func (this StrMap) ParseCmdArgs(args []string)
- func (this StrMap) ParseKVPairs(s string, kvsep string, itmsep string)
- func (this StrMap) ParseKVPairsEx(s string, kvsep string, itmsep string, keylower bool)
- func (this StrMap) Reset()
- func (this StrMap) SortRange(fn func(k, v string) bool)
- func (this StrMap) SortRangeEncode(kvspliter string, itmspliter string, fn func(k, v string) bool) string
- func (this StrMap) StringByName(k string, def string) string
- func (this StrMap) U8ByName(k string, def byte) byte
- func (this StrMap) URLFormDecode(s string)
- func (this StrMap) URLFormEncode() string
- func (this StrMap) URLFormEncodeKeylst(keylst ...string) string
- func (this StrMap) UnixTimeByName(k string, def time.Time) time.Time
- type SyncMap
- func (this *SyncMap) AsInt32(id interface{}, def int32) int32
- func (this *SyncMap) AsString(id interface{}, def string) string
- func (this *SyncMap) BatchSetFromStr(str string)
- func (this *SyncMap) Clear()
- func (this *SyncMap) Contain(id interface{}) bool
- func (this *SyncMap) Count() int
- func (this *SyncMap) CountFunc(fn func(k, v interface{}) bool) int
- func (this *SyncMap) Get(id interface{}, def interface{}) interface{}
- func (this *SyncMap) List() []interface{}
- func (this *SyncMap) ListEx(filter func(key, value interface{}) bool, ...) []interface{}
- func (this *SyncMap) ListRangeV2(filter func(key, value interface{}) bool, ...)
- func (this *SyncMap) ListRangeV3(filterflag, sortflag int, filter func(key, value interface{}) bool, ...)
- func (this *SyncMap) ListSorted(lessfunc func(iItm, jItm interface{}) bool) []interface{}
- func (this *SyncMap) LoadOrStore(id interface{}, store interface{}) (actual interface{}, loaded bool)
- func (this *SyncMap) LoadOrStoreFunc(id interface{}, newfunc func() interface{}, freefunc func(val interface{})) (actual interface{})
- func (this *SyncMap) LoadOrStoreFunc2(id interface{}, newfunc func() interface{}, freefunc func(val interface{})) (actual interface{}, loaded bool)
- func (this *SyncMap) PickFirst(filter func(key, value interface{}) bool, ...) interface{}
- func (this *SyncMap) Range(f func(key, value interface{}) bool)
- func (this *SyncMap) Remove(id interface{})
- func (this *SyncMap) RemoveAndGet(id interface{}) (val interface{}, ok bool)
- func (this *SyncMap) RemoveEx(id interface{}) bool
- func (this *SyncMap) Set(id interface{}, val interface{})
- func (this *SyncMap) Store(id interface{}, val interface{})
- func (this *SyncMap) ValAsString(spliter string, filter func(key, value interface{}) bool, ...) string
- func (this *SyncMap) ValAsString2(spliter string, filter func(key, value interface{}) bool, ordertype int) string
- type SyncQueue
- func (this *SyncQueue) Count() int32
- func (this *SyncQueue) Peek() (bool, interface{})
- func (this *SyncQueue) Pop() (bool, interface{})
- func (this *SyncQueue) PopTaskArgMaxFunc(max int, cb func(args interface{}) bool) int
- func (this *SyncQueue) Push(val interface{})
- func (this *SyncQueue) Range(cb func(idx int, value interface{}, removeit *bool) bool)
- func (this *SyncQueue) Reset()
Constants ¶
const ( U8_1 byte = 1 U8_0 byte = 0 U8_MAX byte = ^U8_0 U32_1 uint32 = 1 U32_0 uint32 = 0 U64_0 uint64 = 0 I64_1 int64 = 1 U64_1 uint64 = 1 U64_MAX uint64 = ^U64_0 )
const ( EMPTY_STRING string = "" QUOTECHR = '"' )
const (
DURA_DAY time.Duration = time.Hour * 24
)
Variables ¶
var ( GoFunCatchException bool = true OnCatchAllPanic func(err interface{}, args ...interface{}) )
var ( PathSeparator = "\\" RootPath = "" )
var ( SIZE_KB uint64 = 1024 SIZE_MB = 1024 * SIZE_KB SIZE_GB = 1024 * SIZE_MB SIZE_TB = 1024 * SIZE_GB )
var ( ZeroTime time.Time // UTC ZeroTimeLocal = ZeroTime.Local() START_Time time.Time = StrToTimeDef("00", "04", time.UTC, ZeroTime) START_Duration time.Duration = ParseDuration("0s") UnixZeroTime time.Time = time.Unix(0, 0).Local() // 默认是Local )
var (
ErrUnsupported = fmt.Errorf("unsupported")
)
var (
SPACE_BYTES []byte = []byte(" ")
)
Functions ¶
func BytesAppendUInt64_LE ¶
func BytesCheckGrow ¶
Grow grows b's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to b without another allocation. If n is negative, Grow panics.
func BytesCheckSize ¶
func CheckAddPrefix ¶
func CheckAddQuoteChr ¶
func CheckAddSuffix ¶
func CheckAllStrsIsNotEmpty ¶
func CheckByteIn ¶
func CheckGetValInlst ¶
func CheckGetValInlst(lst []interface{}, idx int, def interface{}) interface{}
func CheckRotateFileAfterCreateFile ¶
- 如果文件已经存在, 则对之前的文件进行更名, 更名失败 返回异常
- 更名成功则创建新文件的os.file. 创建成功则返回, 失败,进行重试, 超过10次返回异常 创建的文件成功会被清空
func CheckTrimPrefix ¶
func CheckTrimSuffix ¶
func CmpAndSetBitValue ¶
func CmpAndSetBitValue(ival uint64, bitN byte, cmpbitVal, newbitVal byte) (changed bool, newval uint64)
**
bitN 从0开始 cmpbitVal, newbitVal, 只能是0或者1 比较低bitN是否为cmpbitval, 如果是则进行设置为newbitval changed :true, 表示有修改
func CombineFilePath ¶
func CombineIfFirstNotEmpty ¶
func CombineIfNotEmpty ¶
func CutNPrefixFunc ¶
func CutNSuffixFunc ¶
func CutPrefixByRune ¶
**
idx 从0开始 "/", "中国/人民", CutPrefixByRune("/中国/人民", 0, 1, "/") "/中国/", "人民", CutPrefixByRune("/中国/人民", 1, 1, "/")
func CutPrefixFunc ¶
func CutPrefixFunc(s string, cutflag byte, CheckCutBreakFunc func(c rune) bool) (cut string, remain string)
*
如果CheckCutBreakFunc 一直为false, cut则返回"", remain则返回源字符串 返回true表示从该字符进行截断 cutflag 0: "中国/人","民" cutflag 1: "中国/人民","" str := "中国/人民"; plug, remain := CutPrefixFunc(str, 0, func(c rune) bool { if c == '民'{ return true; } return false; }) cutflag 0: "中国","/人民" cutflag 1: "中国","/人民" str := "中国/人民"; plug, remain := CutPrefixFunc(str, 0, func(c rune) bool { if c == '/'{ return true; } return false; }) fmt.Println(CutPrefixFunc("../abc.txt", 1, func(c rune) bool { if c == '.' || c=='/'{ return false; } return true; })) ../, abc.txt
func CutSuffixByRune ¶
**
idx 从0开始 "/人民", "/中国", CutSuffixByRune("/中国/人民", 0, 1, "/") "/中国/人民", "", CutSuffixByRune("/中国/人民", 1, 1, "/")
func CutSuffixFunc ¶
func CutSuffixFunc(s string, cutflag byte, CheckCutBreakFunc func(c rune) bool) (cut string, remain string)
**
如果CheckCutBreakFunc 一直为false, cut则返回"", remain则返回源字符串
func DateString ¶
func DateTimeIDString ¶
func DateTimeString ¶
func DateTimeString3 ¶
func DateTimeStringForShow ¶
func DateYYYYMM ¶
func DateYYYYMMDD ¶
func DecimalToAny ¶
inttohex DecimalToAny(113, 16, 2) = 71
func DecodeCRCBuf ¶
func DeferCatchPanic ¶
func DeferCatchPanic(args ...interface{})
func DelNonAsciiChar ¶
func DelNonAsciiCharEx ¶
func DelNonChineseCharEx ¶
func DelNonPrintChar ¶
func DeleteFileNameExt ¶
func DurationStr ¶
StatusString returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s. 去掉了秒的小数
func EnablePanicRecordFile ¶
func EnablePanicRecordFile(logpath string)
func EncodeCRCBuf ¶
func EscapeJsonStrSimple ¶
func EscapeSQLStr ¶
func EscapeStr4Line ¶
func ExecCmdLine ¶
func ExecShellAndNoWait ¶
func ExecShellOutput ¶
func ExecShellWithIO ¶
* sb := NewBytesBuilder() ExecShellWithIO("dir c:\\*.*", nil, sb, sb) sb.StatusString();
func ExtractFilePath ¶
func FastByte2String ¶
func FileIsExists ¶
exists returns whether the given file or directory exists or not
func FileNameAddfix ¶
func FixintervalLastTime ¶
*
FixIntervalLastTime("2020-06-05 13:13:29", time.Minute * 15) = 2020-06-05 13:00:00
func FixintervalNextTime ¶
*
FixIntervalNextTime("2020-06-05 13:13:29", time.Minute * 15) = 2020-06-05 13:15:00
func FixintervalOffsetTime ¶
*
FixintervalOffsetTime("2020-06-05 13:13:29", time.Minute * 15, 0) = 2020-06-05 13:00:00
func Float32ToStr ¶
func ForceAllPath ¶
func ForceCreateFilePath ¶
func ForceCreatePath ¶
func FormatFloatVlst ¶
FormatFloatVlst
func GetBetween ¶
`<td>a</td><td>b</td>` GetBetween(str, "<td>", "</td>") = a
GetBetween("$now$", "$", "$") = "now"
func GetBetweenEx ¶
`<td>a</td><td>b</td>` GetBetween(str, "<td>", "</td>") = a
GetBetween("$now$", "$", "$") = "now"
func GetBitOnU64 ¶
func GetBitV_U64 ¶
func GetBoolValue ¶
func GetCurrentDirectory ¶
func GetCurrentGoRoutineID ¶
func GetCurrentGoRoutineID() uint64
func GetDayOfWeek ¶
func GetExecShellCmd ¶
func GetFirstFromVars ¶
func GetFirstFromVars(arg interface{}) interface{}
*
如果arg 是切片[]interface 则获取第一个元素
func GetFloat64Value ¶
func GetIdxIntValFromVars ¶
func GetIdxStrValFromVarsDef ¶
func GetIdxValFromVars ¶
func GetIdxValFromVars(arg interface{}, idx int) interface{}
*
如果arg 是切片[]interface 则获取第idx元素 idx 从0开始
func GetIdxValFromVarsDef ¶
func GetIdxValFromVarsDef(arg interface{}, idx int, def interface{}) interface{}
func GetInt32Value ¶
func GetInt64Value ¶
func GetLastNumStr ¶
func GetMonthDayN ¶
func GetRelativePath ¶
**
求两个绝对路径的相对路径 写一个函数计算出两个绝对路径(如path1 = /a/b/c/d, path2 = /a/e/f)的相对路径为 ../../e/f
func GetStrValue ¶
func GetU64BitsU ¶
**
获取v 的位数 的值 binary: 0010 1101 GetU64BitsU(v, 2, 3) = binary: 11 从startBit到endBit 包含endBit startBit 从0开始计数
func GetU8BitValue0 ¶
func HEX2BCDDef ¶
func HexStrToBuf ¶
func HumanDuration ¶
func HumanFilesize ¶
func HumanFilesizeU ¶
func HumanTimeStr ¶
func HumanTimeStrFromMinutes ¶
func InsertBeforeLineFile ¶
func Int64_BEBytes ¶
func Int64_FromBEBytes ¶
func Int8ListToStrs ¶
func IsAsciiPrintChar ¶
func IsAsciiPrintStr ¶
func IsChineseChar ¶
* 字符集 字数 Unicode 编码 基本汉字 20902字 4E00-9FA5 // 一 ~ 龥 (简繁) 基本汉字补充 90字 9FA6-9FFF 扩展A 6592字 3400-4DBF 扩展B 42720字 20000-2A6DF 扩展C 4153字 2A700-2B738 扩展D 222字 2B740-2B81D 扩展E 5762字 2B820-2CEA1 扩展F 7473字 2CEB0-2EBE0 扩展G 4939字 30000-3134A 康熙部首 214字 2F00-2FD5 部首扩展 115字 2E80-2EF3 兼容汉字 477字 F900-FAD9 兼容扩展 542字 2F800-2FA1D PUA(GBK)部件 81字 E815-E86F 部件扩展 452字 E400-E5E8 PUA增补 207字 E600-E6CF 汉字笔画 36字 31C0-31E3 汉字结构 12字 2FF0-2FFB 汉语注音 43字 3105-312F 注音扩展 22字 31A0-31BA 〇 1字 3007
func IsLeapYear ¶
func IsPrintStr ¶
func IsSameMonth ¶
func LastChrCnt ¶
func MD5SumFile ¶
func MSecOfDuration ¶
func MillisecondOf ¶
func MinuteOfDuration ¶
func NextMonthV ¶
func NextMonthYM ¶
func NowIDString ¶
func NowIDString() string
func NowStringEx ¶
func NowStringEx() string
func PanicRecordFile ¶
func PanicRecordFile(err interface{}, args ...interface{})
func ParseDuraStr ¶
func ParseDuration ¶
func ParserJsonEscapeStr ¶
解码转义字符,将"\u6821\u56ed\u7f51\t02%20得闲"这类字符串,解码成正常显示的字符串
func PathEscape ¶
PathEscape escapes the string so it can be safely placed inside a URL path segment, replacing special characters (including /) with %XX sequences as needed.
func PathExists ¶
** 如果返回的错误为nil,说明文件或文件夹存在 如果返回的错误类型使用os.IsNotExist()判断为true,说明文件或文件夹不存在 如果返回的错误为其它类型,则不确定是否在存在
func PathUnescape ¶
PathUnescape does the inverse transformation of PathEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.
PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).
func QueryEscape ¶
QueryEscape escapes the string so it can be safely placed inside a URL query.
func QueryUnescape ¶
QueryUnescape does the inverse transformation of QueryEscape, converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.
func RandFloat64 ¶
func RandNumString ¶
func RandNumStringWithout4 ¶
func RandPass0String ¶
func RangeFiles ¶
func RangeFiles(path string, maxlevel int, fn func(path string, file os.FileInfo) bool, onerr func(dirname string, err error) bool) error
**
Range path下的文件和目录 maxlevel 表示目录层级 0: 表示搜索所有 1:表示获取当前目录(不会进入下一级目录) fn: 如果返回 false 表示退出当前目录搜索, path为当前文件所在路径 onerr 返回false 则返回退出当前目录的range
func RangeStringSep ¶
**
RangeStringSep("a01;a02", ';', fn); // 2次 RangeStringSep("a01", ';', fn); // 1次 RangeStringSep("a01;", ';', fn); // 1次 RangeStringSep("a01;;", ';', fn); // 2次
func RangeStringSplit ¶
* RangeStringSplit("a\r\n汉字b\r\n", "\r\n", func)
func ReadDir ¶
ReadDir reads the directory named by dirname and returns a list of directory without sort.
func ReadFileBlockBuf ¶
func ReadFileBlockBuf(fileName string, cb func(block []byte) bool, makebuffunc func() []byte) (int64, error)
**
func ReadFileBlockBufOffset ¶
func ReadFileBlockBufOffset(fileName string, offset int64, cb func(block []byte) bool, makebuffunc func() []byte) (int64, error)
**
func ReadLBytes ¶
读取指定长度的数据, 直到返回错误或者读取完成 l:=0 表示读取buf的长度
func ReadPerLine ¶
func ReadPerLineEx ¶
func ReadPerLineFile ¶
func RenameFile ¶
func ReplaceArea ¶
* 忽略大小写
`<td>a</td><td>b</td>` ReplaceArea(str, "<td>", "</td>", "<td>abc</td>") = <td>abc</td><td>abc</td>
func ReplaceMultiAny2One ¶
*
ReplaceMultiAny2One("a b c d ", " ", ":"); -> "a:b:c:d:" ReplaceMultiAny2One("a b c d "," "," ")->"a b c d " ReplaceMultiAny2One("ababaaa aab ac d aaa ","ab","x")->"xaaa ax ac d aaa " ReplaceMultiAny2One("aaaaa aab ac d aaa ", "aa", "x")->"xa xb ac d xa"
func ReplaceNonAsciiChar ¶
func ReplaceNonPrintChar ¶
func RewriteFile ¶
func SearchAFile ¶
func SearchAFile(path string, currlevel, maxlevel int, comparefunc func(cmp, cur os.FileInfo, cmppath, curpath string) bool, onerr func(dirname string, err error) bool) (string, error)
*
- 查找符合条件的第一个文件
- comparefunc 返回true表示 cur比cmp文件更符合条件. cmp可能为空表示还没有查找到符合条件的文件, 判断时需要注意
func SearchAFileEx ¶
func SearchAFileEx(path string, currlevel, maxlevel int, comparefunc func(cmp, cur os.FileInfo, cmppath, curpath string) bool, onerr func(dirname string, err error) bool) (string, os.FileInfo)
*
- 查找符合条件的第一个文件
- comparefunc 返回true表示 cur比cmp文件更符合条件. cmp可能为空表示还没有查找到符合条件的文件, 判断时需要注意
func SearchFiles ¶
func SecondBetween ¶
func SetBitValue ¶
/ 设置位上的值 / SetBitValue(0, 2, true) = 二进制(10)
func SetBitValue0 ¶
/ 设置位上的值 0:位第一位 / SetBitValue(0, 1, true) = 二进制(10)
func SetLogOutput ¶ added in v1.2.24051
func SetU8BitValue0 ¶
/ 设置位上的值 0:位第一位 / SetU8BitValue0(0, 1, true) = 二进制(10)
func Split2StrV1 ¶
func SplitNumericAndRemain ¶
func SplitStrWidth ¶
func StrIndexIgnoreCase ¶
func StrTo3Float64 ¶
func StrToFloat32Def ¶
func StrToFloat64Def ¶
func StrToInt64Def ¶
func StrToInt8Def ¶
func StrToInt8List ¶
func StrToIntDef ¶
func StrToTimeDef ¶
func StrToUInt8List ¶
func StringsRangeFunc ¶
func SyncMapLength ¶
func TimeString3 ¶
func TodayIDString ¶
func TodayIDString() string
func TrimPrefixBytes ¶
func TrimRightBytes ¶
func TryCreateFileAndRenameIfFileExists ¶
*
- 如果filename存在,
- 尝试对filename进行重命名, 然后创建一个新的file
- 如果重命名失败,则使用一个新的文件名
func TryStrToBool ¶
func TryStrToTimeDefZero ¶
func UInt16_BEBytes ¶
func UInt16_FromBEBytes ¶
func UInt16_FromLEBytes ¶
func UInt16_LEBytes ¶
func UInt32_BEBytes ¶
func UInt32_FromBEBytes ¶
func UInt32_LEBytes ¶
func UInt64_FromBEBytes ¶
func UInt8ListToStrs ¶
func UnEscapeJSONStr ¶
func UnEscapeStr4Line ¶
func WriteBuf_BE_Float64 ¶
func WriteBuf_LE_Float64 ¶
Types ¶
type BytesBuilder ¶
type BytesBuilder struct {
// contains filtered or unexported fields
}
func NewBytesBuilder ¶
func NewBytesBuilder() *BytesBuilder
func (*BytesBuilder) AppendBufFromBase64Str ¶
func (b *BytesBuilder) AppendBufFromBase64Str(base64str string) (int, error)
func (*BytesBuilder) AppendBuilder ¶
func (b *BytesBuilder) AppendBuilder(b0 *BytesBuilder)
func (*BytesBuilder) AppendFixedStr ¶
func (this *BytesBuilder) AppendFixedStr(s string, fixedw int, suffix string) *BytesBuilder
**
- 添加 固定宽度的Buf, 如果字符串不够则后面补suffix, 如果超过长度则进行截取
func (*BytesBuilder) AppendFixedStrWithZeroByte ¶
func (this *BytesBuilder) AppendFixedStrWithZeroByte(s string, fixedw int) *BytesBuilder
**
- 添加 固定宽度的Buf, 如果字符串不够则后面补0, 如果超过长度则进行截取
func (*BytesBuilder) AppendIfNotEmpty ¶
func (b *BytesBuilder) AppendIfNotEmpty(s string) *BytesBuilder
func (*BytesBuilder) AppendLine ¶
func (b *BytesBuilder) AppendLine(s string) *BytesBuilder
func (*BytesBuilder) AppendRinexV ¶
func (b *BytesBuilder) AppendRinexV(fv float64, digitN int, width int, zeroEmptyflag bool) *BytesBuilder
* [723994.1970]->[ 723994.1970]
func (*BytesBuilder) AppendStr ¶
func (b *BytesBuilder) AppendStr(s string) *BytesBuilder
func (*BytesBuilder) AppendStrPrefixForWidth ¶
func (b *BytesBuilder) AppendStrPrefixForWidth(s string, width int, prefix string) *BytesBuilder
func (*BytesBuilder) AppendStrSuffixForWidth ¶
func (b *BytesBuilder) AppendStrSuffixForWidth(s string, width int, suffix string) *BytesBuilder
func (*BytesBuilder) AppendStrs ¶
func (b *BytesBuilder) AppendStrs(strs ...string) *BytesBuilder
func (*BytesBuilder) AppendStrsWithSpliter ¶
func (b *BytesBuilder) AppendStrsWithSpliter(spliter string, strs ...string) *BytesBuilder
func (*BytesBuilder) Appendf ¶
func (b *BytesBuilder) Appendf(s string, args ...interface{}) *BytesBuilder
func (*BytesBuilder) Appendf_PrefixFixed ¶
func (b *BytesBuilder) Appendf_PrefixFixed(w int, prefix string, s string, args ...interface{}) *BytesBuilder
func (*BytesBuilder) Base64String ¶
func (b *BytesBuilder) Base64String() string
func (*BytesBuilder) BufAsHexStr ¶
func (b *BytesBuilder) BufAsHexStr(start, l int, spliter string) string
func (*BytesBuilder) Buff ¶
func (this *BytesBuilder) Buff(start, l int) []byte
func (*BytesBuilder) BuffEx ¶
func (this *BytesBuilder) BuffEx(start, endidx int) []byte
func (*BytesBuilder) BuffTrimRight ¶
func (this *BytesBuilder) BuffTrimRight(start, l int, rightBytes ...byte) []byte
func (*BytesBuilder) Byte ¶
func (this *BytesBuilder) Byte(idx int) byte
func (*BytesBuilder) Bytes ¶
func (this *BytesBuilder) Bytes() []byte
func (*BytesBuilder) Cap ¶
func (b *BytesBuilder) Cap() int
Cap returns the capacity of the builder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written.
func (*BytesBuilder) CheckSize ¶
func (b *BytesBuilder) CheckSize(startidx int, l int)
func (*BytesBuilder) Clone ¶
func (this *BytesBuilder) Clone() *BytesBuilder
func (*BytesBuilder) CloneBuf ¶
func (this *BytesBuilder) CloneBuf() []byte
func (*BytesBuilder) CopyFrom ¶
func (this *BytesBuilder) CopyFrom(src *BytesBuilder) *BytesBuilder
func (*BytesBuilder) Delete2End ¶
func (this *BytesBuilder) Delete2End(idx int) *BytesBuilder
func (*BytesBuilder) GetBitI ¶
func (b *BytesBuilder) GetBitI(startidx int, startBitN, l int) int
** 按照大端法读取数据位作为返回值
func (*BytesBuilder) GetBitU ¶
func (b *BytesBuilder) GetBitU(startidx int, startBitN, l int) uint32
** 按照大端法读取数据位作为返回值
func (*BytesBuilder) GetBitU16 ¶
func (b *BytesBuilder) GetBitU16(startidx int, startBitN, l int) uint16
func (*BytesBuilder) GetBitU64 ¶
func (b *BytesBuilder) GetBitU64(startidx int, startBitN, l int) uint64
** 按照大端法读取数据位作为返回值
func (*BytesBuilder) GetBitUAsInt ¶
func (b *BytesBuilder) GetBitUAsInt(startidx int, startBitN, l int) int
func (*BytesBuilder) Grow ¶
func (b *BytesBuilder) Grow(n int)
Grow grows b's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to b without another allocation. If n is negative, Grow panics.
func (*BytesBuilder) HasSuffix ¶
func (this *BytesBuilder) HasSuffix(suffix []byte) bool
func (*BytesBuilder) HexString ¶
func (b *BytesBuilder) HexString(spliter string) string
func (*BytesBuilder) IndexFunc ¶
func (this *BytesBuilder) IndexFunc(startidx int, fn func(v rune) bool) int
func (*BytesBuilder) Insert ¶
func (this *BytesBuilder) Insert(startidx int, val []byte) *BytesBuilder
**
func (*BytesBuilder) InsertByte ¶
func (this *BytesBuilder) InsertByte(startidx int, val byte) *BytesBuilder
**
func (*BytesBuilder) Len ¶
func (b *BytesBuilder) Len() int
Len returns the number of accumulated bytes; b.Len() == len(b.StatusString()).
func (*BytesBuilder) Replace ¶
func (this *BytesBuilder) Replace(startidx int, val []byte) *BytesBuilder
**
func (*BytesBuilder) ReplaceUInt16_BE ¶
func (this *BytesBuilder) ReplaceUInt16_BE(startidx int, val uint16) *BytesBuilder
**
- 大端法写入uint16
func (*BytesBuilder) ReplaceUInt16_LE ¶
func (this *BytesBuilder) ReplaceUInt16_LE(startidx int, val uint16) *BytesBuilder
**
- 小端法写入uint16
func (*BytesBuilder) ReplaceUInt32_BE ¶
func (this *BytesBuilder) ReplaceUInt32_BE(startidx int, val uint32) *BytesBuilder
**
- 大端法写入uint32
func (*BytesBuilder) ReplaceUInt32_LE ¶
func (this *BytesBuilder) ReplaceUInt32_LE(startidx int, val uint32) *BytesBuilder
func (*BytesBuilder) Reset ¶
func (b *BytesBuilder) Reset()
Reset resets the Builder to be empty. *
重置数据, 添加数据时会添加新的内存块
func (*BytesBuilder) SaveToFile ¶
func (this *BytesBuilder) SaveToFile(fileName string) error
func (*BytesBuilder) SetBitI16 ¶
func (b *BytesBuilder) SetBitI16(startidx int, startBitN int, l int, val int16)
func (*BytesBuilder) SetBitI32 ¶
func (b *BytesBuilder) SetBitI32(startidx int, startBitN int, l int, val int32)
func (*BytesBuilder) SetBitI64 ¶
func (b *BytesBuilder) SetBitI64(startidx int, startBitN int, l int, val int64)
func (*BytesBuilder) SetBitU16 ¶
func (b *BytesBuilder) SetBitU16(startidx int, startBitN, l int, v uint16)
func (*BytesBuilder) SetBitU32 ¶
func (b *BytesBuilder) SetBitU32(startidx int, startBitN, l int, v uint32)
func (*BytesBuilder) SetBitU64 ¶
func (b *BytesBuilder) SetBitU64(startidx int, startBitN, l int, v uint64)
**
按照大端法写入数据
func (*BytesBuilder) SetBitU8 ¶
func (b *BytesBuilder) SetBitU8(startidx int, startBitN, l int, v byte)
func (*BytesBuilder) StatusString ¶
func (b *BytesBuilder) StatusString() string
func (*BytesBuilder) Str2FixedBytes ¶
func (this *BytesBuilder) Str2FixedBytes(s string, fixedw int) []byte
字符串到固定长度字符, 如果不够, 后面补0
func (*BytesBuilder) String ¶
func (b *BytesBuilder) String() string
StatusString returns the accumulated string.
func (*BytesBuilder) UInt64_BE ¶
func (this *BytesBuilder) UInt64_BE(val uint64) *BytesBuilder
**
- 大端法写入uint64
func (*BytesBuilder) Uint16_BE ¶
func (this *BytesBuilder) Uint16_BE(startidx int) uint16
**
- 大端法读取uint16
func (*BytesBuilder) Uint16_LE ¶
func (this *BytesBuilder) Uint16_LE(startidx int) uint16
**
- 小端法读取uint16
func (*BytesBuilder) Uint32_BE ¶
func (this *BytesBuilder) Uint32_BE(startidx int) uint32
**
- 大端法读取uint32
func (*BytesBuilder) Uint32_LE ¶
func (this *BytesBuilder) Uint32_LE(startidx int) uint32
**
- 小端法读取uint32
func (*BytesBuilder) Uint64_BE ¶
func (this *BytesBuilder) Uint64_BE(startidx int) uint64
**
- 大端法读取uint32
func (*BytesBuilder) Write ¶
func (b *BytesBuilder) Write(p []byte) (int, error)
Write appends the contents of p to b's buffer. Write always returns len(p), nil.
func (*BytesBuilder) WriteByte ¶
func (b *BytesBuilder) WriteByte(c byte) error
WriteByte appends the byte c to b's buffer. The returned error is always nil.
func (*BytesBuilder) WriteBytes ¶
func (b *BytesBuilder) WriteBytes(p ...byte)
func (*BytesBuilder) WriteRune ¶
func (b *BytesBuilder) WriteRune(r rune) (int, error)
WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. It returns the length of r and a nil error.
func (*BytesBuilder) WriteString ¶
func (b *BytesBuilder) WriteString(s string) (int, error)
WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.
func (*BytesBuilder) WriteUInt16_BE ¶
func (this *BytesBuilder) WriteUInt16_BE(val uint16) *BytesBuilder
**
- 大端法写入uint16 最高有效字节在低位的方式称为大端法 Write_LE(0x0102) HexString : 01 02
func (*BytesBuilder) WriteUInt16_LE ¶
func (this *BytesBuilder) WriteUInt16_LE(val uint16) *BytesBuilder
**
- 小端法写入uint16
- Write_LE(0x0102) HexString : 02 01
func (*BytesBuilder) WriteUInt32_BE ¶
func (this *BytesBuilder) WriteUInt32_BE(val uint32) *BytesBuilder
**
- 大端法写入uint32
func (*BytesBuilder) WriteUInt32_LE ¶
func (this *BytesBuilder) WriteUInt32_LE(val uint32) *BytesBuilder
**
- 小端法写入uint32
func (*BytesBuilder) WriteUInt64_BE ¶
func (this *BytesBuilder) WriteUInt64_BE(val uint64) *BytesBuilder
**
- 大端法写入uint64
func (*BytesBuilder) WriteWithHexStr ¶
func (b *BytesBuilder) WriteWithHexStr(hexStr string, maxl int) int
type CacheFile ¶
type CacheFile struct {
// contains filtered or unexported fields
}
func NewCacheFile ¶
func (*CacheFile) GetFileName ¶ added in v1.2.24013
func (*CacheFile) GetFileSize ¶ added in v1.2.24051
type ConnString ¶ added in v1.2.24041
func ParseConnString ¶ added in v1.2.24041
func ParseConnString(str string) (rval ConnString)
func (*ConnString) Parse ¶ added in v1.2.24041
func (this *ConnString) Parse(str string)
func (ConnString) String ¶ added in v1.2.24041
func (this ConnString) String() string
type ConnectObjectRefStorage ¶ added in v1.2.24041
type ConnectObjectRefStorage struct {
// contains filtered or unexported fields
}
连接对象管理, 借出去对象被+1, 归还-1 =0:释放
func NewConnectObjectRefStorage ¶ added in v1.2.24041
func NewConnectObjectRefStorage(newfun func(connstr string) interface{}) *ConnectObjectRefStorage
func (*ConnectObjectRefStorage) CheckGetRef ¶ added in v1.2.24041
func (this *ConnectObjectRefStorage) CheckGetRef(connstr string) *ObjectInnerRef
func (*ConnectObjectRefStorage) GetStatus ¶ added in v1.2.24041
func (this *ConnectObjectRefStorage) GetStatus(args ...string) string
func (*ConnectObjectRefStorage) Range ¶ added in v1.2.24041
func (this *ConnectObjectRefStorage) Range(filter func(obj interface{}) bool, lessfn func(iobj, jobj interface{}) bool, fn func(obj interface{}) bool)
func (*ConnectObjectRefStorage) ReleaseRef ¶ added in v1.2.24041
func (this *ConnectObjectRefStorage) ReleaseRef(itm *ObjectInnerRef)
type DElement ¶
type DElement struct { // The DList to which this DElement belongs. DList *DList // The value stored with this DElement. Value interface{} // contains filtered or unexported fields }
DElement is an DElement of a linked DList.
func (*DElement) RemoveFromDList ¶
func (e *DElement) RemoveFromDList()
type DLinkNode ¶
type DLinkNode struct { Value interface{} // contains filtered or unexported fields }
func NewDlinknode ¶
func NewDlinknode() *DLinkNode
func NewDlinknodeFromPool ¶
func NewDlinknodeFromPool() *DLinkNode
type DLinklist ¶
type DLinklist struct {
// contains filtered or unexported fields
}
func NewDlinklist ¶
func NewDlinklist() *DLinklist
func (*DLinklist) AppendValue ¶
func (this *DLinklist) AppendValue(v interface{})
func (*DLinklist) RangeEx ¶
func (this *DLinklist) RangeEx(cb func(idx int, val interface{}, removeit *bool) bool, onremove func(node *DLinkNode)) int
*
- 循环
type DList ¶
type DList struct {
// contains filtered or unexported fields
}
DList represents a doubly linked DList. The zero value for DList is an empty DList ready to use.
func (*DList) InsertAfter ¶
InsertAfter inserts a new DElement e with value v immediately after mark and returns e. If mark is not an DElement of l, the DList is not modified.
func (*DList) InsertBefore ¶
InsertBefore inserts a new DElement e with value v immediately before mark and returns e. If mark is not an DElement of l, the DList is not modified.
func (*DList) MoveAfter ¶
MoveAfter moves DElement e to its new position after mark. If e or mark is not an DElement of l, or e == mark, the DList is not modified.
func (*DList) MoveBefore ¶
MoveBefore moves DElement e to its new position before mark. If e or mark is not an DElement of l, or e == mark, the DList is not modified.
func (*DList) MoveToBack ¶
MoveToBack moves DElement e to the back of DList l. If e is not an DElement of l, the DList is not modified.
func (*DList) MoveToFront ¶
MoveToFront moves DElement e to the front of DList l. If e is not an DElement of l, the DList is not modified.
func (*DList) PushBack ¶
PushBack inserts a new DElement e with value v at the back of DList l and returns e.
func (*DList) PushBackDList ¶
PushBackDList inserts a copy of an other DList at the back of DList l. The DLists l and other may be the same.
func (*DList) PushFront ¶
PushFront inserts a new DElement e with value v at the front of DList l and returns e.
func (*DList) PushFrontDList ¶
PushFrontDList inserts a copy of an other DList at the front of DList l. The DLists l and other may be the same.
type DiskStatus ¶
type DiskStatus struct { All uint64 `json:"all"` Used uint64 `json:"used"` Free uint64 `json:"free"` }
func (DiskStatus) FreePercentStr ¶
func (this DiskStatus) FreePercentStr(n int) string
type EscapeError ¶
type EscapeError string
func (EscapeError) Error ¶
func (e EscapeError) Error() string
type ICheckStart ¶ added in v1.2.24052
type ICheckStart interface {
CheckStart() error
}
type IStatusGet ¶ added in v1.2.24041
type InvalidHostError ¶
type InvalidHostError string
func (InvalidHostError) Error ¶
func (e InvalidHostError) Error() string
type ObjectInnerRef ¶ added in v1.2.24041
type ObjectInnerRef struct {
// contains filtered or unexported fields
}
func (*ObjectInnerRef) CheckStart ¶ added in v1.2.24052
func (this *ObjectInnerRef) CheckStart() error
func (*ObjectInnerRef) GetObject ¶ added in v1.2.24041
func (this *ObjectInnerRef) GetObject() interface{}
func (*ObjectInnerRef) ReleaseRef ¶ added in v1.2.24052
func (this *ObjectInnerRef) ReleaseRef() int
type ReadFileSession ¶
type ReadFileSession struct {
// contains filtered or unexported fields
}
func NewReadFileSession ¶
func NewReadFileSession(filename string) *ReadFileSession
func (*ReadFileSession) Close ¶
func (this *ReadFileSession) Close() error
func (*ReadFileSession) CloseFlag ¶
func (this *ReadFileSession) CloseFlag() int8
func (*ReadFileSession) ErrFlag ¶
func (this *ReadFileSession) ErrFlag() int8
func (*ReadFileSession) Reset ¶
func (this *ReadFileSession) Reset()
type StrMap ¶
func NewStrMapEx ¶
func NewStrMapFromURLStr ¶ added in v1.2.24041
func (StrMap) DeleteByKeylst ¶ added in v1.2.24052
func (StrMap) ExecReplace ¶
ExecReplace 利用映射关系进行替换, key -> value
func (StrMap) ParseKVPairsEx ¶
func (StrMap) SortRangeEncode ¶
func (StrMap) URLFormDecode ¶
func (StrMap) URLFormEncode ¶
func (StrMap) URLFormEncodeKeylst ¶ added in v1.2.24052
type SyncMap ¶
type SyncMap struct {
// contains filtered or unexported fields
}
*
- 可以单独使用
func (*SyncMap) ListRangeV2 ¶
func (*SyncMap) ListRangeV3 ¶
func (*SyncMap) ListSorted ¶
func (*SyncMap) LoadOrStore ¶
func (*SyncMap) LoadOrStoreFunc ¶
func (this *SyncMap) LoadOrStoreFunc(id interface{}, newfunc func() interface{}, freefunc func(val interface{})) (actual interface{})
func (*SyncMap) LoadOrStoreFunc2 ¶
func (*SyncMap) RemoveAndGet ¶
func (*SyncMap) ValAsString ¶
type SyncQueue ¶
type SyncQueue struct {
// contains filtered or unexported fields
}
func NewSyncQueue ¶
func NewSyncQueue() *SyncQueue