Documentation
¶
Overview ¶
Package encoding provides functions for working with conversions of numbers, structures, strings and bytes.
Package functions: 1. HexEncode/HexDecode 2. Uint64ToBytes/BytesToUint64 3. SerializeJSON/DeserializeJSON 4. SerializeYAML/DeserializeYAML
Index ¶
- Constants
- Variables
- func BytesToUint32(pBytes [CSizeUint32]byte) uint32
- func BytesToUint64(pBytes [CSizeUint64]byte) uint64
- func DeserializeJSON(pData []byte, pRes interface{}) error
- func DeserializeYAML(pData []byte, pRes interface{}) error
- func HexDecode(pData string) []byte
- func HexEncode(pData []byte) string
- func SerializeJSON(pData interface{}) []byte
- func SerializeYAML(pData interface{}) []byte
- func Uint32ToBytes(pNum uint32) [CSizeUint32]byte
- func Uint64ToBytes(pNum uint64) [CSizeUint64]byte
- type SEncodingError
Constants ¶
View Source
const ( CSizeUint32 = 4 // bytes CSizeUint64 = 8 // bytes )
Variables ¶
View Source
var (
ErrDeserialize = &SEncodingError{"deserialize bytes"}
)
Functions ¶
func BytesToUint32 ¶ added in v1.6.11
func BytesToUint32(pBytes [CSizeUint32]byte) uint32
Slice of bytes to uint32 by big endian.
func BytesToUint64 ¶
func BytesToUint64(pBytes [CSizeUint64]byte) uint64
Slice of bytes to uint64 by big endian.
func DeserializeJSON ¶ added in v1.5.22
func DeserializeYAML ¶ added in v1.5.22
func SerializeJSON ¶ added in v1.5.22
func SerializeJSON(pData interface{}) []byte
func SerializeYAML ¶ added in v1.5.22
func SerializeYAML(pData interface{}) []byte
func Uint32ToBytes ¶ added in v1.6.11
func Uint32ToBytes(pNum uint32) [CSizeUint32]byte
Uint32 to slice of bytes by big endian.
func Uint64ToBytes ¶
func Uint64ToBytes(pNum uint64) [CSizeUint64]byte
Uint64 to slice of bytes by big endian.
Types ¶
type SEncodingError ¶ added in v1.6.8
type SEncodingError struct {
// contains filtered or unexported fields
}
func (*SEncodingError) Error ¶ added in v1.6.8
func (err *SEncodingError) Error() string
Click to show internal directories.
Click to hide internal directories.