command

package
v0.0.0-...-31b8dc0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeBool = uint8(iota)
	TypeInt
	TypeFloat
	TypeBytes
	TypeString
	TypeList
	TypeMap
	TypeSet
	TypeSortedSet
	TypeBuffer
	TypeEnd
)

Variables

This section is empty.

Functions

func ValueToBytes

func ValueToBytes(value Value) ([]byte, error)

Types

type Cmd

type Cmd = uint8
const (
	IStart Cmd = iota
	IExists
	IIncrement
	IDecrement

	RStart
	RSet
	RGet

	EStart
	ECompareAndSwap
)

R: command key value I: command key E: command key value...

type Command

type Command struct {
	Command uint8
	Key     string
	Value   Value
	Values  []Value
}

func Parse

func Parse(reader io.Reader) (Command, error)

type Type

type Type = uint8

func TypeFromBytes

func TypeFromBytes(data []byte) (Type, error)

type Value

type Value struct {
	Type        Type
	Size        int
	Value       []byte
	Values      []Value
	ValueMap    map[string]Value
	ValueSet    map[string]Value
	ValueBuffer *queue.RingBuffer
}

Value represents a Nyandis value. It can be a boolean, integer, float, byte array, string, list, map, set, or buffer.

func BytesToValue

func BytesToValue(data []byte) (Value, error)

func NewBool

func NewBool(value bool) Value

func NewBuffer

func NewBuffer(size int) Value

func NewByteArray

func NewByteArray(value []byte) Value

func NewFloat

func NewFloat(value float64) Value

func NewInt

func NewInt(value int64) Value

func NewList

func NewList(values []any) Value

func NewMap

func NewMap(values map[string]any) Value

func NewString

func NewString(value string) Value

func (Value) Hash

func (v Value) Hash() string

Jump to

Keyboard shortcuts

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