Documentation ¶
Overview ¶
Package util defines some utility functions for Golang.
Index ¶
- func ByteString(b []byte) string
- func FromUint32(b []byte, i uint32)
- func GetDateBytes(buf []byte, year int, month int, day int) []byte
- func GetIntBytes(buf []byte, i int64) []byte
- func GetNsecBytes(buf []byte, nsec int) []byte
- func GetTimeBytes(buf []byte, hour int, min int, sec int) []byte
- func GetUintBytes(buf []byte, u uint64) []byte
- func Itoa(i int) string
- func LocalProxy(proxy, local interface{}) error
- func Max(a, b int) int
- func Min(a, b int) int
- func StringByte(s string) []byte
- func ToUint32(b []byte) uint32
- func UTF16Length(str string) (n int)
- func UUIDv4() (uid string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteString ¶
ByteString converts []byte to string without memory allocation by block magic
func GetDateBytes ¶
GetDateBytes returns the []byte representation of year, month and day. The format of []byte returned is 20060102 buf length must be greater than or equal to 8
func GetIntBytes ¶
GetIntBytes returns the []byte representation of i in base 10. buf length must be greater than or equal to 20
func GetNsecBytes ¶
GetNsecBytes returns the []byte representation of nsec. The format of []byte returned is 123, 123456 or 123456789 buf length must be greater than or equal to 9
func GetTimeBytes ¶
GetTimeBytes returns the []byte representation of hour, min and sec. The format of []byte returned is 150405 buf length must be greater than or equal to 6
func GetUintBytes ¶
GetUintBytes returns the []byte representation of u in base 10. buf length must be greater than or equal to 20
func LocalProxy ¶
func LocalProxy(proxy, local interface{}) error
LocalProxy make a local object to a proxy struct
func StringByte ¶
StringByte converts string to string without memory allocation by block magic
func UTF16Length ¶
UTF16Length return the UTF16 length of str. str must be an UTF8 encode string, otherwise return -1.
Types ¶
This section is empty.