Documentation ¶
Index ¶
- func AESDecrypt(message string, key string) (decrypted string, err error)
- func AESEncrypt(message string, key string) (encrypted string, err error)
- 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 MakeError(contents ...interface{}) error
- 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 WrapError(e error, contents ...interface{}) 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
- type WrappedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecrypt ¶ added in v1.3.0
AESDecrypt decrypts the message using the given key. Only accept messages conforming to what returned by AESEncrypt().
func AESEncrypt ¶ added in v1.3.0
AESEncrypt encrypts the message using the given key. the key is md5 hashed to support any length. Result is base64 encoded to support transporting in multiple format.
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.
type WrappedError ¶ added in v1.2.0
type WrappedError struct {
// contains filtered or unexported fields
}
func (WrappedError) Error ¶ added in v1.2.0
func (we WrappedError) Error() string
func (WrappedError) Unwrap ¶ added in v1.2.0
func (we WrappedError) Unwrap() error