kv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryDecoder

type BinaryDecoder struct {
	// contains filtered or unexported fields
}

func NewBinaryDecoder

func NewBinaryDecoder(r io.Reader) *BinaryDecoder

func (*BinaryDecoder) Decode

func (d *BinaryDecoder) Decode(kv KeyValue) error

type BinaryEncoder

type BinaryEncoder struct {
	// contains filtered or unexported fields
}

func NewBinaryEncoder

func NewBinaryEncoder(w io.Writer) *BinaryEncoder

func (*BinaryEncoder) Encode

func (e *BinaryEncoder) Encode(kv KeyValue) error

type KeyValue

type KeyValue interface {
	// Type returns the node's Type.
	Type() Type
	// SetType sets the node's Type and returns the receiver.
	SetType(Type) KeyValue
	// Key returns the node's Key.
	Key() string
	// SetKey sets the node's Key and returns the receiver.
	SetKey(key string) KeyValue
	// Value returns the node's Value.
	Value() string
	// SetValue sets the node's Value and returns the receiver.
	SetValue(value string) KeyValue
	// Parent returns the parent node.
	Parent() KeyValue
	// SetParent sets the node's parent node and returns the receiver.
	SetParent(KeyValue) KeyValue
	// Children returns all child nodes
	Children() []KeyValue
	// SetChildren sets the node's children and returns the receiver.
	SetChildren(...KeyValue) KeyValue
	// Child finds a child node with the given key.
	Child(key string) KeyValue
	// AddChild adds a child node and returns the receiver.
	AddChild(KeyValue) KeyValue
	// AddObject adds an Object child node and returns the receiver.
	AddObject(key string) KeyValue
	// AddString adds a String child node and returns the receiver.
	AddString(key, value string) KeyValue
	// AddInt32 adds an Int32 child node and returns the receiver.
	AddInt32(key, value string) KeyValue
	// AddInt64 adds an Int64 child node and returns the receiver.
	AddInt64(key, value string) KeyValue
	// AddUint64 adds an Uint64 child node and returns the receiver.
	AddUint64(key, value string) KeyValue
	// AddFloat32 adds a Float32 child node and returns the receiver.
	AddFloat32(key, value string) KeyValue
	// AddColor adds a Color child node and returns the receiver.
	AddColor(key, value string) KeyValue
	// AddPointer adds a Pointer child node and returns the receiver.
	AddPointer(key, value string) KeyValue

	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

KeyValue represents a recursive string key to arbitrary value container.

func NewKeyValue

func NewKeyValue(t Type, key, value string, parent KeyValue) KeyValue

func NewKeyValueColor

func NewKeyValueColor(key, value string, parent KeyValue) KeyValue

func NewKeyValueEmpty

func NewKeyValueEmpty() KeyValue

func NewKeyValueFloat32

func NewKeyValueFloat32(key, value string, parent KeyValue) KeyValue

func NewKeyValueInt32

func NewKeyValueInt32(key, value string, parent KeyValue) KeyValue

func NewKeyValueInt64

func NewKeyValueInt64(key, value string, parent KeyValue) KeyValue

func NewKeyValueObject

func NewKeyValueObject(key string, parent KeyValue) KeyValue

func NewKeyValuePointer

func NewKeyValuePointer(key, value string, parent KeyValue) KeyValue

func NewKeyValueRoot

func NewKeyValueRoot(key string) KeyValue

func NewKeyValueString

func NewKeyValueString(key, value string, parent KeyValue) KeyValue

func NewKeyValueUint64

func NewKeyValueUint64(key, value string, parent KeyValue) KeyValue

type TextEncoder

type TextEncoder struct {
	// contains filtered or unexported fields
}

func NewTextEncoder

func NewTextEncoder(w io.Writer) *TextEncoder

func (*TextEncoder) Encode

func (e *TextEncoder) Encode(kv KeyValue) error

type Type

type Type int8
const (
	TypeInvalid    Type = iota - 1 // -1
	TypeObject                     // 0x00
	TypeString                     // 0x01
	TypeInt32                      // 0x02
	TypeFloat32                    // 0x03
	TypePointer                    // 0x04
	TypeWideString                 // 0x05
	TypeColor                      // 0x06
	TypeUint64                     // 0x07
	TypeEnd                        // 0x08

	TypeInt64 // 0x0a
)

func TypeFromByte

func TypeFromByte(b byte) Type

func (Type) Byte

func (t Type) Byte() byte

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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