Documentation ¶
Overview ¶
公用包 Autor: 不得闲 QQ:75492895
从fasthttp中变更过来的GoRoutine池 Autor: 不得闲 QQ:75492895
仿Delphi的通用类库 GStringList类似于TStringList Autor: 不得闲 QQ:75492895
时间轮询调度池,只用一个定时器来实现After等超时设定,默认轮渡器设定为1个小时,精度为500毫秒 如果要使用更精确的定时器,请使用NewTimeWheelWorker自己指定定时器时间,目前在我的电脑上测试来看,最精确能到2毫秒 Autor: 不得闲 QQ:75492895
Index ¶
- Constants
- Variables
- func After(d time.Duration) <-chan struct{}
- func AfterFunc(d time.Duration, afunc func())
- func Binary2Hex(bt []byte) string
- func CoarseTimeNow() time.Time
- func CompareMem(a, b unsafe.Pointer, size int) bool
- func CopyMemory(to, from unsafe.Pointer, n uintptr)
- func DelphiPchar2String(dstr uintptr) string
- func DelphiPcharLen(dstr uintptr) (result int32)
- func EscapeJsonStr(str string) string
- func FastByte2String(bt []byte) string
- func FastBytes2Uint16s(bt []byte) []uint16
- func FastDelphiPchar2String(pcharstr uintptr) string
- func FastPchar2String(pcharstr uintptr) string
- func FastString2Byte(str string) []byte
- func GBK2Utf8(gbk []byte) ([]byte, error)
- func GBKString(str string) ([]byte, error)
- func Hex2Binary(hexStr string) []byte
- func ModePermStr2FileMode(permStr string) (result os.FileMode)
- func Ord(b bool) byte
- func ParserEscapeStr(bvalue []byte) string
- func Pchar2String(pcharstr uintptr) string
- func PcharLen(dstr uintptr) int
- func Post(runner ITaskRunner)
- func PostFunc(routineFunc GWorkerFunc, params ...interface{})
- func ReSetDefaultTimeWheel(Chkinterval time.Duration, slotBlockCount int)
- func Sleep(d time.Duration)
- func StopWorkers()
- func UTF16Byte2string(utf16bt []byte, isBigEnd bool) string
- func ZeroByteSlice(bt []byte)
- func ZeroMemory(ptr unsafe.Pointer, n uintptr)
- type DxBits
- func (bt *DxBits) AsInt32() int32
- func (bt *DxBits) AsInt64() int64
- func (bt *DxBits) AsUInt32() uint32
- func (bt *DxBits) AsUInt64() uint64
- func (bt *DxBits) Bits(index uint) bool
- func (bt *DxBits) CheckedCount() uint
- func (bt *DxBits) Clear()
- func (bt *DxBits) Count() uint
- func (bt *DxBits) NotBits(index int)
- func (bt *DxBits) ReSet(bsize uint)
- func (bt *DxBits) ReSetByInt32(v int32)
- func (bt *DxBits) ReSetByInt64(v int64)
- func (bt *DxBits) SetBits(index uint, v bool)
- type FileCodeMode
- type FileOpenMode
- type GDxBaseObject
- type GFileStream
- func (stream *GFileStream) Close()
- func (stream *GFileStream) FilePosition() int64
- func (stream *GFileStream) FlushBuffer() error
- func (stream *GFileStream) Position() int
- func (stream *GFileStream) Read(buffer []byte) (n int, err error)
- func (stream *GFileStream) ReadAt(p []byte, off int64) (n int, err error)
- func (stream *GFileStream) ReadByte() (byte, error)
- func (stream *GFileStream) ReadFrom(r io.Reader) (n int64, err error)
- func (stream *GFileStream) Seek(offset int64, whence int) (int64, error)
- func (stream *GFileStream) SetPosition(ps int) error
- func (stream *GFileStream) Size() int64
- func (stream *GFileStream) UnreadByte() error
- func (stream *GFileStream) Write(data []byte) (int, error)
- func (stream *GFileStream) WriteAt(p []byte, off int64) (n int, err error)
- func (stream *GFileStream) WriteByte(c byte) error
- func (stream *GFileStream) WriteTo(w io.Writer) (n int64, err error)
- type GStringList
- func (lst *GStringList) Add(str string)
- func (lst *GStringList) AddPair(Name, Value string)
- func (lst *GStringList) AddSlice(strs []string)
- func (lst *GStringList) AddStrings(strs IStrings)
- func (lst *GStringList) AsSlice() []string
- func (lst *GStringList) Clear()
- func (lst *GStringList) Count() int
- func (lst *GStringList) Delete(index int)
- func (lst *GStringList) IndexOf(str string) int
- func (lst *GStringList) IndexOfName(Name string) int
- func (lst *GStringList) Insert(Index int, str string)
- func (lst *GStringList) LineBreakStr() string
- func (lst *GStringList) LoadFromFile(fileName string)
- func (lst *GStringList) Names(Index int) string
- func (lst *GStringList) SaveToFile(fileName string)
- func (lst *GStringList) SetStrings(index int, str string)
- func (lst *GStringList) SetText(text string)
- func (lst *GStringList) Strings(index int) string
- func (lst *GStringList) Text() string
- func (lst *GStringList) ValueByName(Name string) string
- func (lst *GStringList) ValueFromIndex(index int) string
- type GWorkerFunc
- type GWorkers
- type IDxInheritedObject
- type IStrings
- type ITaskRunner
- type LineBreakMode
- type TDateTime
- type TimeWheelWorker
Constants ¶
View Source
const ( MinsPerHour = 60 MinsPerDay = 24 * MinsPerHour SecsPerDay = MinsPerDay * 60 MSecsPerDay = SecsPerDay * 1000 )
Variables ¶
View Source
var (
IsAmd64 = runtime.GOARCH == "amd64"
)
Functions ¶
func CoarseTimeNow ¶
func DelphiPchar2String ¶
将Delphi的Pchar转换到string,Unicode
func DelphiPcharLen ¶
func FastByte2String ¶
func FastBytes2Uint16s ¶
func FastDelphiPchar2String ¶
func FastPchar2String ¶
func ModePermStr2FileMode ¶
将drwxrwx这些转化为 FileMode
func ParserEscapeStr ¶
解码转义字符,将"\u6821\u56ed\u7f51\t02%20得闲"这类字符串,解码成正常显示的字符串
func Post ¶
func Post(runner ITaskRunner)
func PostFunc ¶
func PostFunc(routineFunc GWorkerFunc, params ...interface{})
func ReSetDefaultTimeWheel ¶
func StopWorkers ¶
func StopWorkers()
func UTF16Byte2string ¶
func ZeroByteSlice ¶
func ZeroByteSlice(bt []byte)
Types ¶
type DxBits ¶
type DxBits struct {
// contains filtered or unexported fields
}
用来存放位
func (*DxBits) ReSetByInt32 ¶
func (*DxBits) ReSetByInt64 ¶
type FileCodeMode ¶
type FileCodeMode uint8 //文件格式
const ( File_Code_Unknown FileCodeMode = iota File_Code_Utf8 File_Code_Utf16BE File_Code_Utf16LE File_Code_GBK )
type FileOpenMode ¶
type FileOpenMode int //文件打开方式
const ( FMCreate FileOpenMode = FileOpenMode(os.O_CREATE | os.O_WRONLY | os.O_TRUNC) FMOpenRead FileOpenMode = FileOpenMode(os.O_RDONLY) FMOpenWrite FileOpenMode = FileOpenMode(os.O_WRONLY) // | os.O_APPEND) FMOpenReadWrite FileOpenMode = FileOpenMode(os.O_RDWR) // | os.O_APPEND) )
type GDxBaseObject ¶
type GDxBaseObject struct { UseData interface{} //用户数据 // contains filtered or unexported fields }
func (*GDxBaseObject) Destroy ¶
func (obj *GDxBaseObject) Destroy()
func (*GDxBaseObject) Free ¶
func (obj *GDxBaseObject) Free()
func (*GDxBaseObject) LastedSubChild ¶
func (obj *GDxBaseObject) LastedSubChild() interface{}
func (*GDxBaseObject) SubChild ¶
func (obj *GDxBaseObject) SubChild(idx int) interface{}
func (*GDxBaseObject) SubChildCount ¶
func (obj *GDxBaseObject) SubChildCount() int
func (*GDxBaseObject) SubInit ¶
func (obj *GDxBaseObject) SubInit(subObj interface{})
type GFileStream ¶
type GFileStream struct {
// contains filtered or unexported fields
}
func NewFileStream ¶
func NewFileStream(fileName string, openMode FileOpenMode, bufferSize int) (*GFileStream, error)
func (*GFileStream) Close ¶
func (stream *GFileStream) Close()
func (*GFileStream) FilePosition ¶
func (stream *GFileStream) FilePosition() int64
func (*GFileStream) FlushBuffer ¶
func (stream *GFileStream) FlushBuffer() error
func (*GFileStream) Position ¶
func (stream *GFileStream) Position() int
func (*GFileStream) ReadAt ¶
func (stream *GFileStream) ReadAt(p []byte, off int64) (n int, err error)
ReaderAt interface
func (*GFileStream) ReadFrom ¶
func (stream *GFileStream) ReadFrom(r io.Reader) (n int64, err error)
ReaderFrom interface
func (*GFileStream) SetPosition ¶
func (stream *GFileStream) SetPosition(ps int) error
func (*GFileStream) Size ¶
func (stream *GFileStream) Size() int64
func (*GFileStream) UnreadByte ¶
func (stream *GFileStream) UnreadByte() error
func (*GFileStream) WriteAt ¶
func (stream *GFileStream) WriteAt(p []byte, off int64) (n int, err error)
WriterAt interface
func (*GFileStream) WriteByte ¶
func (stream *GFileStream) WriteByte(c byte) error
type GStringList ¶
type GStringList struct { LineBreak LineBreakMode UnknownCodeUseGbk bool //未知编码的时候采用GBK编码打开 // contains filtered or unexported fields }
func (*GStringList) Add ¶
func (lst *GStringList) Add(str string)
func (*GStringList) AddPair ¶
func (lst *GStringList) AddPair(Name, Value string)
func (*GStringList) AddSlice ¶
func (lst *GStringList) AddSlice(strs []string)
func (*GStringList) AddStrings ¶
func (lst *GStringList) AddStrings(strs IStrings)
func (*GStringList) AsSlice ¶
func (lst *GStringList) AsSlice() []string
func (*GStringList) Clear ¶
func (lst *GStringList) Clear()
func (*GStringList) Count ¶
func (lst *GStringList) Count() int
func (*GStringList) Delete ¶
func (lst *GStringList) Delete(index int)
func (*GStringList) IndexOf ¶
func (lst *GStringList) IndexOf(str string) int
func (*GStringList) IndexOfName ¶
func (lst *GStringList) IndexOfName(Name string) int
func (*GStringList) Insert ¶
func (lst *GStringList) Insert(Index int, str string)
func (*GStringList) LineBreakStr ¶
func (lst *GStringList) LineBreakStr() string
func (*GStringList) LoadFromFile ¶
func (lst *GStringList) LoadFromFile(fileName string)
func (*GStringList) Names ¶
func (lst *GStringList) Names(Index int) string
func (*GStringList) SaveToFile ¶
func (lst *GStringList) SaveToFile(fileName string)
func (*GStringList) SetStrings ¶
func (lst *GStringList) SetStrings(index int, str string)
func (*GStringList) SetText ¶
func (lst *GStringList) SetText(text string)
func (*GStringList) Strings ¶
func (lst *GStringList) Strings(index int) string
func (*GStringList) Text ¶
func (lst *GStringList) Text() string
func (*GStringList) ValueByName ¶
func (lst *GStringList) ValueByName(Name string) string
func (*GStringList) ValueFromIndex ¶
func (lst *GStringList) ValueFromIndex(index int) string
type GWorkerFunc ¶
type GWorkerFunc func(data ...interface{})
type GWorkers ¶
type GWorkers struct {
// contains filtered or unexported fields
}
func NewWorkers ¶
func (*GWorkers) Post ¶
func (workers *GWorkers) Post(runner ITaskRunner)
func (*GWorkers) PostFunc ¶
func (workers *GWorkers) PostFunc(routineFunc GWorkerFunc, params ...interface{})
type IDxInheritedObject ¶
type IStrings ¶
type IStrings interface { Count() int Strings(index int) string SetStrings(index int, str string) Text() string SetText(text string) LoadFromFile(fileName string) SaveToFile(fileName string) Add(str string) Insert(Index int, str string) Delete(index int) AddStrings(strs IStrings) AddSlice(strs []string) Clear() IndexOf(str string) int AddPair(Name, Value string) IndexOfName(Name string) int ValueFromIndex(index int) string ValueByName(Name string) string Names(Index int) string AsSlice() []string }
type TDateTime ¶
type TDateTime float64
func ParserJsonTime ¶
Date(1402384458000) Date(1224043200000+0800)
func Time2DelphiTime ¶
func (*TDateTime) WrapTime2Self ¶
type TimeWheelWorker ¶
func NewTimeWheelWorker ¶
func NewTimeWheelWorker(interval time.Duration, slotBlockCount int, tkfunc func()) *TimeWheelWorker
interval指定调度的时间间隔 slotBlockCount指定时间轮的块长度
func (*TimeWheelWorker) After ¶
func (worker *TimeWheelWorker) After(d time.Duration) <-chan struct{}
func (*TimeWheelWorker) AfterFunc ¶
func (worker *TimeWheelWorker) AfterFunc(d time.Duration, afunc func())
func (*TimeWheelWorker) Sleep ¶
func (worker *TimeWheelWorker) Sleep(d time.Duration)
func (*TimeWheelWorker) Stop ¶
func (worker *TimeWheelWorker) Stop()
Click to show internal directories.
Click to hide internal directories.