Documentation ¶
Index ¶
- func AssertEqual(a interface{}, b interface{}) error
- func AssertInequal(a interface{}, b interface{}) error
- func BeheadStrings(sarr []string) (string, []string)
- func JSONForHTTPRequest(object interface{}) *bytes.Reader
- func MkTemp() string
- func RandString(randopt string, length int) string
- func ReadAllClose(clsr io.ReadCloser) ([]byte, error)
- func ReadSufficient(rd io.Reader, buffer []byte, expectLen uint64) (uint64, error)
- func WriteArbitraryStringToFile(filename string, content string, flag int) error
- func WriteSufficient(wr io.Writer, buffer []byte, expectLen uint64) (uint64, error)
- type ByteBuffer
- type LockedList
- type WaitOnce
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
func AssertEqual(a interface{}, b interface{}) error
AssertEqual returns error if a != b
func AssertInequal ¶
func AssertInequal(a interface{}, b interface{}) error
AssertInequal returns error if a != b
func BeheadStrings ¶
BeheadStrings splits the first element in the array and rest of them
func JSONForHTTPRequest ¶
JSONForHTTPRequest is the fast path to create reader to send on unmarshal failure, return empty json object.
func MkTemp ¶
func MkTemp() string
MkTemp generates temporary filename depends on current time and added some randomization..
func RandString ¶
RandString returns a random string with given length
func ReadAllClose ¶
func ReadAllClose(clsr io.ReadCloser) ([]byte, error)
ReadAllClose works like ioutil.ReadAll, but will close the object.
func ReadSufficient ¶
ReadSufficient retry until sufficient bytes are read from reader, or fail with error reported.
func WriteArbitraryStringToFile ¶
WriteArbitraryStringToFile do as it says. saves your time.
Types ¶
type ByteBuffer ¶ added in v1.1.0
type ByteBuffer struct {
// contains filtered or unexported fields
}
func NewByteBuffer ¶ added in v1.1.0
func NewByteBuffer(buf []byte) *ByteBuffer
func (*ByteBuffer) Make ¶ added in v1.1.0
func (buf *ByteBuffer) Make() []byte
func (*ByteBuffer) Progress ¶ added in v1.1.0
func (buf *ByteBuffer) Progress(prog int) *ByteBuffer
type LockedList ¶
type LockedList struct {
// contains filtered or unexported fields
}
LockedList is a linked list with mutex. Front() and Back() is not provided, since accessing them in concurrent environment is never safe. Size() is provided but strongly against using it. it is very useful when you need thread safe log accumulators. performance problem exists.
func (*LockedList) PopFront ¶
func (ll *LockedList) PopFront() interface{}
PopFront explains itself.
func (*LockedList) PushBack ¶
func (ll *LockedList) PushBack(elem interface{})
PushBack explains itself.
func (*LockedList) PushFront ¶
func (ll *LockedList) PushFront(elem interface{})
PushFront explains itself.
type WaitOnce ¶
type WaitOnce struct {
// contains filtered or unexported fields
}
WaitOnce executes exactly once. When the function is called and not returned, other calls to this will be blocked.
func NewWaitOnce ¶
func NewWaitOnce() *WaitOnce
NewWaitOnce creates a WaitOnce Object that can share