Documentation
¶
Index ¶
- Constants
- Variables
- func Abs[T Number](n T) T
- func AbsInt16(n int16) int16
- func AbsInt32(n int32) int32
- func AbsInt64(n int64) int64
- func AbsInt8(n int8) int8
- func AddRemain[T Number](oldNum, addNum, numMax T) (newNum, added, remained T)
- func AtoInt(s string) (int, error)
- func AtoInt32(s string) (int32, error)
- func AtoInt64(s string) (x int64, err error)
- func BytesPtrToStr(bs []byte) string
- func Caller(skip int) (file string, line int)
- func CallerInFunc(skip int) (name string, file string, line int)
- func CallerLineStack(stack string) (name string, file string)
- func CallerShort(skip int) (file string, line int)
- func DumpJson(v interface{}, indent bool) string
- func Exception(catch ...func(stack string, e error))
- func ExceptionError(catch func(e error))
- func Format(format string, sign, startByte, endByte byte, kws KwArgs, ignore bool) string
- func GetBitByte(v byte, offset int) bool
- func GetBitUint16(v uint16, offset int) bool
- func GetBitUint32(v uint32, offset int) bool
- func GetBitUint64(v uint64, offset int) bool
- func GetBitUint8(v uint8, offset int) bool
- func GetFuncFullName(i interface{}) string
- func GetFuncName(i interface{}, seps ...rune) string
- func GetFuncShortName(i interface{}) string
- func IsExist(path string) (bool, error)
- func IsExistBy(f *os.File, err error) bool
- func IsExistByFileInfo(info os.FileInfo) bool
- func IsExistFile(path string) (bool, error)
- func IsExistFolder(path string) (bool, error)
- func IsNilPointer(value interface{}) bool
- func IsPointer(value interface{}) bool
- func IsUTF8(buf []byte) bool
- func ItoA(dst *[]byte, i int, w int)
- func ItoAW(dst *[]byte, i int, w int)
- func LoadJsonBytesTo(js []byte, toPtr interface{}) error
- func LoadJsonFileTo(jsFileName string, toPtr interface{}) error
- func LoadJsonStringTo(js string, toPtr interface{}) error
- func MD5Bytes(s []byte) string
- func MD5File(filename string) (string, error)
- func MD5String(s string) string
- func NewBuffer(size int) *internal.Buffer
- func NewError(format string, a ...interface{}) error
- func NumberToBool[T Number](value T) bool
- func OpenFile(folderPath string, fileName string, flag int, perm os.FileMode) (file *os.File, err error)
- func OpenFileB(filePath string, flag int, perm os.FileMode) (file *os.File, err error)
- func PowInt64(m int64, n int) int64
- func Reverse[T any](arr []T)
- func Round(value float64, digit int) float64
- func SamePointer(pointers ...unsafe.Pointer) bool
- func SamePtr(ptrs ...interface{}) bool
- func SetBitByte(v byte, t bool, offset int) byte
- func SetBitUint16(v uint16, t bool, offset int) uint16
- func SetBitUint32(v uint32, t bool, offset int) uint32
- func SetBitUint64(v uint64, t bool, offset int) uint64
- func SetBitUint8(v uint8, t bool, offset int) uint8
- func Shuffle[T any](arr []T)
- func Slot(key string) int
- func Sprintf(format string, a ...interface{}) string
- func StrAddBeforeNotHas(s string, old rune, add rune) string
- func StrPtrToBytes(s string) []byte
- func ToError(r interface{}) (err error)
- func ToFloat32(value interface{}) (float32, error)
- func ToFloat64(value interface{}) (float64, error)
- func ToInt(value interface{}) (int, error)
- func ToInt16(value interface{}) (int16, error)
- func ToInt32(value interface{}) (int32, error)
- func ToInt64(value interface{}) (int64, error)
- func ToInt8(value interface{}) (int8, error)
- func ToLowerLine(s string) string
- func ToRune(s string) rune
- func ToString(value interface{}, indent bool) (string, error)
- func ToUint(value interface{}) (uint, error)
- func ToUint16(value interface{}) (uint16, error)
- func ToUint32(value interface{}) (uint32, error)
- func ToUint64(value interface{}) (uint64, error)
- func ToUint8(value interface{}) (uint8, error)
- func Try(f func(), catch func(stack string, e error))
- func TryDumpJson(v interface{}, indent bool) (string, error)
- func Type(value interface{}) reflect.Type
- type Buffer
- type BytesBinary
- type Float
- type Formatter
- type HandleFile
- type Integer
- type Json
- func (my *Json) Bool() bool
- func (my *Json) Clear()
- func (my *Json) Delete(keys ...interface{}) bool
- func (my *Json) Get(keys ...interface{}) interface{}
- func (my *Json) GetJson(keys ...interface{}) *Json
- func (my *Json) Int32() int32
- func (my *Json) Int64() int64
- func (my *Json) Interface() interface{}
- func (my *Json) IsNil() bool
- func (my *Json) Load(js interface{}) error
- func (my *Json) RangeSliceJson(f func(i int, elem *Json) bool)
- func (my *Json) Set(args ...interface{}) error
- func (my *Json) Slice() []interface{}
- func (my *Json) String() string
- func (my *Json) ToBool() (bool, error)
- func (my *Json) ToFloat32() (float32, error)
- func (my *Json) ToFloat64() (float64, error)
- func (my *Json) ToInt32() (int32, error)
- func (my *Json) ToInt64() (int64, error)
- func (my *Json) ToString(indent bool) (string, error)
- func (my *Json) TryBool() (v bool, ok bool)
- func (my *Json) TryBytes() ([]byte, error)
- func (my *Json) TryFloat32() (float32, error)
- func (my *Json) TryFloat64() (float64, error)
- func (my *Json) TryInt() (int, error)
- func (my *Json) TryInt32() (int32, error)
- func (my *Json) TryInt64() (int64, error)
- func (my *Json) TryMap() (map[string]interface{}, error)
- func (my *Json) TrySlice() ([]interface{}, error)
- type JsonINumber
- type KVPair
- type KwArgs
- type LRUCache
- type LinkList
- func (m *LinkList) Back() *LinkListNode
- func (m *LinkList) Front() *LinkListNode
- func (m *LinkList) Init() *LinkList
- func (m *LinkList) InsertAfter(v unsafe.Pointer, mark *LinkListNode) *LinkListNode
- func (m *LinkList) InsertBefore(v unsafe.Pointer, mark *LinkListNode) *LinkListNode
- func (m *LinkList) Len() int
- func (m *LinkList) MoveAfter(node, mark *LinkListNode)
- func (m *LinkList) MoveBefore(node, mark *LinkListNode)
- func (m *LinkList) MoveToBack(node *LinkListNode)
- func (m *LinkList) MoveToFront(node *LinkListNode)
- func (m *LinkList) PushBack(v unsafe.Pointer) *LinkListNode
- func (m *LinkList) PushBackList(other *LinkList)
- func (m *LinkList) PushFront(v unsafe.Pointer) *LinkListNode
- func (m *LinkList) PushFrontList(other *LinkList)
- func (m *LinkList) Remove(node *LinkListNode) bool
- type LinkListNode
- type Map
- type Mutex
- type NextNumber
- type Number
- type OnceSuccess
- type PARALLEL_ACQUIRE_STATE
- type ParallelController
- type ParallelLimiter
- type ParallelReleaser
- type RWMutex
- type RuneRange
- type SortedList
- func (my *SortedList) Add(v interface{}) bool
- func (my *SortedList) Back() (v interface{}, found bool)
- func (my *SortedList) Cap() int
- func (my *SortedList) Clear()
- func (my *SortedList) Front() (v interface{}, found bool)
- func (my *SortedList) Get(index int) (v interface{}, found bool)
- func (my *SortedList) Len() int
- func (my *SortedList) PopBack() (v interface{}, found bool)
- func (my *SortedList) PopFront() (v interface{}, found bool)
- func (my *SortedList) RemoveByIndex(index int) bool
- func (my *SortedList) RemoveByKey(key int64) bool
- func (my *SortedList) RemoveByScore(score int64) bool
- func (my *SortedList) SearchByKey(key int64) (int, bool)
- func (my *SortedList) SearchByScore(score int64) (index int, found bool)
- func (my *SortedList) Slice() []interface{}
- func (my *SortedList) String() string
- type SortedSet
- type TypeValue
- func (m *TypeValue) GetElem() (tElem reflect.Type, vElem reflect.Value, ok bool)
- func (m *TypeValue) GetMethodByName(name string) interface{}
- func (m *TypeValue) RangeFields(f func(tField reflect.StructField, vField reflect.Value) bool)
- func (m *TypeValue) RangeMethods(f func(name string, method interface{}) bool)
- func (m *TypeValue) SetFieldByName(v interface{}, name string) bool
- func (m *TypeValue) SetFieldByType(v interface{}) (ok bool)
- func (m *TypeValue) SetFieldValueByName(value reflect.Value, name string) bool
- func (m *TypeValue) SetFieldValueByType(value reflect.Value) (ok bool)
- func (m *TypeValue) Type() reflect.Type
- func (m *TypeValue) Value() reflect.Value
- type UnicodeChecker
- type Waiter
Constants ¶
View Source
const ERR_PID_ITOA = -2 //查找错误
View Source
const ERR_PID_NETWORK = -4 //网络协议错误
View Source
const ERR_PID_NOT_FOUND = -1 //没有找到进程
View Source
const ERR_PID_OS = -3 //系统错误
View Source
const HANDLE_FILE_PERM_ALL = 0777
View Source
const JSON_APPEND = -1 //追加
View Source
const JSON_APPEND_IN_FRONT = -2 //追加在前面
View Source
const JSON_INDEX_FIRST = -4 //第一的位置
View Source
const JSON_INDEX_LAST = -3 //最后的位置
View Source
const LINUX = `linux`
View Source
const WINDOWS = `windows`
Variables ¶
View Source
var BigEndian = bigEndian{}
View Source
var BufferPool = internal.BufferPool
View Source
var Compress compress
View Source
var ErrNotFile = log.NewError("not file")
View Source
var ErrNotFolder = log.NewError("not folder")
View Source
var LittleEndian = littleEndian{}
View Source
var Path = fpath{}
View Source
var RuneCJKA = RuneRange{'\uFF00', '\uFFEF'} //全角ASCII、全角中英文标点、半宽片假名、半宽平假名、半宽韩文字母
中日韩
View Source
var RuneChineseBasic = RuneRange{'\u4E00', '\u9FA5'} //基本汉字
View Source
var RuneChineseBasicEx = RuneRange{'\u9FA6', '\u9FFF'} //基本汉字补充
View Source
var RuneChineseBh = RuneRange{'\u31C0', '\u31E3'} //汉字笔画
View Source
var RuneChineseExA = RuneRange{'\u3400', '\u4DBF'} //汉字扩展A
View Source
var RuneChineseExB = RuneRange{ToRune("\\u20000"), ToRune("\\u2A6DF")} //汉字扩展B
View Source
var RuneChineseExC = RuneRange{ToRune("\\u2A700"), ToRune("\\u2B738")} //汉字扩展C
View Source
var RuneChineseExD = RuneRange{ToRune("\\u2B740"), ToRune("\\u2B81D")} //汉字扩展D
View Source
var RuneChineseExE = RuneRange{ToRune("\\u2B820"), ToRune("\\u2CEA1")} //汉字扩展E
View Source
var RuneChineseExF = RuneRange{ToRune("\\u2CEB0"), ToRune("\\u2EBE0")} //汉字扩展F
View Source
var RuneChineseExG = RuneRange{ToRune("\\u30000"), ToRune("\\u3134A")} //汉字扩展G
View Source
var RuneChineseJg = RuneRange{'\u2FF0', '\u2FFB'} //汉字结构
View Source
var RuneChineseJr = RuneRange{'\uF900', '\uFAD9'} //兼容汉字
View Source
var RuneChineseJrEx = RuneRange{ToRune("\\u2F800"), ToRune("\\u2FA1D")} //兼容扩展
View Source
var RuneChineseKx = RuneRange{'\u2F00', '\u2FD5'} //康熙部首
View Source
var RuneChineseKxEx = RuneRange{'\u2E80', '\u2EF3'} //部首扩展
View Source
var RuneChinesePua = RuneRange{'\uE815', '\uE86F'} //PUA(GBK)部件
View Source
var RuneChinesePuaEx = RuneRange{'\uE400', '\uE5E8'} //部件扩展
View Source
var RuneChinesePuaSup = RuneRange{'\uE600', '\uE6CF'} //PUA增补
View Source
var RuneChineseYq = RuneRange{'\u3007', '\u3007'} //〇
View Source
var RuneChineseZy = RuneRange{'\u3105', '\u312F'} //汉语注音
View Source
var RuneChineseZyEx = RuneRange{'\u31A0', '\u31BA'} //注音扩展
View Source
var RuneJapaneseHir = RuneRange{'\u3040', '\u309F'} //平假名
日语
View Source
var RuneJapaneseKPE = RuneRange{'\u31F0', '\u31FF'} //片假名音标扩展集
View Source
var RuneJapaneseKat = RuneRange{'\u30A0', '\u30FF'} //片假名
View Source
var RuneKoreanHJ = RuneRange{'\u1100', '\u11FF'} //谚文字母
View Source
var RuneKoreanPCL = RuneRange{'\u3130', '\u318F'} //谚文相容字母
View Source
var RuneKoreanPSC = RuneRange{'\uAC00', '\uD7AF'} //谚文音节字符
韩语
View Source
var RuneLower = RuneRange{'a', 'z'} //小写
View Source
var RuneNumber = RuneRange{'0', '9'} //数字
汉字
View Source
var RuneUpper = RuneRange{'A', 'Z'} //大写
View Source
var SystemCmder = &systemCommand{}
系统命令
Functions ¶
func AddRemain ¶
func AddRemain[T Number](oldNum, addNum, numMax T) (newNum, added, remained T)
添加剩余
func CallerLineStack ¶
func CallerShort ¶
func ExceptionError ¶
func ExceptionError(catch func(e error))
func GetBitByte ¶
func GetBitUint16 ¶
func GetBitUint32 ¶
func GetBitUint64 ¶
func GetBitUint8 ¶
func GetFuncFullName ¶
func GetFuncFullName(i interface{}) string
func GetFuncName ¶
func GetFuncShortName ¶
func GetFuncShortName(i interface{}) string
func IsNilPointer ¶
func IsNilPointer(value interface{}) bool
func LoadJsonBytesTo ¶
func LoadJsonFileTo ¶
func LoadJsonStringTo ¶
func NumberToBool ¶
func OpenFile ¶
func OpenFile(folderPath string, fileName string, flag int, perm os.FileMode) (file *os.File, err error)
打开文件 自动创建目录
func SamePointer ¶
func StrAddBeforeNotHas ¶
字符串中字符前(不存在此字符就加此字符) 一般mysql语句拼接使用 eg: old '\”, before add '\\'
func TryDumpJson ¶
Types ¶
type BytesBinary ¶
type BytesBinary []byte
func (*BytesBinary) Clear ¶
func (m *BytesBinary) Clear()
func (*BytesBinary) Get ¶
func (m *BytesBinary) Get(offset int) bool
func (*BytesBinary) GetBinaryString ¶
func (m *BytesBinary) GetBinaryString() string
func (*BytesBinary) ReSize ¶
func (m *BytesBinary) ReSize(size int)
func (*BytesBinary) Set ¶
func (m *BytesBinary) Set(t bool, offset int)
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
格式器
func NewFormatter ¶
新建格式器 signByte标志字符 startByte 开始字符 endByte 结束字符 ignore: true 忽略非完整格式, false 不忽略出现非完整格式后panic
type HandleFile ¶
type HandleFile struct {
// contains filtered or unexported fields
}
func NewHandleFile ¶
func NewHandleFile(flag int, perm os.FileMode) *HandleFile
func OpenHandleFile ¶
func (*HandleFile) Close ¶
func (my *HandleFile) Close()
func (*HandleFile) PathName ¶
func (my *HandleFile) PathName() string
func (*HandleFile) SetPathName ¶
func (my *HandleFile) SetPathName(folderPath, fileName string) bool
func (*HandleFile) WriteString ¶
func (my *HandleFile) WriteString(s string) (n int, err error)
type Json ¶
type Json struct {
// contains filtered or unexported fields
}
func LoadJson ¶
func LoadJson(js interface{}) *Json
LoadJson
@Description: 加载为json对象 @param js map[string] interface, []interface, struct, json string, json []byte, *os.File @return *Json
func TryLoadJson ¶
func (*Json) TryFloat32 ¶
func (*Json) TryFloat64 ¶
type JsonINumber ¶
type KVPair ¶
type KVPair[K comparable, V any] struct { Key K Value V }
type LRUCache ¶
type LRUCache[K comparable, V any] struct { // contains filtered or unexported fields }
func NewLRUCache ¶
func NewLRUCache[K comparable, V any](size int) *LRUCache[K, V]
type LinkList ¶
type LinkList struct {
// contains filtered or unexported fields
}
func NewLinkList ¶
func NewLinkList() *LinkList
func (*LinkList) Back ¶
func (m *LinkList) Back() *LinkListNode
func (*LinkList) Front ¶
func (m *LinkList) Front() *LinkListNode
func (*LinkList) InsertAfter ¶
func (m *LinkList) InsertAfter(v unsafe.Pointer, mark *LinkListNode) *LinkListNode
func (*LinkList) InsertBefore ¶
func (m *LinkList) InsertBefore(v unsafe.Pointer, mark *LinkListNode) *LinkListNode
func (*LinkList) MoveAfter ¶
func (m *LinkList) MoveAfter(node, mark *LinkListNode)
func (*LinkList) MoveBefore ¶
func (m *LinkList) MoveBefore(node, mark *LinkListNode)
func (*LinkList) MoveToBack ¶
func (m *LinkList) MoveToBack(node *LinkListNode)
func (*LinkList) MoveToFront ¶
func (m *LinkList) MoveToFront(node *LinkListNode)
func (*LinkList) PushBackList ¶
func (*LinkList) PushFrontList ¶
func (*LinkList) Remove ¶
func (m *LinkList) Remove(node *LinkListNode) bool
type LinkListNode ¶
func (*LinkListNode) Next ¶
func (m *LinkListNode) Next() *LinkListNode
func (*LinkListNode) Prev ¶
func (m *LinkListNode) Prev() *LinkListNode
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
func (*Map[K, V]) Delete ¶
Delete
@Description: 函数内不可再调本Map方法 @receiver m @param key @param f @return bool
type NextNumber ¶
type NextNumber = internal.NextNumber
func NewNextNumber ¶
func NewNextNumber(s string) *NextNumber
type OnceSuccess ¶
type OnceSuccess struct {
// contains filtered or unexported fields
}
func (*OnceSuccess) Do ¶
func (m *OnceSuccess) Do(f func() bool) bool
func (*OnceSuccess) DoError ¶
func (m *OnceSuccess) DoError(f func() error) error
func (*OnceSuccess) Success ¶
func (m *OnceSuccess) Success() bool
type PARALLEL_ACQUIRE_STATE ¶
type PARALLEL_ACQUIRE_STATE int8
const PARALLEL_ACQUIRE_CLOSED PARALLEL_ACQUIRE_STATE = 3 //关闭
const PARALLEL_ACQUIRE_MAX PARALLEL_ACQUIRE_STATE = 1 //达到最大并发
const PARALLEL_ACQUIRE_SUCCESS PARALLEL_ACQUIRE_STATE = 0 //正常
const PARALLEL_ACQUIRE_TIMEOUT PARALLEL_ACQUIRE_STATE = 2 //超时
type ParallelController ¶
type ParallelController struct {
// contains filtered or unexported fields
}
ParallelController 并发控制器
func NewParallelController ¶
func NewParallelController(max int32, block bool, timeout time.Duration) *ParallelController
func (*ParallelController) Acquire ¶
func (m *ParallelController) Acquire() (state PARALLEL_ACQUIRE_STATE)
Acquire
@Description: 获取 @receiver m @return state 状态
func (*ParallelController) Release ¶
func (m *ParallelController) Release() bool
Release
@Description: 释放 @receiver m @return bool
type ParallelLimiter ¶
type ParallelLimiter struct {
// contains filtered or unexported fields
}
ParallelLimiter @Description: 并发限制器
func (*ParallelLimiter) Acquire ¶
func (m *ParallelLimiter) Acquire() (releaser ParallelReleaser, state PARALLEL_ACQUIRE_STATE)
Acquire
@Description: 获取并发权限 @receiver m @return releaser 返回释放器 @return state 状态
type ParallelReleaser ¶
type ParallelReleaser interface {
Release() bool
}
type SortedList ¶
type SortedList struct {
// contains filtered or unexported fields
}
有序列表
func NewSortedList ¶
func NewSortedList(scoreRepeat, reverse bool, getScore func(v interface{}) int64, getKey func(v interface{}) int64) *SortedList
func (*SortedList) Add ¶
func (my *SortedList) Add(v interface{}) bool
func (*SortedList) Back ¶
func (my *SortedList) Back() (v interface{}, found bool)
func (*SortedList) Cap ¶
func (my *SortedList) Cap() int
func (*SortedList) Clear ¶
func (my *SortedList) Clear()
func (*SortedList) Front ¶
func (my *SortedList) Front() (v interface{}, found bool)
func (*SortedList) Get ¶
func (my *SortedList) Get(index int) (v interface{}, found bool)
func (*SortedList) Len ¶
func (my *SortedList) Len() int
func (*SortedList) PopBack ¶
func (my *SortedList) PopBack() (v interface{}, found bool)
func (*SortedList) PopFront ¶
func (my *SortedList) PopFront() (v interface{}, found bool)
func (*SortedList) RemoveByIndex ¶
func (my *SortedList) RemoveByIndex(index int) bool
func (*SortedList) RemoveByKey ¶
func (my *SortedList) RemoveByKey(key int64) bool
func (*SortedList) RemoveByScore ¶
func (my *SortedList) RemoveByScore(score int64) bool
func (*SortedList) SearchByKey ¶
func (my *SortedList) SearchByKey(key int64) (int, bool)
func (*SortedList) SearchByScore ¶
func (my *SortedList) SearchByScore(score int64) (index int, found bool)
func (*SortedList) Slice ¶
func (my *SortedList) Slice() []interface{}
func (*SortedList) String ¶
func (my *SortedList) String() string
type SortedSet ¶
type SortedSet struct {
*SortedList
}
有序集合
func NewSortedSet ¶
func NewSortedSetInt ¶
type TypeValue ¶
type TypeValue struct {
// contains filtered or unexported fields
}
func TypeValueOf ¶
func TypeValueOf(ptr interface{}) *TypeValue
func (*TypeValue) GetMethodByName ¶
func (*TypeValue) RangeFields ¶
func (*TypeValue) RangeMethods ¶
func (*TypeValue) SetFieldByName ¶
func (*TypeValue) SetFieldByType ¶
func (*TypeValue) SetFieldValueByName ¶
func (*TypeValue) SetFieldValueByType ¶
type UnicodeChecker ¶
字符串编码检查
func (*UnicodeChecker) Check ¶
func (m *UnicodeChecker) Check(s string) bool
Source Files
¶
- binary.go
- buffer.go
- cache.go
- compress.go
- convert.go
- exception.go
- format.go
- func.go
- func_linux.go
- handlefile.go
- init.go
- itoa.go
- json.go
- list.go
- map.go
- md5.go
- mutex.go
- next.go
- once.go
- parallel_limiter.go
- sortedlist.go
- sortedset.go
- system_command.go
- typevalue.go
- unicode_checker.go
- unicode_range.go
- waiter.go
Click to show internal directories.
Click to hide internal directories.