misc

package
v0.0.0-...-750c461 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: BSD-3-Clause-Clear Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NullUUID	a zero value uuid
	NullUUID = MakeUUID(0, 0, 0, 0)
)

Functions

func CloneStringMap

func CloneStringMap(m map[string]string) map[string]string

func InitStdinReader

func InitStdinReader() chan interface{}

func MakeError

func MakeError(errInfo string) error

MakeError creates new error info

func MakeErrorChain

func MakeErrorChain(errInfo string, extErr error) error

MakeErrorChain creates new error chain

func SplitStringEx

func SplitStringEx(s string, sep byte) []string

SplitStringEx split string into []string, unescape each escaped string

func SplitStringN

func SplitStringN(s string, sep byte, n int) []string

SplitStringN split string into []string with maximum length n

func UnescapeBytes

func UnescapeBytes(dest []byte, src []byte) []byte

func UnescapeStr

func UnescapeStr(s string) string

unescape \r \n \t \\ etc..

func WriteStdinInput

func WriteStdinInput(str string) error

func WriteStdinInputCB

func WriteStdinInputCB(str string, callback func(string) error) error

Types

type ChainError

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

ChainError - generic chained error information

func (*ChainError) Error

func (e *ChainError) Error() string

type GenericError

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

GenericError - generic error information

func (*GenericError) Error

func (e *GenericError) Error() string

type InputObj

type InputObj struct {
	Cmd      string
	Callback func(string) error
}

type List

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

List container object

func NewList

func NewList() *List

NewList create a list object

func (*List) Back

func (l *List) Back() *ListElement

Back return last element

func (*List) Front

func (l *List) Front() *ListElement

Front return first element

func (*List) Init

func (l *List) Init() *List

Init initialize/reset the list

func (*List) Len

func (l *List) Len() int

Len return number of elements

func (*List) PopFront

func (l *List) PopFront() *ListElement

PopFront removes first element from the list, and keep the element available, user still can iterate the list removed element keeps the list nodes, users who keeps the element will cause memory leak

func (*List) PushBack

func (l *List) PushBack(v interface{}) *ListElement

PushBack append a new element at the tail

func (*List) Remove

func (l *List) Remove(e *ListElement) *ListElement

Remove removes e from its list, and keep the element available, user still can iterate the list removed element keeps the list nodes, users who keeps the element will cause memory leak

type ListElement

type ListElement struct {
	Value interface{}
	// contains filtered or unexported fields
}

ListElement - list node element

func (*ListElement) GetList

func (e *ListElement) GetList() *List

GetList return owner list

func (*ListElement) Next

func (e *ListElement) Next() *ListElement

Next iterate to next sibling element

func (*ListElement) Prev

func (e *ListElement) Prev() *ListElement

Prev iterate to previous sibling element

type TraceReader

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

func WrapTraceReader

func WrapTraceReader(r io.Reader) *TraceReader

func WrapTraceReaderEx

func WrapTraceReaderEx(r io.Reader, cacheSize int, opQueueSize int) *TraceReader

func (*TraceReader) Read

func (tr *TraceReader) Read(buf []byte) (int, error)

func (*TraceReader) TraceBack

func (tr *TraceReader) TraceBack(offset int) ([]byte, error)

func (*TraceReader) TraceCount

func (tr *TraceReader) TraceCount() int

type TraceReaderWriter

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

func TraceWrapReaderWriter

func TraceWrapReaderWriter(rw io.ReadWriter) *TraceReaderWriter

func (*TraceReaderWriter) Read

func (rw *TraceReaderWriter) Read(buf []byte) (int, error)

func (*TraceReaderWriter) TraceBackRead

func (rw *TraceReaderWriter) TraceBackRead(offset int) ([]byte, error)

func (*TraceReaderWriter) TraceBackWrite

func (rw *TraceReaderWriter) TraceBackWrite(offset int) ([]byte, error)

func (*TraceReaderWriter) TraceCountRead

func (rw *TraceReaderWriter) TraceCountRead() int

func (*TraceReaderWriter) TraceCountWrite

func (rw *TraceReaderWriter) TraceCountWrite() int

func (*TraceReaderWriter) Write

func (rw *TraceReaderWriter) Write(buf []byte) (int, error)

type TraceWriter

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

func WrapTraceWriter

func WrapTraceWriter(w io.Writer) *TraceWriter

func WrapTraceWriterEx

func WrapTraceWriterEx(w io.Writer, cacheSize int, opQueueSize int) *TraceWriter

func (*TraceWriter) TraceBack

func (tr *TraceWriter) TraceBack(offset int) ([]byte, error)

func (*TraceWriter) TraceCount

func (tr *TraceWriter) TraceCount() int

func (*TraceWriter) Write

func (tr *TraceWriter) Write(buf []byte) (int, error)

type UUID

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

UUID unique id type

func MakeUUID

func MakeUUID(v1 uint32, v2 uint32, v3 uint32, v4 uint32) UUID

MakeUUID create new user defined UUID

func NewUUID

func NewUUID() UUID

NewUUID generates a new random UUID

func NewUUID2

func NewUUID2() *UUID

NewUUID2 generates a new random UUID

func ParseUUID

func ParseUUID(data string) UUID

func ParseUUIDEx

func ParseUUIDEx(data []byte) UUID

func (UUID) GetRef

func (uuid UUID) GetRef() *UUID

func (*UUID) MarshalJSON

func (uuid *UUID) MarshalJSON() ([]byte, error)

MarshalJSON serialize UUID into JSON bytes

func (UUID) String

func (uuid UUID) String() string

func (*UUID) UnmarshalJSON

func (uuid *UUID) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialize UUID object from JSON bytes

func (*UUID) Value

func (uuid *UUID) Value() [4]uint32

Value return four 32-bits unsigned integer values

Jump to

Keyboard shortcuts

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