Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(d float64) float64
- func AddHttpContentType(extension string, contentType string)
- func AddHttpContentTypes(m map[string]string)
- func ArgsToSlc[T any](args ...T) []T
- func BytesToInt64(bytes []byte) int64
- func BytesToStr(b []byte) string
- func Cancel()
- func Ceil(d float64, bit int32) float64
- func CeilInt32(ceil, v int32) (r, o int32)
- func Clamp[T Num](min, max, v T) T
- func ClampFloat(min, max, v float64) float64
- func ClampFloat64(min, max, v float64) float64
- func ClampInt(min, max, v int) int
- func ClampInt32(min, max, v int32) int32
- func Cmp(v1, v2 float64) int
- func CmpZero(v float64) int
- func CopyBytes(src []byte) []byte
- func Ctx() context.Context
- func Default[T any]() (v T)
- func DefaultCmd(m M)
- func DegreeToRadian(angle float64) float64
- func Equal(v1, v2 float64) bool
- func ErrCodeToStr(ec TErrCode) string
- func ExeDir() string
- func ExeName() string
- func Floor(d float64, bit int32) float64
- func FloorInt32(floor, v int32) (r, o int32)
- func FormatDur(d time.Duration) string
- func GenMask(items ...int64) int64
- func GetDiskPercent() float64
- func GetFreePort() (int, error)
- func GetHttpContentType(extension string) string
- func GetMemPercent() float64
- func GetStack(skip int) []byte
- func GobMarshal(v any) ([]byte, error)
- func GobUnmarshal(data []byte, v any) error
- func Haversine(lon1, lat1, lon2, lat2 float64) float64
- func Hex(bytes []byte) string
- func Int64ToBs(id int64) string
- func Int64ToBytes(id int64) []byte
- func Int64sToShortStrSlice(ids ...int64) []string
- func IsInternalIP(ip string) bool
- func IsPowerOfTwo(mask int32) bool
- func IsPrivateIP(ip net.IP) bool
- func IsVirtualInterface(name string) bool
- func JsonConf() jsoniter.API
- func Lerp(from, to, t float64) float64
- func LerpFloat(v1, v2, v float64) float64
- func LerpInt(v1, v2, v, t int) int
- func LogTrim(file string) string
- func MGet[T any](m M, key string) (T, bool)
- func MGet2[T any](m M, keys ...string) (T, bool)
- func MGetOrSet[T any](m M, key string, new func() T) T
- func MPop[T any](m M, key string) (T, bool)
- func MReplace[T any](m M, key string, val T) (T, bool)
- func MUpdate[T any](m M, key string, fn func(T) T) bool
- func MaskAddItem(item, mask int64) int64
- func MaskDelItem(item, mask int64) int64
- func Max(l, r float64) float64
- func MaxInt(a, b int) int
- func MaxInt32(a, b int32) int32
- func MaxInt64(a, b int64) int64
- func MaxUint32(a, b uint32) uint32
- func MergeUInt32(prevId, lastId uint16) uint32
- func Min(l, r float64) float64
- func MinInt(a, b int) int
- func MinInt32(a, b int32) int32
- func MinInt64(a, b int64) int64
- func MinUint32(a, b uint32) uint32
- func NextCap(required, current, slow int) (int, bool)
- func NextPowerOfTwo(v int) int
- func PbMarshal(pkt IMsg) ([]byte, error)
- func PbUnmarshal(data []byte, pkt IMsg) error
- func PointInTriangle(p, a, b, c Vec2) bool
- func PointOnSeg(p, a, b Vec2) bool
- func PointToSegDist(p, a, b Vec2) float64
- func PointToSegDistSquare(p, a, b Vec2) float64
- func PointToVecDist(p, a, b Vec2) float64
- func PointToVecDistSquare(p, a, b Vec2) float64
- func RadianToDegree(radian float64) float64
- func RandStr(n int) string
- func RecycleByteBuffer(bf *ByteBuffer)
- func RecycleBytes(bytes []byte)
- func RecycleCounter(c *Counter)
- func ReverseMask(mask int64, items *[]int64)
- func Round(d float64, bit int32) float64
- func SetErrCodeToStr(ec TErrCode, str string)
- func SetErrCodesToStrMap(m map[TErrCode]string)
- func SetJsonConf(conf jsoniter.Config)
- func ShallowCopy(dst, src any)
- func ShallowCopyPub(dst, src any)
- func ShortStrToInt64(id string) int64
- func ShortStrToUint16(id string) uint16
- func ShortStrToUint32(id string) uint32
- func ShortStrToUint64(id string) uint64
- func SpawnBytes() []byte
- func SpawnBytesWithLen(l int) []byte
- func SplitSlc1[T any](slc []any) T
- func SplitSlc2[T1, T2 any](slc []any) (T1, T2)
- func SplitSlc3[T1, T2, T3 any](slc []any) (T1, T2, T3)
- func SplitSlc4[T1, T2, T3, T4 any](slc []any) (T1, T2, T3, T4)
- func SplitSlc5[T1, T2, T3, T4, T5 any](slc []any) (T1, T2, T3, T4, T5)
- func SplitSlc6[T1, T2, T3, T4, T5, T6 any](slc []any) (T1, T2, T3, T4, T5, T6)
- func SplitSlc7[T1, T2, T3, T4, T5, T6, T7 any](slc []any) (T1, T2, T3, T4, T5, T6, T7)
- func SplitSlc8[T1, T2, T3, T4, T5, T6, T7, T8 any](slc []any) (T1, T2, T3, T4, T5, T6, T7, T8)
- func SplitUInt32(code uint32) (prevId, lastId uint16)
- func SplitWords(str string, words *[]string)
- func Sqrt(v float64) float64
- func StartProfile(dur time.Duration, receiver chan<- M)
- func StrToBytes(s string) []byte
- func StringsJoin(sep string, slc ...string) string
- func TestMask(item, mask int64) bool
- func ToLowerCamelCase(s string) string
- func ToUnderline(str string) string
- func ToUpperCamelCase(s string) string
- func TriangleArea(a, b, c Vec2) float64
- func Uint16ToShortStr(id uint16) string
- func Uint32ToShortStr(id uint32) string
- func Uint64ToShortStr(id uint64) string
- func Vec2Cross(a, b Vec2) float64
- func Vec2Dist(a, b Vec2) float64
- func Vec2DistSquare(a, b Vec2) float64
- func Vec2Dot(a, b Vec2) float64
- func Vec2Equal(a, b Vec2) bool
- func Vec2Magnitude(a Vec2) float64
- func Vec2Radian(a, b Vec2) float64
- func Vec2ToRadian(a Vec2) float64
- type AnyBoolToAnyBool
- type AnyBoolToBool
- type AnyErrToBool
- type AnyToAny
- type AnyToAnyBool
- type AnyToBool
- type AnyToBytesError
- type AnyToErr
- type AnyToInt64
- type BoolToErr
- type ByteBuffer
- func (b *ByteBuffer) All() []byte
- func (b *ByteBuffer) Available() int
- func (b *ByteBuffer) Cap() int
- func (b *ByteBuffer) Clone() *ByteBuffer
- func (b *ByteBuffer) Compact()
- func (b *ByteBuffer) CopyBytes() ([]byte, int)
- func (b *ByteBuffer) Dispose()
- func (b *ByteBuffer) InitBytes(bytes []byte)
- func (b *ByteBuffer) InitCap(c int)
- func (b *ByteBuffer) Length() int
- func (b *ByteBuffer) Pos() int
- func (b *ByteBuffer) RAny() (v any, err *Err)
- func (b *ByteBuffer) RAnyMAny(m map[any]any) (err *Err)
- func (b *ByteBuffer) RAvailable() []byte
- func (b *ByteBuffer) RBool() (v bool, err *Err)
- func (b *ByteBuffer) RBools() (v []bool, err *Err)
- func (b *ByteBuffer) RBytes() ([]byte, *Err)
- func (b *ByteBuffer) RErr() (e *Err, re *Err)
- func (b *ByteBuffer) RFloat32() (v float32, err *Err)
- func (b *ByteBuffer) RFloat32s() (v []float32, err *Err)
- func (b *ByteBuffer) RFloat64() (v float64, err *Err)
- func (b *ByteBuffer) RFloat64s() (v []float64, err *Err)
- func (b *ByteBuffer) RInt() (v int, err *Err)
- func (b *ByteBuffer) RInt8() (v int8, err *Err)
- func (b *ByteBuffer) RInt8s() (v []int8, err *Err)
- func (b *ByteBuffer) RInt16() (v int16, err *Err)
- func (b *ByteBuffer) RInt16s() (v []int16, err *Err)
- func (b *ByteBuffer) RInt32() (v int32, err *Err)
- func (b *ByteBuffer) RInt32MInt32() (m map[int32]int32, err *Err)
- func (b *ByteBuffer) RInt32MInt64() (m map[int32]int64, err *Err)
- func (b *ByteBuffer) RInt32s() (v []int32, err *Err)
- func (b *ByteBuffer) RInt64() (v int64, err *Err)
- func (b *ByteBuffer) RInt64MInt32() (m map[int64]int32, err *Err)
- func (b *ByteBuffer) RInt64MInt64() (m map[int64]int64, err *Err)
- func (b *ByteBuffer) RInt64s() (v []int64, err *Err)
- func (b *ByteBuffer) RInts() (v []int, err *Err)
- func (b *ByteBuffer) RJson(v any) *Err
- func (b *ByteBuffer) RMAny(m M) (err *Err)
- func (b *ByteBuffer) RMInt32() (m map[string]int32, err *Err)
- func (b *ByteBuffer) RMInt64() (m map[string]int64, err *Err)
- func (b *ByteBuffer) RMStr() (m MS, err *Err)
- func (b *ByteBuffer) RMUint32() (m map[string]uint32, err *Err)
- func (b *ByteBuffer) RMUint64() (m map[string]uint64, err *Err)
- func (b *ByteBuffer) RShortString() (v string, err *Err)
- func (b *ByteBuffer) RString() (v string, err *Err)
- func (b *ByteBuffer) RStringNoLen() (v string)
- func (b *ByteBuffer) RStrings() (v []string, err *Err)
- func (b *ByteBuffer) RUint8() (v uint8, err *Err)
- func (b *ByteBuffer) RUint8s() (v []uint8, err *Err)
- func (b *ByteBuffer) RUint16() (v uint16, err *Err)
- func (b *ByteBuffer) RUint16MUint16() (m map[uint16]uint16, err *Err)
- func (b *ByteBuffer) RUint16s() (v []uint16, err *Err)
- func (b *ByteBuffer) RUint32() (v uint32, err *Err)
- func (b *ByteBuffer) RUint32s() (v []uint32, err *Err)
- func (b *ByteBuffer) RUint64() (v uint64, err *Err)
- func (b *ByteBuffer) RUint64s() (v []uint64, err *Err)
- func (b *ByteBuffer) RVec2() (v Vec2, err *Err)
- func (b *ByteBuffer) RVec2s() (v []Vec2, err *Err)
- func (b *ByteBuffer) RVec3() (v Vec3, err *Err)
- func (b *ByteBuffer) RVec3s() (v []Vec3, err *Err)
- func (b *ByteBuffer) Read(p []byte) (n int, err error)
- func (b *ByteBuffer) Reset()
- func (b *ByteBuffer) ResetWithCap(cap int)
- func (b *ByteBuffer) SetPos(v int)
- func (b *ByteBuffer) ToHex() string
- func (b *ByteBuffer) WAny(v any) *Err
- func (b *ByteBuffer) WAny2(m map[any]any) (err *Err)
- func (b *ByteBuffer) WAnyMAny(m map[any]any) *Err
- func (b *ByteBuffer) WBool(v bool)
- func (b *ByteBuffer) WBools(v []bool)
- func (b *ByteBuffer) WBytes(v []byte)
- func (b *ByteBuffer) WErr(err *Err) *Err
- func (b *ByteBuffer) WFloat32(v float32)
- func (b *ByteBuffer) WFloat32s(v []float32)
- func (b *ByteBuffer) WFloat64(v float64)
- func (b *ByteBuffer) WFloat64s(v []float64)
- func (b *ByteBuffer) WInt(v int)
- func (b *ByteBuffer) WInt8(v int8)
- func (b *ByteBuffer) WInt8s(v []int8)
- func (b *ByteBuffer) WInt16(v int16)
- func (b *ByteBuffer) WInt16s(v []int16)
- func (b *ByteBuffer) WInt32(v int32)
- func (b *ByteBuffer) WInt32MInt32(m map[int32]int32)
- func (b *ByteBuffer) WInt32MInt64(m map[int32]int64)
- func (b *ByteBuffer) WInt32s(v []int32)
- func (b *ByteBuffer) WInt64(v int64)
- func (b *ByteBuffer) WInt64MInt32(m map[int64]int32)
- func (b *ByteBuffer) WInt64MInt64(m map[int64]int64)
- func (b *ByteBuffer) WInt64s(v []int64)
- func (b *ByteBuffer) WInts(v []int)
- func (b *ByteBuffer) WJson(o any) *Err
- func (b *ByteBuffer) WMAny(m M) *Err
- func (b *ByteBuffer) WMInt32(m map[string]int32)
- func (b *ByteBuffer) WMInt64(m map[string]int64)
- func (b *ByteBuffer) WMStr(m MS)
- func (b *ByteBuffer) WMUint32(m map[string]uint32)
- func (b *ByteBuffer) WMUint64(m map[string]uint64)
- func (b *ByteBuffer) WShortString(v string)
- func (b *ByteBuffer) WString(v string)
- func (b *ByteBuffer) WStringNoLen(v string)
- func (b *ByteBuffer) WStrings(v []string)
- func (b *ByteBuffer) WUint8(v uint8)
- func (b *ByteBuffer) WUint8s(v []uint8)
- func (b *ByteBuffer) WUint16(v uint16)
- func (b *ByteBuffer) WUint16MUint16(m map[uint16]uint16)
- func (b *ByteBuffer) WUint16s(v []uint16)
- func (b *ByteBuffer) WUint32(v uint32)
- func (b *ByteBuffer) WUint32s(v []uint32)
- func (b *ByteBuffer) WUint64(v uint64)
- func (b *ByteBuffer) WUint64s(v []uint64)
- func (b *ByteBuffer) WVec2(v Vec2)
- func (b *ByteBuffer) WVec2s(v []Vec2)
- func (b *ByteBuffer) WVec3(v Vec3)
- func (b *ByteBuffer) WVec3s(v []Vec3)
- func (b *ByteBuffer) Write(v []byte) (int, error)
- func (b *ByteBuffer) WriteBytes(data ...[]byte)
- func (b *ByteBuffer) WriteStrings(strs ...string)
- func (b *ByteBuffer) WriteTo(writer io.Writer) (n int, err error)
- type BytesAnyToErr
- type BytesAnyToError
- type BytesToAnyErr
- type BytesToBytes
- type BytesToErr
- type BytesToInt
- type BytesToInt642Err
- type BytesToM
- type BytesToUint16
- type CmdHandler
- type Command
- type Compare
- type Counter
- type Enable
- func (e *Enable) Disable(fn FnAnySlc, params ...any) bool
- func (e *Enable) Disabled() bool
- func (e *Enable) Enable(fn FnAnySlc, params ...any) bool
- func (e *Enable) IfDisable(fn Fn) (ok bool)
- func (e *Enable) IfEnable(fn Fn) (ok bool)
- func (e *Enable) RAction(fn FnAnySlc, params ...any) *Err
- func (e *Enable) WAction(fn FnAnySlc, params ...any) *Err
- func (e *Enable) WAction2(fn Fn) *Err
- type Err
- func GetCpuPercent() (float64, *Err)
- func GetInternalIP() (string, *Err)
- func JsonMarshal(o any) ([]byte, *Err)
- func JsonMarshalIndent(o any, prefix, indent string) ([]byte, *Err)
- func JsonUnmarshal(bytes []byte, o any) *Err
- func NewErr(code TErrCode, params M) *Err
- func NewErrByLevel(code TErrCode, params M) *Err
- func NewErrWithStack(code TErrCode, stack []byte, params M) *Err
- func NewM(bytes []byte, m M) *Err
- func NewNoStackErr(code TErrCode, params M) *Err
- func ParseAddrPort(addr string) (int, *Err)
- func ParseNum[T Num](s string) (v T, err *Err)
- func SplitInt64(sep, str string) ([]int64, *Err)
- func SplitUint16(sep, str string) ([]uint16, *Err)
- func WrapErr(code TErrCode, e error) *Err
- func WrapErrByLevel(code TErrCode, e error) *Err
- type ErrLevel
- type Fn
- type FnAny
- type FnAnyErr
- type FnAnySlc
- type FnAnySlc2
- type FnBool
- type FnBoolErr
- type FnBytes
- type FnBytes2Bool
- type FnBytesSlc
- type FnE
- type FnErr
- type FnErrAny
- type FnErrCode
- type FnFn
- type FnInt
- type FnInt32
- type FnInt64
- type FnInt64Any
- type FnInt64Bool
- type FnInt64Bytes
- type FnInt64Err
- type FnInt64M
- type FnInt64MErr
- type FnInt64Str
- type FnInt64StrBool
- type FnInt64Uint16
- type FnInt642
- type FnInt642Any
- type FnInt642Bool
- type FnInt642Err
- type FnInt643
- type FnIntAnySlc
- type FnIntAnySlc2
- type FnM
- type FnM2Bool
- type FnMAny
- type FnMBool
- type FnMErr
- type FnMUint32
- type FnMapBool
- type FnMsg
- type FnStr
- type FnStr2Bool
- type FnStrAny
- type FnStrBool
- type FnStrBytes
- type FnStrBytesM
- type FnStrErr
- type FnStrFn
- type FnStrME
- type FnStrMErr
- type FnStrSlc
- type FnStrUint32
- type FnUint16
- type FnUint16Bool
- type FnUint16Bytes
- type FnUint16Err
- type FnUint16Int642Bytes
- type FnUint32
- type FnUint162Int642Bytes
- type IMsg
- type IResMsg
- type Id
- type Int64AnyToBool
- type Int64ToBool
- type Int64ToErrCode
- type Int64ToInt64
- type Int64ToInt64Err
- type Int64ToStr
- type Int64ToStrErr
- type Int642ToBool
- type M
- func (m M) Copy() M
- func (m M) CopyTo(n M)
- func (m M) Del(key string)
- func (m M) FromBytes(bytes []byte) *Err
- func (m M) FromGob(bytes []byte) *Err
- func (m M) FromJson(bytes []byte) *Err
- func (m M) Get(key string) (any, bool)
- func (m M) GetB(key string) (bool, bool)
- func (m M) GetBSlice(key string) ([]bool, bool)
- func (m M) GetF32(key string) (float32, bool)
- func (m M) GetF32Slice(key string) ([]float32, bool)
- func (m M) GetF64Slice(key string) ([]float32, bool)
- func (m M) GetFloat64(key string) (float64, bool)
- func (m M) GetI8(key string) (int8, bool)
- func (m M) GetI8Slice(key string) ([]int8, bool)
- func (m M) GetI16(key string) (int16, bool)
- func (m M) GetI16Slice(key string) ([]int16, bool)
- func (m M) GetI32(key string) (int32, bool)
- func (m M) GetI32Slice(key string) ([]int32, bool)
- func (m M) GetI64(key string) (int64, bool)
- func (m M) GetI64Slice(key string) ([]int64, bool)
- func (m M) GetMI32(key string) (map[string]int32, bool)
- func (m M) GetMI64(key string) (map[string]int64, bool)
- func (m M) GetMU32(key string) (map[string]uint32, bool)
- func (m M) GetMU64(key string) (map[string]uint64, bool)
- func (m M) GetS(key string) (string, bool)
- func (m M) GetSSlice(key string) ([]string, bool)
- func (m M) GetU8(key string) (uint8, bool)
- func (m M) GetU8Slice(key string) ([]uint8, bool)
- func (m M) GetU16(key string) (uint16, bool)
- func (m M) GetU16Slice(key string) ([]uint16, bool)
- func (m M) GetU32(key string) (uint32, bool)
- func (m M) GetU32Slice(key string) ([]uint32, bool)
- func (m M) GetU64(key string) (uint64, bool)
- func (m M) GetU64Slice(key string) ([]uint64, bool)
- func (m M) GetV2(key string) (Vec2, bool)
- func (m M) GetV2Slice(key string) ([]Vec2, bool)
- func (m M) GetV3(key string) (Vec3, bool)
- func (m M) GetV3Slice(key string) ([]Vec3, bool)
- func (m M) Has(key string) (ok bool)
- func (m M) IndentJson() []byte
- func (m M) MustGet(key string, def any) any
- func (m M) Replace(key string, val any) (oldVal any, ok bool)
- func (m M) Set(key string, val any)
- func (m M) Set2(val any, keys ...string) *Err
- func (m M) ToBytes() ([]byte, *Err)
- func (m M) ToGob() ([]byte, *Err)
- func (m M) ToJson() ([]byte, *Err)
- func (m M) ToSlice(slc *[]any)
- func (m M) Update(key string, action AnyToAny) (ok bool)
- type M32
- type M64
- type MF32
- type MF64
- type MS
- type MToAny
- type MToBool
- type MToBytes
- type MToErr
- type MToInt64
- type MsgToErr
- type Num
- type Pool
- type PoolOption
- type Str2BytesToBytesErr
- type Str2Int64ToBoolBytes
- type Str162ErrToBytesErr
- type StrAnyToErr
- type StrBytesToBool
- type StrFnToErr
- type StrInt64ToBool
- type StrIntToBool
- type StrToAny
- type StrToBool
- type StrToBytesErr
- type StrToStr
- type StrToStr2Err
- type TErrCode
- type ToAny
- type ToBool
- type ToErr
- type ToErrCode
- type ToFnInt64Fn
- type ToInt64
- type ToM
- type ToMsg
- type ToStr
- type ToStrBool
- type Tuple2
- type Tuple3
- type Tuple4
- type Tuple5
- type Uint16Int64ToUint16
- type Uint16ToBool
- type Vec2
- func PointToSegNearPoint(p, a, b Vec2) Vec2
- func PointToVecNearPoint(p, a, b Vec2) Vec2
- func RandDir() Vec2
- func RandRange(center Vec2, radius float64) Vec2
- func Vec2Add(a, b Vec2) Vec2
- func Vec2Clamp(v, min, max Vec2) Vec2
- func Vec2Div(a Vec2, v float64) Vec2
- func Vec2Lerp(a, b Vec2, v float64) Vec2
- func Vec2Mul(a Vec2, v float64) Vec2
- func Vec2Normalize(v Vec2) Vec2
- func Vec2One() Vec2
- func Vec2Rotate(a Vec2, radian float64) Vec2
- func Vec2Rotate90(a Vec2) Vec2
- func Vec2Rotate180(v Vec2) Vec2
- func Vec2Rotate270(a Vec2) Vec2
- func Vec2Sub(a, b Vec2) Vec2
- func Vec2XRebound(a, b Vec2, bound float64) (Vec2, bool)
- func Vec2YRebound(a, b Vec2, bound float64) (Vec2, bool)
- type Vec2Int
- type Vec3
Constants ¶
View Source
const ( Bool _BT = iota Bools Bytes Uint8 Int8 Int8s Uint16 Uint16s Int16 Int16s Int Ints Uint32 Uint32s Int32 Int32s Uint64 Uint64s Int64 Int64s Float32 Float32s Float64 Float64s Vector2 Vector2s Vector3 Vector3s Str Strs Time Times MInt32 MInt64 MUint32 MUint64 MStr MAny Uint16MUint16 Int32MInt32 Int32MInt64 Int64MInt32 Int64MInt64 AnyMAny )
View Source
const ( Rad2Deg float64 = 180 / math.Pi Deg2Rad float64 = math.Pi / 180 HalfPi float64 = math.Pi / 2 Eps float64 = 1e-5 )
View Source
const ( Cpu = "cpu" Memory = "mem" Disk = "disk" Goroutine = "goroutine" )
Variables ¶
View Source
var ( Ec2Str = map[TErrCode]string{ EcNil: "nil", EcRecover: "recover", EcServiceErr: "service error", EcIo: "io error", EcTimeout: "timeout", EcConnectErr: "connect error", EcListenErr: "listen error", EcAcceptErr: "accept error", EcAddrErr: "get addr error", EcIllegalConn: "illegal conn", EcTooManyConn: "too many conn", EcWriteFail: "write fail", EcDbErr: "database error", EcRedisErr: "redis error", EcParamsErr: "params error", EcEmpty: "empty", EcTooLong: "too long", EcOutOfRange: "out of range", EcWrongType: "wrong type", EcType: "error type", EcParseErr: "parse error", EcExist: "exist", EcNotExist: "not exist", EcClosed: "closed", EcNotEnough: "not enough", EcNotImplement: "not implement", EcMarshallErr: "marshall error", EcUnmarshallErr: "unmarshall error", EcBadHead: "bad head", EcBadPacket: "bad packet", EcEmptyPacket: "empty packet", EcNoAuth: "no auth", EcResFail: "response fail", } Ec2Cn = map[TErrCode]string{ EcNil: "空引用", EcRecover: "恢复错误", EcServiceErr: "服务错误", EcIo: "io错误", EcTimeout: "超时", EcConnectErr: "连接错误", EcListenErr: "监听错误", EcAcceptErr: "接受错误", EcAddrErr: "获取地址错误", EcIllegalConn: "非法连接", EcTooManyConn: "连接过多", EcWriteFail: "写失败", EcDbErr: "数据库错误", EcRedisErr: "redis错误", EcParamsErr: "参数错误", EcEmpty: "空", EcTooLong: "太长", EcOutOfRange: "越界", EcWrongType: "错误类型", EcType: "错误类型", EcParseErr: "解析错误", EcExist: "已存在", EcNotExist: "不存在", EcClosed: "已关闭", EcNotEnough: "容量不足", EcNotImplement: "未实现", EcMarshallErr: "序列化错误", EcUnmarshallErr: "反序列化错误", EcBadHead: "错误的消息头", EcBadPacket: "错误的消息包", EcEmptyPacket: "空包", EcNoAuth: "无权限", EcResFail: "响应错误", } )
View Source
var ( StackMaxDeep = 8 LogPrefix = ".." )
View Source
var (
Patterns = []string{
"/src/",
".com/",
".org/",
".cool/",
".cn/",
"/go1.",
}
)
Functions ¶
func Cancel ¶
func Cancel()
func RecycleByteBuffer ¶
func RecycleByteBuffer(bf *ByteBuffer)
func SplitSlc7 ¶
func SplitSlc8 ¶
Types ¶
type ByteBuffer ¶
type ByteBuffer struct {
// contains filtered or unexported fields
}
func SpawnByteBuffer ¶
func SpawnByteBuffer(c int) *ByteBuffer
func (*ByteBuffer) All ¶
func (b *ByteBuffer) All() []byte
func (*ByteBuffer) Available ¶
func (b *ByteBuffer) Available() int
func (*ByteBuffer) Cap ¶
func (b *ByteBuffer) Cap() int
func (*ByteBuffer) CopyBytes ¶
func (b *ByteBuffer) CopyBytes() ([]byte, int)
func (*ByteBuffer) InitBytes ¶
func (b *ByteBuffer) InitBytes(bytes []byte)
func (*ByteBuffer) InitCap ¶
func (b *ByteBuffer) InitCap(c int)
func (*ByteBuffer) Length ¶
func (b *ByteBuffer) Length() int
func (*ByteBuffer) Pos ¶
func (b *ByteBuffer) Pos() int
func (*ByteBuffer) RAny ¶
func (b *ByteBuffer) RAny() (v any, err *Err)
func (*ByteBuffer) RAnyMAny ¶
func (b *ByteBuffer) RAnyMAny(m map[any]any) (err *Err)
func (*ByteBuffer) RBool ¶
func (b *ByteBuffer) RBool() (v bool, err *Err)
func (*ByteBuffer) RBools ¶
func (b *ByteBuffer) RBools() (v []bool, err *Err)
func (*ByteBuffer) RBytes ¶
func (b *ByteBuffer) RBytes() ([]byte, *Err)
func (*ByteBuffer) RErr ¶
func (b *ByteBuffer) RErr() (e *Err, re *Err)
func (*ByteBuffer) RFloat32 ¶
func (b *ByteBuffer) RFloat32() (v float32, err *Err)
func (*ByteBuffer) RFloat32s ¶
func (b *ByteBuffer) RFloat32s() (v []float32, err *Err)
func (*ByteBuffer) RFloat64 ¶
func (b *ByteBuffer) RFloat64() (v float64, err *Err)
func (*ByteBuffer) RFloat64s ¶
func (b *ByteBuffer) RFloat64s() (v []float64, err *Err)
func (*ByteBuffer) RInt ¶
func (b *ByteBuffer) RInt() (v int, err *Err)
func (*ByteBuffer) RInt8 ¶
func (b *ByteBuffer) RInt8() (v int8, err *Err)
func (*ByteBuffer) RInt8s ¶
func (b *ByteBuffer) RInt8s() (v []int8, err *Err)
func (*ByteBuffer) RInt16 ¶
func (b *ByteBuffer) RInt16() (v int16, err *Err)
func (*ByteBuffer) RInt16s ¶
func (b *ByteBuffer) RInt16s() (v []int16, err *Err)
func (*ByteBuffer) RInt32 ¶
func (b *ByteBuffer) RInt32() (v int32, err *Err)
func (*ByteBuffer) RInt32MInt32 ¶
func (b *ByteBuffer) RInt32MInt32() (m map[int32]int32, err *Err)
func (*ByteBuffer) RInt32MInt64 ¶
func (b *ByteBuffer) RInt32MInt64() (m map[int32]int64, err *Err)
func (*ByteBuffer) RInt32s ¶
func (b *ByteBuffer) RInt32s() (v []int32, err *Err)
func (*ByteBuffer) RInt64 ¶
func (b *ByteBuffer) RInt64() (v int64, err *Err)
func (*ByteBuffer) RInt64MInt32 ¶
func (b *ByteBuffer) RInt64MInt32() (m map[int64]int32, err *Err)
func (*ByteBuffer) RInt64MInt64 ¶
func (b *ByteBuffer) RInt64MInt64() (m map[int64]int64, err *Err)
func (*ByteBuffer) RInt64s ¶
func (b *ByteBuffer) RInt64s() (v []int64, err *Err)
func (*ByteBuffer) RInts ¶
func (b *ByteBuffer) RInts() (v []int, err *Err)
func (*ByteBuffer) RJson ¶
func (b *ByteBuffer) RJson(v any) *Err
func (*ByteBuffer) RMAny ¶
func (b *ByteBuffer) RMAny(m M) (err *Err)
func (*ByteBuffer) RMInt32 ¶
func (b *ByteBuffer) RMInt32() (m map[string]int32, err *Err)
func (*ByteBuffer) RMInt64 ¶
func (b *ByteBuffer) RMInt64() (m map[string]int64, err *Err)
func (*ByteBuffer) RMStr ¶
func (b *ByteBuffer) RMStr() (m MS, err *Err)
func (*ByteBuffer) RMUint32 ¶
func (b *ByteBuffer) RMUint32() (m map[string]uint32, err *Err)
func (*ByteBuffer) RMUint64 ¶
func (b *ByteBuffer) RMUint64() (m map[string]uint64, err *Err)
func (*ByteBuffer) RShortString ¶
func (b *ByteBuffer) RShortString() (v string, err *Err)
func (*ByteBuffer) RString ¶
func (b *ByteBuffer) RString() (v string, err *Err)
func (*ByteBuffer) RStringNoLen ¶
func (b *ByteBuffer) RStringNoLen() (v string)
func (*ByteBuffer) RStrings ¶
func (b *ByteBuffer) RStrings() (v []string, err *Err)
func (*ByteBuffer) RUint8 ¶
func (b *ByteBuffer) RUint8() (v uint8, err *Err)
func (*ByteBuffer) RUint8s ¶
func (b *ByteBuffer) RUint8s() (v []uint8, err *Err)
func (*ByteBuffer) RUint16 ¶
func (b *ByteBuffer) RUint16() (v uint16, err *Err)
func (*ByteBuffer) RUint16MUint16 ¶
func (b *ByteBuffer) RUint16MUint16() (m map[uint16]uint16, err *Err)
func (*ByteBuffer) RUint16s ¶
func (b *ByteBuffer) RUint16s() (v []uint16, err *Err)
func (*ByteBuffer) RUint32 ¶
func (b *ByteBuffer) RUint32() (v uint32, err *Err)
func (*ByteBuffer) RUint32s ¶
func (b *ByteBuffer) RUint32s() (v []uint32, err *Err)
func (*ByteBuffer) RUint64 ¶
func (b *ByteBuffer) RUint64() (v uint64, err *Err)
func (*ByteBuffer) RUint64s ¶
func (b *ByteBuffer) RUint64s() (v []uint64, err *Err)
func (*ByteBuffer) RVec2 ¶
func (b *ByteBuffer) RVec2() (v Vec2, err *Err)
func (*ByteBuffer) RVec2s ¶
func (b *ByteBuffer) RVec2s() (v []Vec2, err *Err)
func (*ByteBuffer) RVec3 ¶
func (b *ByteBuffer) RVec3() (v Vec3, err *Err)
func (*ByteBuffer) RVec3s ¶
func (b *ByteBuffer) RVec3s() (v []Vec3, err *Err)
func (*ByteBuffer) Read ¶
func (b *ByteBuffer) Read(p []byte) (n int, err error)
func (*ByteBuffer) Reset ¶
func (b *ByteBuffer) Reset()
func (*ByteBuffer) ResetWithCap ¶
func (b *ByteBuffer) ResetWithCap(cap int)
ResetWithCap 重置并预分配指定容量
func (*ByteBuffer) SetPos ¶
func (b *ByteBuffer) SetPos(v int)
func (*ByteBuffer) ToHex ¶
func (b *ByteBuffer) ToHex() string
func (*ByteBuffer) WAny ¶
func (b *ByteBuffer) WAny(v any) *Err
func (*ByteBuffer) WAny2 ¶
func (b *ByteBuffer) WAny2(m map[any]any) (err *Err)
func (*ByteBuffer) WAnyMAny ¶
func (b *ByteBuffer) WAnyMAny(m map[any]any) *Err
func (*ByteBuffer) WBool ¶
func (b *ByteBuffer) WBool(v bool)
func (*ByteBuffer) WBools ¶
func (b *ByteBuffer) WBools(v []bool)
func (*ByteBuffer) WBytes ¶
func (b *ByteBuffer) WBytes(v []byte)
func (*ByteBuffer) WErr ¶
func (b *ByteBuffer) WErr(err *Err) *Err
func (*ByteBuffer) WFloat32 ¶
func (b *ByteBuffer) WFloat32(v float32)
func (*ByteBuffer) WFloat32s ¶
func (b *ByteBuffer) WFloat32s(v []float32)
func (*ByteBuffer) WFloat64 ¶
func (b *ByteBuffer) WFloat64(v float64)
func (*ByteBuffer) WFloat64s ¶
func (b *ByteBuffer) WFloat64s(v []float64)
func (*ByteBuffer) WInt ¶
func (b *ByteBuffer) WInt(v int)
func (*ByteBuffer) WInt8 ¶
func (b *ByteBuffer) WInt8(v int8)
func (*ByteBuffer) WInt8s ¶
func (b *ByteBuffer) WInt8s(v []int8)
func (*ByteBuffer) WInt16 ¶
func (b *ByteBuffer) WInt16(v int16)
func (*ByteBuffer) WInt16s ¶
func (b *ByteBuffer) WInt16s(v []int16)
func (*ByteBuffer) WInt32 ¶
func (b *ByteBuffer) WInt32(v int32)
func (*ByteBuffer) WInt32MInt32 ¶
func (b *ByteBuffer) WInt32MInt32(m map[int32]int32)
func (*ByteBuffer) WInt32MInt64 ¶
func (b *ByteBuffer) WInt32MInt64(m map[int32]int64)
func (*ByteBuffer) WInt32s ¶
func (b *ByteBuffer) WInt32s(v []int32)
func (*ByteBuffer) WInt64 ¶
func (b *ByteBuffer) WInt64(v int64)
func (*ByteBuffer) WInt64MInt32 ¶
func (b *ByteBuffer) WInt64MInt32(m map[int64]int32)
func (*ByteBuffer) WInt64MInt64 ¶
func (b *ByteBuffer) WInt64MInt64(m map[int64]int64)
func (*ByteBuffer) WInt64s ¶
func (b *ByteBuffer) WInt64s(v []int64)
func (*ByteBuffer) WInts ¶
func (b *ByteBuffer) WInts(v []int)
func (*ByteBuffer) WJson ¶
func (b *ByteBuffer) WJson(o any) *Err
func (*ByteBuffer) WMAny ¶
func (b *ByteBuffer) WMAny(m M) *Err
func (*ByteBuffer) WMInt32 ¶
func (b *ByteBuffer) WMInt32(m map[string]int32)
func (*ByteBuffer) WMInt64 ¶
func (b *ByteBuffer) WMInt64(m map[string]int64)
func (*ByteBuffer) WMStr ¶
func (b *ByteBuffer) WMStr(m MS)
func (*ByteBuffer) WMUint32 ¶
func (b *ByteBuffer) WMUint32(m map[string]uint32)
func (*ByteBuffer) WMUint64 ¶
func (b *ByteBuffer) WMUint64(m map[string]uint64)
func (*ByteBuffer) WShortString ¶
func (b *ByteBuffer) WShortString(v string)
func (*ByteBuffer) WString ¶
func (b *ByteBuffer) WString(v string)
func (*ByteBuffer) WStringNoLen ¶
func (b *ByteBuffer) WStringNoLen(v string)
func (*ByteBuffer) WStrings ¶
func (b *ByteBuffer) WStrings(v []string)
func (*ByteBuffer) WUint8 ¶
func (b *ByteBuffer) WUint8(v uint8)
func (*ByteBuffer) WUint8s ¶
func (b *ByteBuffer) WUint8s(v []uint8)
func (*ByteBuffer) WUint16 ¶
func (b *ByteBuffer) WUint16(v uint16)
func (*ByteBuffer) WUint16MUint16 ¶
func (b *ByteBuffer) WUint16MUint16(m map[uint16]uint16)
func (*ByteBuffer) WUint16s ¶
func (b *ByteBuffer) WUint16s(v []uint16)
func (*ByteBuffer) WUint32 ¶
func (b *ByteBuffer) WUint32(v uint32)
func (*ByteBuffer) WUint32s ¶
func (b *ByteBuffer) WUint32s(v []uint32)
func (*ByteBuffer) WUint64 ¶
func (b *ByteBuffer) WUint64(v uint64)
func (*ByteBuffer) WUint64s ¶
func (b *ByteBuffer) WUint64s(v []uint64)
func (*ByteBuffer) WVec2 ¶
func (b *ByteBuffer) WVec2(v Vec2)
func (*ByteBuffer) WVec2s ¶
func (b *ByteBuffer) WVec2s(v []Vec2)
func (*ByteBuffer) WVec3 ¶
func (b *ByteBuffer) WVec3(v Vec3)
func (*ByteBuffer) WVec3s ¶
func (b *ByteBuffer) WVec3s(v []Vec3)
func (*ByteBuffer) Write ¶
func (b *ByteBuffer) Write(v []byte) (int, error)
func (*ByteBuffer) WriteStrings ¶
func (b *ByteBuffer) WriteStrings(strs ...string)
WriteStrings 批量写入字符串,减少多次扩容
type Command ¶
type Command[T any] struct { // contains filtered or unexported fields }
func (*Command[T]) Bind ¶
func (c *Command[T]) Bind(name string, handler CmdHandler[T])
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
type Enable ¶
type Err ¶
type Err struct {
// contains filtered or unexported fields
}
type FnInt64Any ¶
func (FnInt64Any) Invoke ¶
func (f FnInt64Any) Invoke(v int64, obj any)
type FnInt64Err ¶
func (FnInt64Err) Invoke ¶
func (f FnInt64Err) Invoke(v int64, err *Err)
type FnInt64M ¶
type FnInt64Str ¶
func (FnInt64Str) Invoke ¶
func (f FnInt64Str) Invoke(v int64, str string)
type FnInt642 ¶
type IMsg ¶
type IMsg interface {
ProtoReflect() protoreflect.Message
}
type M ¶
type Num ¶
type TErrCode ¶
type TErrCode = int32
const ( EcCriticalMin TErrCode = 0 EcNil TErrCode = 0 // 空引用 EcRecover TErrCode = 1 // 恢复错误 EcServiceErr TErrCode = 2 // 服务错误 EcSystemMin TErrCode = 100 EcIo TErrCode = 100 // io错误 EcTimeout TErrCode = 101 // 超时 EcConnectErr TErrCode = 102 // 连接错误 EcListenErr TErrCode = 103 // 监听错误 EcAcceptErr TErrCode = 104 // 接受错误 EcAddrErr TErrCode = 105 // 获取地址错误 EcIllegalConn TErrCode = 106 // 非法连接 EcTooManyConn TErrCode = 107 // 连接过多 EcWriteFail TErrCode = 108 // 写失败 EcDbErr TErrCode = 109 // 数据库错误 EcRedisErr TErrCode = 110 // redis错误 EcBusinessMin TErrCode = 200 EcParamsErr TErrCode = 200 // 参数错误 EcEmpty TErrCode = 201 // 空 EcTooLong TErrCode = 202 // 太长 EcOutOfRange TErrCode = 203 // 越界 EcWrongType TErrCode = 204 // 错误类型 EcType TErrCode = 205 // 错误类型 EcParseErr TErrCode = 206 // 解析错误 EcExist TErrCode = 207 // 已存在 EcNotExist TErrCode = 208 // 不存在 EcClosed TErrCode = 209 // 已关闭 EcNotEnough TErrCode = 210 // 容量不足 EcNotImplement TErrCode = 211 // 未实现 EcMarshallErr TErrCode = 212 // 序列化错误 EcUnmarshallErr TErrCode = 213 // 反序列化错误 EcBadHead TErrCode = 214 // 错误的消息头 EcBadPacket TErrCode = 215 // 错误的消息包 EcEmptyPacket TErrCode = 216 // 空包 EcNoAuth TErrCode = 217 // 没有权限 EcResFail TErrCode = 218 //响应错误 )
type Tuple5 ¶
type Tuple5[T1, T2, T3, T4, T5 any] struct { Item1 T1 Item2 T2 Item3 T3 Item4 T4 Item5 T5 }
type Vec2 ¶
type Vec2Int ¶
Source Files
¶
- alias.go
- any.go
- bytes_buffer.go
- cmd.go
- counter.go
- ctx.go
- enable.go
- err.go
- err_levels.go
- gob.go
- http.go
- id.go
- json.go
- m.go
- mask.go
- math.go
- msg.go
- net.go
- num.go
- path.go
- pool.go
- profile.go
- rand.go
- slice.go
- string.go
- time.go
- tuple.go
- vec.go
Click to show internal directories.
Click to hide internal directories.