encoding

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 6 Imported by: 6

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

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 DeserializeJSON(pData []byte, pRes interface{}) error

func DeserializeYAML added in v1.5.22

func DeserializeYAML(pData []byte, pRes interface{}) error

func HexDecode

func HexDecode(pData string) []byte

func HexEncode

func HexEncode(pData []byte) string

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

Jump to

Keyboard shortcuts

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