v3

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringT = ttType(iota + 1)
	BytesT
	Int8T
	Int16T
	Int32T
	Int64T
	Uint8T
	Uint16T
	Uint32T
	Uint64T
	BoolT
	Float32T
	Float64T

	MapT
	ArrT
)

Variables

View Source
var (
	//ErrInvalidInput is used for when the input it invalid
	ErrInvalidInput = errors.New("invalid input")
)

Functions

func AddValue

func AddValue(out io.Writer, v *Value, varintbuf *[binary.MaxVarintLen64 + 1]byte)

AddValue is just a wrapper around v.Tobytes

func BoolFromBytes

func BoolFromBytes(buf []byte) bool

BoolFromBytes converts bytes into a bool

func BoolToBytes

func BoolToBytes(b bool) []byte

BoolToBytes converts a bool into bytes

func Float32FromBytes

func Float32FromBytes(buf []byte) float32

Float32FromBytes bytes into a float32

func Float32ToBytes

func Float32ToBytes(f *float32) []byte

Float32ToBytes converts a float32 into bytes

func Float64FromBytes

func Float64FromBytes(buf []byte) float64

Float64FromBytes bytes into a float64

func Float64ToBytes

func Float64ToBytes(f float64, buf *[8]byte)

Float64ToBytes converts a float64 into bytes

func Int16FromBytes

func Int16FromBytes(buf []byte) int16

Int16FromBytes converts bytes into an int16

func Int16ToBytes

func Int16ToBytes(f int16) []byte

Int16ToBytes converts a int16 into bytes

func Int32FromBytes

func Int32FromBytes(buf []byte) int32

Int32FromBytes converts bytes into an int32

func Int32ToBytes

func Int32ToBytes(f int32) []byte

Int32ToBytes converts a int32 into bytes

func Int64FromBytes

func Int64FromBytes(buf []byte) int64

Int64FromBytes converts bytes into an int64

func Int64ToBytes

func Int64ToBytes(f int64) []byte

Int64ToBytes converts a int64 into bytes

func Int8FromBytes

func Int8FromBytes(buf byte) int8

Int8FromBytes converts bytes into an int8

func Int8ToBytes

func Int8ToBytes(u int8) byte

Int8ToBytes converts a int8 into bytes

func StringFromBytes

func StringFromBytes(b []byte) string

StringFromBytes converts bytes to a string

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes converts a string to bytes

func Uint16FromBytes

func Uint16FromBytes(buf []byte) uint16

Uint16FromBytes converts bytes into an uint16

func Uint16ToBytes

func Uint16ToBytes(f uint16) []byte

Uint16ToBytes converts a uint16 into bytes

func Uint32FromBytes

func Uint32FromBytes(buf []byte) uint32

Uint32FromBytes converts bytes into an uint32

func Uint32ToBytes

func Uint32ToBytes(f uint32) []byte

Uint32ToBytes converts a uint32 into bytes

func Uint64FromBytes

func Uint64FromBytes(buf []byte) uint64

Uint64FromBytes converts bytes into an uint64

func Uint64ToBytes

func Uint64ToBytes(f uint64) []byte

Uint64ToBytes converts a uint64 into bytes

func Uint8FromBytes

func Uint8FromBytes(buf byte) uint8

Uint8FromBytes converts bytes into an uint8

func Uint8ToBytes

func Uint8ToBytes(u uint8) byte

Uint8ToBytes converts a uint8 into bytes

Types

type KeyValue added in v0.8.0

type KeyValue struct {
	Value []byte //the key to the data of this object in its final form
	Vtype ttType //the type of the data of this object in its final form
}

KeyValue is the key used for storing the key/value

func (*KeyValue) ExportStructID added in v0.8.0

func (k *KeyValue) ExportStructID() string

ExportStructID returns a string identifying the value

type Reader

type Reader interface {
	io.Reader
	io.ByteReader
}

Reader merges io.reader and io.ByteReader

type Value

type Value struct {
	Key   KeyValue //the key of this object in its final form
	Value KeyValue //the value of this object in its final form
	//Value  []byte   //the key to the data of this object in its final form
	//Vtype     ttType   //the type of the data of this object in its final form
	Childrenn uint64
}

Value is the type that contains the value data

func (*Value) FromBytes

func (v *Value) FromBytes(in Reader, limit uint64) error

FromBytes reads bytes from a v3.Reader into Value

func (*Value) Tobytes

func (v *Value) Tobytes(out io.Writer, varintbuf *[binary.MaxVarintLen64 + 1]byte)

Tobytes writes te Value into a io.Writer

Jump to

Keyboard shortcuts

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