val

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 20

Documentation

Overview

Handles values and conversion from Go's native scalar values

Index

Constants

View Source
const NotEmpty = NotEmptyType("<not empty>")

Variables

This section is empty.

Functions

func CompareVals

func CompareVals(a []Value, b []Value) int

func ConvOneOf

func ConvOneOf(f []Format, val interface{}) (Value, Format, error)

func Equal

func Equal(a Value, b Value) bool

func EqualVals

func EqualVals(a []Value, b []Value) bool

func ForEach

func ForEach(v Value, f Eacher)

func Reduce

func Reduce(v Value, initial interface{}, f Reducer) interface{}

Types

type Any

type Any struct {
	Thing interface{}
}

func (Any) Format

func (Any) Format() Format

func (Any) String

func (x Any) String() string

func (Any) Value

func (x Any) Value() interface{}

type Binary

type Binary []byte

func (Binary) Compare

func (x Binary) Compare(y Comparable) int

func (Binary) Format

func (Binary) Format() Format

func (Binary) String

func (x Binary) String() string

func (Binary) Value

func (x Binary) Value() interface{}

type BinaryList

type BinaryList [][]byte

func (BinaryList) Compare

func (x BinaryList) Compare(y Comparable) int

func (BinaryList) Format

func (BinaryList) Format() Format

func (BinaryList) String

func (x BinaryList) String() string

func (BinaryList) Value

func (x BinaryList) Value() interface{}

type Bits

type Bits []byte

func (Bits) Format

func (Bits) Format() Format

func (Bits) String

func (b Bits) String() string

func (Bits) Value

func (b Bits) Value() interface{}

type BitsList

type BitsList [][]byte

func (BitsList) Format

func (BitsList) Format() Format

func (BitsList) String

func (b BitsList) String() string

func (BitsList) Value

func (b BitsList) Value() interface{}

type Bool

type Bool bool

func (Bool) Compare

func (x Bool) Compare(y Comparable) int

func (Bool) Format

func (Bool) Format() Format

func (Bool) String

func (x Bool) String() string

func (Bool) Value

func (x Bool) Value() interface{}

type BoolList

type BoolList []bool

func (BoolList) Format

func (BoolList) Format() Format

func (BoolList) Item

func (x BoolList) Item(i int) Value

func (BoolList) Len

func (x BoolList) Len() int

func (BoolList) String

func (x BoolList) String() string

func (BoolList) Value

func (x BoolList) Value() interface{}

type Comparable

type Comparable interface {
	Value
	Compare(Comparable) int
}

type Decimal64

type Decimal64 float64

func (Decimal64) Compare

func (x Decimal64) Compare(b Comparable) int

func (Decimal64) Format

func (Decimal64) Format() Format

func (Decimal64) String

func (x Decimal64) String() string

func (Decimal64) Value

func (x Decimal64) Value() interface{}

type Decimal64List

type Decimal64List []float64

func (Decimal64List) Format

func (Decimal64List) Format() Format

func (Decimal64List) Item

func (x Decimal64List) Item(i int) Value

func (Decimal64List) Len

func (x Decimal64List) Len() int

func (Decimal64List) String

func (x Decimal64List) String() string

func (Decimal64List) Value

func (x Decimal64List) Value() interface{}

type Eacher

type Eacher func(index int, v Value)

type Enum

type Enum struct {
	Id    int
	Label string
}

func (Enum) Compare

func (x Enum) Compare(b Comparable) int

func (Enum) Empty

func (x Enum) Empty() bool

func (Enum) Format

func (Enum) Format() Format

func (Enum) String

func (x Enum) String() string

func (Enum) Value

func (x Enum) Value() interface{}

type EnumList

type EnumList []Enum

func (EnumList) Add

func (x EnumList) Add(e string) EnumList

func (EnumList) ById

func (e EnumList) ById(id int) (Enum, bool)

func (EnumList) ByLabel

func (e EnumList) ByLabel(label string) (Enum, bool)

func (EnumList) Format

func (EnumList) Format() Format

func (EnumList) Ids

func (e EnumList) Ids() []int

func (EnumList) Item

func (x EnumList) Item(i int) Value

func (EnumList) Labels

func (e EnumList) Labels() []string

func (EnumList) Len

func (x EnumList) Len() int

func (EnumList) NextId

func (e EnumList) NextId() int

func (EnumList) String

func (e EnumList) String() string

func (EnumList) Value

func (x EnumList) Value() interface{}

type Format

type Format int
const (
	FmtBinary Format = iota + 1
	FmtBits
	FmtBool
	FmtDecimal64
	FmtEmpty
	FmtEnum
	FmtIdentityRef
	FmtInstanceRef
	FmtInt8
	FmtInt16
	FmtInt32
	FmtInt64
	FmtLeafRef
	FmtString
	FmtUInt8
	FmtUInt16
	FmtUInt32
	FmtUInt64
	FmtUnion
	FmtAny
)
const (
	FmtBinaryList      Format = iota + 1025
	FmtBitsList               //1026
	FmtBoolList               //1027
	FmtDecimal64List          //1028
	FmtEmptyList              //1029
	FmtEnumList               //1030
	FmtIdentityRefList        //1031
	FmtInstanceRefList        //1032
	FmtInt8List               //1033
	FmtInt16List              //1034
	FmtInt32List              //1035
	FmtInt64List              //1036
	FmtLeafRefList            //1037
	FmtStringList             //1038
	FmtUInt8List              //1039
	FmtUInt16List             //1040
	FmtUInt32List             //1041
	FmtUInt64List             //1042
	FmtUnionList              //1043
	FmtAnyList                //1044
)

func TypeAsFormat

func TypeAsFormat(typeIdent string) (Format, bool)

func (Format) IsList

func (f Format) IsList() bool

func (Format) IsNumeric

func (f Format) IsNumeric() bool

func (Format) Single

func (f Format) Single() Format

func (Format) String

func (f Format) String() string

type IdentRef

type IdentRef struct {
	Base  string
	Label string
}

func (IdentRef) Compare

func (x IdentRef) Compare(b Comparable) int

func (IdentRef) Empty

func (x IdentRef) Empty() bool

func (IdentRef) Format

func (IdentRef) Format() Format

func (IdentRef) String

func (x IdentRef) String() string

func (IdentRef) Value

func (x IdentRef) Value() interface{}

type IdentRefList

type IdentRefList []IdentRef

func (IdentRefList) ByLabel

func (e IdentRefList) ByLabel(label string) (IdentRef, bool)

func (IdentRefList) Format

func (IdentRefList) Format() Format

func (IdentRefList) Item

func (x IdentRefList) Item(i int) Value

func (IdentRefList) Labels

func (e IdentRefList) Labels() []string

func (IdentRefList) Len

func (x IdentRefList) Len() int

func (IdentRefList) String

func (e IdentRefList) String() string

func (IdentRefList) Value

func (x IdentRefList) Value() interface{}

type Int16

type Int16 int16

func (Int16) Compare

func (x Int16) Compare(y Comparable) int

func (Int16) Format

func (Int16) Format() Format

func (Int16) Int64

func (x Int16) Int64() int64

func (Int16) String

func (x Int16) String() string

func (Int16) Value

func (x Int16) Value() interface{}

type Int16List

type Int16List []int16

func (Int16List) Format

func (Int16List) Format() Format

func (Int16List) Item

func (x Int16List) Item(i int) Value

func (Int16List) Len

func (x Int16List) Len() int

func (Int16List) String

func (x Int16List) String() string

func (Int16List) Value

func (x Int16List) Value() interface{}

type Int32

type Int32 int

func (Int32) Compare

func (x Int32) Compare(y Comparable) int

func (Int32) Format

func (Int32) Format() Format

func (Int32) Int64

func (x Int32) Int64() int64

func (Int32) String

func (x Int32) String() string

func (Int32) Value

func (x Int32) Value() interface{}

type Int32List

type Int32List []int

func (Int32List) Format

func (Int32List) Format() Format

func (Int32List) Item

func (x Int32List) Item(i int) Value

func (Int32List) Len

func (x Int32List) Len() int

func (Int32List) String

func (x Int32List) String() string

func (Int32List) Value

func (x Int32List) Value() interface{}

type Int64

type Int64 int64

func (Int64) Compare

func (x Int64) Compare(b Comparable) int

func (Int64) Format

func (Int64) Format() Format

func (Int64) Int64

func (x Int64) Int64() int64

func (Int64) String

func (x Int64) String() string

func (Int64) Value

func (x Int64) Value() interface{}

type Int64List

type Int64List []int64

func (Int64List) Format

func (Int64List) Format() Format

func (Int64List) Item

func (x Int64List) Item(i int) Value

func (Int64List) Len

func (x Int64List) Len() int

func (Int64List) String

func (x Int64List) String() string

func (Int64List) Value

func (x Int64List) Value() interface{}

type Int64able

type Int64able interface {
	Int64() int64
}

type Int8

type Int8 int8

func (Int8) Compare

func (x Int8) Compare(y Comparable) int

func (Int8) Format

func (Int8) Format() Format

func (Int8) Int64

func (x Int8) Int64() int64

func (Int8) String

func (x Int8) String() string

func (Int8) Value

func (x Int8) Value() interface{}

type Int8List

type Int8List []int8

func (Int8List) Format

func (Int8List) Format() Format

func (Int8List) Item

func (x Int8List) Item(i int) Value

func (Int8List) Len

func (x Int8List) Len() int

func (Int8List) String

func (x Int8List) String() string

func (Int8List) Value

func (x Int8List) Value() interface{}

type Listable

type Listable interface {
	Value
	Len() int
	Item(index int) Value
}

type NotEmptyType

type NotEmptyType string

func (NotEmptyType) Format

func (NotEmptyType) Format() Format

func (NotEmptyType) String

func (NotEmptyType) String() string

func (NotEmptyType) Value

func (NotEmptyType) Value() interface{}

type Reducer

type Reducer func(index int, v Value, data interface{}) interface{}

type String

type String string

func (String) Compare

func (x String) Compare(b Comparable) int

func (String) Format

func (String) Format() Format

func (String) String

func (x String) String() string

func (String) Value

func (x String) Value() interface{}

type StringList

type StringList []string

func (StringList) Format

func (StringList) Format() Format

func (StringList) Item

func (x StringList) Item(i int) Value

func (StringList) Len

func (x StringList) Len() int

func (StringList) String

func (x StringList) String() string

func (StringList) Value

func (x StringList) Value() interface{}

type UInt16

type UInt16 uint16

func (UInt16) Compare

func (x UInt16) Compare(b Comparable) int

func (UInt16) Format

func (UInt16) Format() Format

func (UInt16) Int64

func (x UInt16) Int64() int64

func (UInt16) String

func (x UInt16) String() string

func (UInt16) Value

func (x UInt16) Value() interface{}

type UInt16List

type UInt16List []uint16

func (UInt16List) Format

func (UInt16List) Format() Format

func (UInt16List) Item

func (x UInt16List) Item(i int) Value

func (UInt16List) Len

func (x UInt16List) Len() int

func (UInt16List) String

func (x UInt16List) String() string

func (UInt16List) Value

func (x UInt16List) Value() interface{}

type UInt32

type UInt32 uint

func (UInt32) Compare

func (x UInt32) Compare(b Comparable) int

func (UInt32) Format

func (UInt32) Format() Format

func (UInt32) Int64

func (x UInt32) Int64() int64

func (UInt32) String

func (x UInt32) String() string

func (UInt32) Value

func (x UInt32) Value() interface{}

type UInt32List

type UInt32List []uint

func (UInt32List) Format

func (UInt32List) Format() Format

func (UInt32List) Item

func (x UInt32List) Item(i int) Value

func (UInt32List) Len

func (x UInt32List) Len() int

func (UInt32List) String

func (x UInt32List) String() string

func (UInt32List) Value

func (x UInt32List) Value() interface{}

type UInt64

type UInt64 uint

func (UInt64) Compare

func (x UInt64) Compare(b Comparable) int

func (UInt64) Format

func (UInt64) Format() Format

func (UInt64) String

func (x UInt64) String() string

func (UInt64) Value

func (x UInt64) Value() interface{}

type UInt64List

type UInt64List []uint64

func (UInt64List) Format

func (UInt64List) Format() Format

func (UInt64List) Item

func (x UInt64List) Item(i int) Value

func (UInt64List) Len

func (x UInt64List) Len() int

func (UInt64List) String

func (x UInt64List) String() string

func (UInt64List) Value

func (x UInt64List) Value() interface{}

type UInt8

type UInt8 uint8

func (UInt8) Compare

func (x UInt8) Compare(b Comparable) int

func (UInt8) Format

func (UInt8) Format() Format

func (UInt8) Int64

func (x UInt8) Int64() int64

func (UInt8) String

func (x UInt8) String() string

func (UInt8) Value

func (x UInt8) Value() interface{}

type UInt8List

type UInt8List []uint8

func (UInt8List) Format

func (UInt8List) Format() Format

func (UInt8List) Item

func (x UInt8List) Item(i int) Value

func (UInt8List) Len

func (x UInt8List) Len() int

func (UInt8List) String

func (x UInt8List) String() string

func (UInt8List) Value

func (x UInt8List) Value() interface{}

type Value

type Value interface {
	Format() Format
	Value() interface{}
	String() string
}

func Conv

func Conv(f Format, val interface{}) (Value, error)

Jump to

Keyboard shortcuts

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