value

package
Version: v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ObjectReferenceSignature = "" /* 338-byte string literal not displayed */
)

Variables

View Source
var (
	// ErrListValueTooLong is returned when reading a list value.
	ErrListValueTooLong = errors.New("list value too long")
	// ErrRawValueTooLong is returned when reading a raw value.
	ErrRawValueTooLong = errors.New("raw value too long")
)

Functions

func Bytes

func Bytes(v Value) []byte

Bytes returns the content of the value (i.e. without the signature).

Types

type BoolValue

type BoolValue bool

BoolValue represents a Value of a boolean.

func (BoolValue) Signature

func (b BoolValue) Signature() string

Signature returns the boolean signature "b".

func (BoolValue) Value

func (b BoolValue) Value() bool

Value returns the actual value.

func (BoolValue) Write

func (b BoolValue) Write(w io.Writer) error

type FloatValue

type FloatValue float32

FloatValue represents a Value of a float32.

func (FloatValue) Signature

func (f FloatValue) Signature() string

Signature returns "f".

func (FloatValue) Value

func (f FloatValue) Value() float32

Value returns the actual value

func (FloatValue) Write

func (f FloatValue) Write(w io.Writer) error

type Int16Value

type Int16Value int16

Int16Value represents a Value of an int16.

func (Int16Value) Signature

func (i Int16Value) Signature() string

Signature returns "w".

func (Int16Value) Value

func (i Int16Value) Value() int16

Value returns the actual value

func (Int16Value) Write

func (i Int16Value) Write(w io.Writer) error

type Int8Value

type Int8Value int8

Int8Value represents a Value of an int8.

func (Int8Value) Signature

func (i Int8Value) Signature() string

Signature returns the signature of an signed char ("c").

func (Int8Value) Value

func (i Int8Value) Value() int8

Value returns the actual value

func (Int8Value) Write

func (i Int8Value) Write(w io.Writer) error

type IntValue

type IntValue int32

IntValue represents a Value of an uint32.

func (IntValue) Signature

func (i IntValue) Signature() string

Signature returns "i".

func (IntValue) Value

func (i IntValue) Value() int32

Value returns the actual value

func (IntValue) Write

func (i IntValue) Write(w io.Writer) error

type ListValue

type ListValue []Value

ListValue represents a list of value.

func (ListValue) Signature

func (l ListValue) Signature() string

Signature returns "[m]".

func (ListValue) Value

func (l ListValue) Value() []Value

Value returns the actual value

func (ListValue) Write

func (l ListValue) Write(w io.Writer) error

type LongValue

type LongValue int64

LongValue represents a Value of a uint64.

func (LongValue) Signature

func (l LongValue) Signature() string

Signature returns "l"

func (LongValue) Value

func (l LongValue) Value() int64

Value returns the actual value

func (LongValue) Write

func (l LongValue) Write(w io.Writer) error

type OpaqueValue

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

OpaqueValue represents a value using a signature and the data.

func (*OpaqueValue) Signature

func (o *OpaqueValue) Signature() string

Signature returns the signature of the value.

func (*OpaqueValue) Write

func (o *OpaqueValue) Write(w io.Writer) error

Write the value.

type RawValue

type RawValue []byte

RawValue represents an array of byte.

func (RawValue) Signature

func (b RawValue) Signature() string

Signature returns "r".

func (RawValue) Value

func (b RawValue) Value() []byte

Value returns the actual value

func (RawValue) Write

func (b RawValue) Write(w io.Writer) error

type StringValue

type StringValue string

StringValue represents a Value of a string.

func (StringValue) Signature

func (s StringValue) Signature() string

Signature returns "s".

func (StringValue) Value

func (s StringValue) Value() string

Value returns the actual value

func (StringValue) Write

func (s StringValue) Write(w io.Writer) error

type Uint16Value

type Uint16Value uint16

Uint16Value represents a Value of an uint16.

func (Uint16Value) Signature

func (i Uint16Value) Signature() string

Signature returns "W"

func (Uint16Value) Value

func (i Uint16Value) Value() uint16

Value returns the actual value

func (Uint16Value) Write

func (i Uint16Value) Write(w io.Writer) error

type Uint8Value

type Uint8Value uint8

Uint8Value represents a Value of an uint8.

func (Uint8Value) Signature

func (i Uint8Value) Signature() string

Signature returns the signature of an unsigned char.

func (Uint8Value) Value

func (i Uint8Value) Value() uint8

Value returns the actual value

func (Uint8Value) Write

func (i Uint8Value) Write(w io.Writer) error

type UintValue

type UintValue uint32

UintValue represents a Value of an uint32.

func (UintValue) Signature

func (i UintValue) Signature() string

Signature returns "I".

func (UintValue) Value

func (i UintValue) Value() uint32

Value returns the actual value

func (UintValue) Write

func (i UintValue) Write(w io.Writer) error

type UlongValue

type UlongValue uint64

UlongValue represents a Value of a uint64.

func (UlongValue) Signature

func (l UlongValue) Signature() string

Signature returns "L".

func (UlongValue) Value

func (l UlongValue) Value() uint64

Value returns the actual value

func (UlongValue) Write

func (l UlongValue) Write(w io.Writer) error

type Value

type Value interface {
	Signature() string
	Write(w io.Writer) error
}

Value represents a value whose type in unknown at compile time. The value can be an integer, a float, a boolean, a long or a string. When serialized, the signature of the true type is sent followed by the actual value.

func Bool

func Bool(b bool) Value

Bool constructs a Value.

func Float

func Float(f float32) Value

Float contructs a Value.

func Int

func Int(i int32) Value

Int constructs a Value.

func Int16

func Int16(i int16) Value

Int16 constructs a Value.

func Int8

func Int8(i int8) Value

Int8 constructs a Value.

func List

func List(l []Value) Value

List constructs a Value.

func Long

func Long(l int64) Value

Long constructs a Value.

func NewValue

func NewValue(r io.Reader) (Value, error)

NewValue reads a value from a reader. The value is constructed in two times: first the signature of the value is read from the reader, then depending on the actual type, the value is read.

func Opaque

func Opaque(signature string, data []byte) Value

Opaque creates a Value (an OpaqueValue).

func Raw

func Raw(b []byte) Value

Raw constructs a Value.

func String

func String(s string) Value

String constructs a Value.

func Uint

func Uint(i uint32) Value

Uint constructs a Value.

func Uint16

func Uint16(i uint16) Value

Uint16 constructs a Value.

func Uint8

func Uint8(i uint8) Value

Uint8 constructs a Value corresponding to an unsigned char.

func Ulong

func Ulong(l uint64) Value

Ulong constructs a Value.

func Void

func Void() Value

Void returns an empty value

type VoidValue

type VoidValue struct{}

VoidValue represents nothing.

func (VoidValue) Signature

func (b VoidValue) Signature() string

Signature returns "v".

func (VoidValue) Write

func (b VoidValue) Write(w io.Writer) error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL