base

package module
v0.0.0-...-b55f968 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 20 Imported by: 0

README

base

基础开发包

Documentation

Index

Constants

View Source
const HANDLE_FILE_FLAG_WRITER = os.O_WRONLY | os.O_APPEND | os.O_CREATE
View Source
const HANDLE_FILE_PERM_ALL = 0777
View Source
const INT32_MAX = int32(^uint32(0) >> 1)
View Source
const INT32_MIN = ^UINT32_MAX
View Source
const UINT32_MAX uint32 = ^UINT32_MIN
View Source
const UINT32_MIN uint32 = 0

Variables

This section is empty.

Functions

func AbsFloat32

func AbsFloat32(n float32) float32

func AbsFloat64

func AbsFloat64(n float64) float64

func AbsInt32

func AbsInt32(n int32) int32

func AbsInt64

func AbsInt64(n int64) int64

func AtoInt

func AtoInt(s string) (int, error)

func AtoInt64

func AtoInt64(s string) (x int64, err error)

func Caller

func Caller(skip int) (file string, line int)

调用信息长文件名

func CallerInFunc

func CallerInFunc(skip int) (name string, file string, line int)

func CallerLineStack

func CallerLineStack(stack string) (name string, file string, line int, success bool)

func CallerShort

func CallerShort(skip int) (file string, line int)

调用信息短文件名

func CreateFuncForCodePtr

func CreateFuncForCodePtr(outFuncPtr interface{}, codePtr uintptr) (err error)

func DeepCopy

func DeepCopy(src interface{}) interface{}

func Exception

func Exception(catch func(stack string, e error))

func ExecDir

func ExecDir() string

程序执行路径

func FindFuncWithName

func FindFuncWithName(name string) (uintptr, error)

func Float32

func Float32(value interface{}) (float32, error)

func Float64

func Float64(value interface{}) (float64, error)

func GZipCompress

func GZipCompress(data []byte) []byte

func GZipUnCompress

func GZipUnCompress(data []byte) ([]byte, error)

func GetFunc

func GetFunc(outFuncPtr interface{}, name string) (err error)

func Int

func Int(value interface{}) (int, error)

func Int16

func Int16(value interface{}) (int16, error)

func Int32

func Int32(value interface{}) (int32, error)

func Int64

func Int64(value interface{}) (int64, error)

func Int8

func Int8(value interface{}) (int8, error)

func IsExist

func IsExist(path string) (bool, error)

文件或文件夹是否存在

func IsExistFolder

func IsExistFolder(path string) (bool, error)

文件夹是否存在

func IsUTF8

func IsUTF8(buf []byte) bool

func ItoA

func ItoA(dst *[]byte, i int, w int)

func ItoAW

func ItoAW(dst *[]byte, i int, w int)

func NewError

func NewError(format string, a ...interface{}) error

func OpenFile

func OpenFile(folderPath string, fileName string, flag int, perm os.FileMode) (file *os.File, err error)

打开文件 自动创建目录

func OpenFileB

func OpenFileB(filePath string, flag int, perm os.FileMode) (file *os.File, err error)

打开文件 自动创建目录

func ProgramDir

func ProgramDir() string

程序所在路径

func Round

func Round(value float64, digit int) float64

func ToFloat32

func ToFloat32(value interface{}) (float32, error)

func ToFloat64

func ToFloat64(value interface{}) (float64, error)

func ToInt

func ToInt(value interface{}) (int, error)

func ToInt16

func ToInt16(value interface{}) (int16, error)

func ToInt32

func ToInt32(value interface{}) (int32, error)

func ToInt64

func ToInt64(value interface{}) (int64, error)

func ToInt8

func ToInt8(value interface{}) (int8, error)

func ToString

func ToString(value interface{}) (string, error)

func ToUint

func ToUint(value interface{}) (uint, error)

func ToUint16

func ToUint16(value interface{}) (uint16, error)

func ToUint32

func ToUint32(value interface{}) (uint32, error)

func ToUint64

func ToUint64(value interface{}) (uint64, error)

func ToUint8

func ToUint8(value interface{}) (uint8, error)

func Try

func Try(f func(), Catch func(stack string, e error))

func Type

func Type(value interface{}) reflect.Type

func Uint

func Uint(value interface{}) (uint, error)

func Uint16

func Uint16(value interface{}) (uint16, error)

func Uint32

func Uint32(value interface{}) (uint32, error)

func Uint64

func Uint64(value interface{}) (uint64, error)

func Uint8

func Uint8(value interface{}) (uint8, error)

func ZLibCompress

func ZLibCompress(data []byte) []byte

func ZLibUnCompress

func ZLibUnCompress(data []byte) ([]byte, error)

Types

type Buffer

type Buffer []byte

func NewBuffer

func NewBuffer(size int) *Buffer

func (*Buffer) AppendByte

func (buf *Buffer) AppendByte(b byte)

func (*Buffer) AppendBytes

func (buf *Buffer) AppendBytes(bs ...byte)

func (*Buffer) AppendFloat

func (buf *Buffer) AppendFloat(f float64)

func (*Buffer) AppendInt

func (buf *Buffer) AppendInt(n, w int)

func (*Buffer) AppendString

func (buf *Buffer) AppendString(s string)

func (*Buffer) AppendStrings

func (buf *Buffer) AppendStrings(ss ...string)

func (*Buffer) Bytes

func (buf *Buffer) Bytes() []byte

func (*Buffer) Cap

func (buf *Buffer) Cap() int

func (*Buffer) Clear

func (buf *Buffer) Clear()

func (*Buffer) Free

func (buf *Buffer) Free()

func (*Buffer) ToString

func (buf *Buffer) ToString() string

type HandleFile

type HandleFile struct {
	// contains filtered or unexported fields
}

func NewHandleFile

func NewHandleFile(flag int, perm os.FileMode) *HandleFile

func OpenHandleFile

func OpenHandleFile(folderPath string, fileName string, flag int, perm os.FileMode) (*HandleFile, error)

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) Write

func (my *HandleFile) Write(b []byte) (n int, err error)

func (*HandleFile) WriteString

func (my *HandleFile) WriteString(s string) (n int, err error)

type IntSortedSet

type IntSortedSet struct {
	SortedSet
}

func NewIntSortedSet

func NewIntSortedSet(reverse bool) *IntSortedSet

type LRUCache

type LRUCache struct {
	// contains filtered or unexported fields
}

func NewLRUCache

func NewLRUCache(size int) *LRUCache

func (*LRUCache) Get

func (my *LRUCache) Get(key interface{}) (interface{}, bool)

func (*LRUCache) Len

func (my *LRUCache) Len() int

func (*LRUCache) Remove

func (my *LRUCache) Remove(key interface{})

func (*LRUCache) Set

func (my *LRUCache) Set(key interface{}, value interface{})

func (*LRUCache) Size

func (my *LRUCache) Size() int

type SortedSet

type SortedSet struct {
	// contains filtered or unexported fields
}

func NewSortedSet

func NewSortedSet(cmp func(min, max interface{}) int) *SortedSet

func (*SortedSet) Add

func (my *SortedSet) Add(v interface{})

func (*SortedSet) Back

func (my *SortedSet) Back() (back interface{}, found bool)

func (*SortedSet) Clear

func (my *SortedSet) Clear()

func (*SortedSet) Del

func (my *SortedSet) Del(index int) bool

func (*SortedSet) Difference

func (my *SortedSet) Difference(b *SortedSet) *SortedSet

func (*SortedSet) Find

func (my *SortedSet) Find(v interface{}) (index int, found bool)

func (*SortedSet) Front

func (my *SortedSet) Front() (front interface{}, found bool)

func (*SortedSet) Get

func (my *SortedSet) Get(index int) (v interface{}, found bool)

func (*SortedSet) Intersection

func (my *SortedSet) Intersection(b *SortedSet) *SortedSet

func (*SortedSet) Remove

func (my *SortedSet) Remove(v interface{}) bool

func (*SortedSet) Union

func (my *SortedSet) Union(b *SortedSet) *SortedSet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL