tilde

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBoolArray

func FromBoolArray(s BoolArray) []bool

func FromDataArray

func FromDataArray(s DataArray) [][]byte

func FromDigestArray

func FromDigestArray(s DigestArray) [][]byte

func FromFloatArray

func FromFloatArray(s FloatArray) []float64

func FromIntArray

func FromIntArray(s IntArray) []int64

func FromStringArray

func FromStringArray(s StringArray) []string

func FromUintArray

func FromUintArray(s UintArray) []uint64

Types

type ArrayValue

type ArrayValue interface {
	Value
	Len() int
	Range(func(int, Value) (stop bool))
	// contains filtered or unexported methods
}

TODO switch Range's stop?

type Bool

type Bool bool

basic types

func (Bool) Hash

func (v Bool) Hash() Digest

func (Bool) Hint

func (v Bool) Hint() Hint

func (*Bool) UnmarshalJSON

func (v *Bool) UnmarshalJSON(b []byte) error

type BoolArray

type BoolArray []Bool

array types

func ToBoolArray

func ToBoolArray(s []bool) BoolArray

func (BoolArray) Hash

func (v BoolArray) Hash() Digest

func (BoolArray) Hint

func (v BoolArray) Hint() Hint

func (BoolArray) Len

func (v BoolArray) Len() int

func (BoolArray) Range

func (v BoolArray) Range(f func(int, Value) bool)

type Data

type Data []byte

func (Data) Hash

func (v Data) Hash() Digest

func (Data) Hint

func (v Data) Hint() Hint

func (*Data) UnmarshalJSON

func (v *Data) UnmarshalJSON(b []byte) error

type DataArray

type DataArray []Data

func ToDataArray

func ToDataArray(s [][]byte) DataArray

func (DataArray) Hash

func (v DataArray) Hash() Digest

func (DataArray) Hint

func (v DataArray) Hint() Hint

func (DataArray) Len

func (v DataArray) Len() int

func (DataArray) Range

func (v DataArray) Range(f func(int, Value) bool)

type Digest

type Digest string

Note(geoah): Digest should probably have been bytes, but it has been defined as a string simply cause comparing bytes in go is annoying.

const (
	EmptyDigest Digest = ""
)

func Hash

func Hash(v Value) Digest

func SortDigests

func SortDigests(a []Digest) []Digest

SortDigests sorts a slice of Digestes in increasing order, and returns it. The return part is mostly for allowing this to be used as a helper method in tests.

func (Digest) Bytes

func (v Digest) Bytes() ([]byte, error)

func (Digest) Equal

func (v Digest) Equal(h Digest) bool

func (Digest) Hash

func (v Digest) Hash() Digest

func (Digest) Hint

func (v Digest) Hint() Hint

func (Digest) IsEmpty

func (v Digest) IsEmpty() bool

func (Digest) String

func (v Digest) String() string

type DigestArray

type DigestArray []Digest

func ToDigestArray

func ToDigestArray(s [][]byte) DigestArray

func (DigestArray) Hash

func (v DigestArray) Hash() Digest

func (DigestArray) Hint

func (v DigestArray) Hint() Hint

func (DigestArray) Len

func (v DigestArray) Len() int

func (DigestArray) Range

func (v DigestArray) Range(f func(int, Value) bool)

type Float

type Float float64

func (Float) Hash

func (v Float) Hash() Digest

func (Float) Hint

func (v Float) Hint() Hint

func (*Float) UnmarshalJSON

func (v *Float) UnmarshalJSON(b []byte) error

type FloatArray

type FloatArray []Float

func ToFloatArray

func ToFloatArray(s []float64) FloatArray

func (FloatArray) Hash

func (v FloatArray) Hash() Digest

func (FloatArray) Hint

func (v FloatArray) Hint() Hint

func (FloatArray) Len

func (v FloatArray) Len() int

func (FloatArray) Range

func (v FloatArray) Range(f func(int, Value) bool)

type Hint

type Hint string
const (
	// basic hints
	BoolHint   Hint = "b"
	DataHint   Hint = "d"
	FloatHint  Hint = "f"
	IntHint    Hint = "i"
	MapHint    Hint = "m"
	StringHint Hint = "s"
	UintHint   Hint = "u"
	DigestHint Hint = "r"
	// array hints
	BoolArrayHint   Hint = "ab"
	DataArrayHint   Hint = "ad"
	FloatArrayHint  Hint = "af"
	IntArrayHint    Hint = "ai"
	MapArrayHint    Hint = "am"
	ObjectArrayHint Hint = "ao"
	StringArrayHint Hint = "as"
	UintArrayHint   Hint = "au"
	DigestArrayHint Hint = "ar"
)

func ExtractHint

func ExtractHint(key string) (string, Hint, error)

type Int

type Int int64

func (Int) Hash

func (v Int) Hash() Digest

func (Int) Hint

func (v Int) Hint() Hint

func (*Int) UnmarshalJSON

func (v *Int) UnmarshalJSON(b []byte) error

type IntArray

type IntArray []Int

func ToIntArray

func ToIntArray(s []int64) IntArray

func (IntArray) Hash

func (v IntArray) Hash() Digest

func (IntArray) Hint

func (v IntArray) Hint() Hint

func (IntArray) Len

func (v IntArray) Len() int

func (IntArray) Range

func (v IntArray) Range(f func(int, Value) bool)

type Map

type Map map[string]Value

func (Map) Hash

func (v Map) Hash() Digest

func (Map) Hint

func (v Map) Hint() Hint

func (Map) MarshalJSON

func (v Map) MarshalJSON() ([]byte, error)

func (Map) UnmarshalJSON

func (v Map) UnmarshalJSON(b []byte) error

type MapArray

type MapArray []Map

func (MapArray) Hash

func (v MapArray) Hash() Digest

func (MapArray) Hint

func (v MapArray) Hint() Hint

func (MapArray) Len

func (v MapArray) Len() int

func (MapArray) Range

func (v MapArray) Range(f func(int, Value) bool)

type Slice

type Slice []Digest

func (Slice) Len

func (p Slice) Len() int

func (Slice) Less

func (p Slice) Less(i, j int) bool

func (Slice) Sort

func (p Slice) Sort()

func (Slice) Swap

func (p Slice) Swap(i, j int)

type String

type String string

func (String) Hash

func (v String) Hash() Digest

func (String) Hint

func (v String) Hint() Hint

type StringArray

type StringArray []String

func ToStringArray

func ToStringArray(s []string) StringArray

func (StringArray) Hash

func (v StringArray) Hash() Digest

func (StringArray) Hint

func (v StringArray) Hint() Hint

func (StringArray) Len

func (v StringArray) Len() int

func (StringArray) Range

func (v StringArray) Range(f func(int, Value) bool)

type Uint

type Uint uint64

func (Uint) Hash

func (v Uint) Hash() Digest

func (Uint) Hint

func (v Uint) Hint() Hint

func (*Uint) UnmarshalJSON

func (v *Uint) UnmarshalJSON(b []byte) error

type UintArray

type UintArray []Uint

func ToUintArray

func ToUintArray(s []uint64) UintArray

func (UintArray) Hash

func (v UintArray) Hash() Digest

func (UintArray) Hint

func (v UintArray) Hint() Hint

func (UintArray) Len

func (v UintArray) Len() int

func (UintArray) Range

func (v UintArray) Range(f func(int, Value) bool)

type Value

type Value interface {
	Hash() Digest
	Hint() Hint
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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