values

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b Sortable) int

Types

type BinaryString

type BinaryString interface {
	Sortable
	// PrefixEnd returns the next binary key that ends this prefix.
	PrefixEnd() BinaryString
}

type Bool

type Bool bool

func (Bool) Compare

func (v Bool) Compare(b Sortable) int

func (Bool) MarshalBinary

func (v Bool) MarshalBinary() ([]byte, error)

func (Bool) MarshalSortable

func (v Bool) MarshalSortable() ([]byte, error)

func (Bool) Native

func (v Bool) Native() interface{}

func (*Bool) NativePtr

func (v *Bool) NativePtr() interface{}

func (*Bool) Primitive

func (v *Bool) Primitive() Primitive

func (Bool) PrimitiveType

func (Bool) PrimitiveType() PrimitiveType

func (*Bool) Sortable

func (v *Bool) Sortable() Sortable

func (Bool) SortableType

func (Bool) SortableType() SortableType

func (Bool) Type

func (Bool) Type() Type

func (*Bool) UnmarshalBinary

func (v *Bool) UnmarshalBinary(p []byte) error

func (*Bool) UnmarshalSortable

func (v *Bool) UnmarshalSortable(p []byte) error

func (*Bool) Value

func (v *Bool) Value() Value

type BoolType

type BoolType struct{}

func (BoolType) New

func (tp BoolType) New() ValueDest

func (BoolType) NewPrimitive

func (BoolType) NewPrimitive() PrimitiveDest

func (BoolType) NewSortable

func (BoolType) NewSortable() SortableDest

type Bytes

type Bytes []byte

func (Bytes) Compare

func (v Bytes) Compare(b Sortable) int

func (Bytes) MarshalBinary

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

func (Bytes) MarshalSortable

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

func (Bytes) Native

func (v Bytes) Native() interface{}

func (*Bytes) NativePtr

func (v *Bytes) NativePtr() interface{}

func (Bytes) PrefixEnd

func (v Bytes) PrefixEnd() BinaryString

PrefixEnd returns the next binary key that ends the prefix.

func (*Bytes) Primitive

func (v *Bytes) Primitive() Primitive

func (Bytes) PrimitiveType

func (Bytes) PrimitiveType() PrimitiveType

func (*Bytes) Sortable

func (v *Bytes) Sortable() Sortable

func (Bytes) SortableType

func (Bytes) SortableType() SortableType

func (Bytes) Type

func (Bytes) Type() Type

func (*Bytes) UnmarshalBinary

func (v *Bytes) UnmarshalBinary(p []byte) error

func (*Bytes) UnmarshalSortable

func (v *Bytes) UnmarshalSortable(p []byte) error

func (*Bytes) Value

func (v *Bytes) Value() Value

type BytesType

type BytesType struct{}

func (BytesType) New

func (tp BytesType) New() ValueDest

func (BytesType) NewPrimitive

func (BytesType) NewPrimitive() PrimitiveDest

func (BytesType) NewSortable

func (BytesType) NewSortable() SortableDest

type Float

type Float float64

func (Float) MarshalBinary

func (v Float) MarshalBinary() ([]byte, error)

func (Float) Native

func (v Float) Native() interface{}

func (*Float) NativePtr

func (v *Float) NativePtr() interface{}

func (*Float) Primitive

func (v *Float) Primitive() Primitive

func (Float) PrimitiveType

func (Float) PrimitiveType() PrimitiveType

func (Float) Type

func (Float) Type() Type

func (*Float) UnmarshalBinary

func (v *Float) UnmarshalBinary(p []byte) error

func (*Float) Value

func (v *Float) Value() Value

type FloatType

type FloatType struct{}

func (FloatType) New

func (FloatType) New() ValueDest

func (FloatType) NewPrimitive

func (FloatType) NewPrimitive() PrimitiveDest

type Int

type Int int64

func (Int) Compare

func (v Int) Compare(b Sortable) int

func (Int) MarshalBinary

func (v Int) MarshalBinary() ([]byte, error)

func (Int) MarshalSortable

func (v Int) MarshalSortable() ([]byte, error)

func (Int) Native

func (v Int) Native() interface{}

func (*Int) NativePtr

func (v *Int) NativePtr() interface{}

func (*Int) Primitive

func (v *Int) Primitive() Primitive

func (Int) PrimitiveType

func (Int) PrimitiveType() PrimitiveType

func (*Int) Sortable

func (v *Int) Sortable() Sortable

func (Int) SortableType

func (Int) SortableType() SortableType

func (Int) Type

func (Int) Type() Type

func (*Int) UnmarshalBinary

func (v *Int) UnmarshalBinary(p []byte) error

func (*Int) UnmarshalSortable

func (v *Int) UnmarshalSortable(p []byte) error

func (*Int) Value

func (v *Int) Value() Value

type IntType

type IntType struct{}

func (IntType) New

func (tp IntType) New() ValueDest

func (IntType) NewPrimitive

func (IntType) NewPrimitive() PrimitiveDest

func (IntType) NewSortable

func (IntType) NewSortable() SortableDest

type Primitive

type Primitive interface {
	Value
	// PrimitiveType returns a type associated with this value.
	PrimitiveType() PrimitiveType
	// contains filtered or unexported methods
}

Primitive is a private interface implemented only by following types:

  • String
  • Bytes
  • Int
  • UInt
  • Float
  • Bool

type PrimitiveDest

type PrimitiveDest interface {
	ValueDest
	Primitive() Primitive
}

type PrimitiveType

type PrimitiveType interface {
	Type
	// NewPrimitive creates a new zero value of this type.
	NewPrimitive() PrimitiveDest
}

type Sortable

type Sortable interface {
	Value
	// Compare returns 0 if x == v, -1 if x < v and +1 if x > v
	Compare(v Sortable) int
	// SortableType returns a type associated with this value.
	SortableType() SortableType
	// MarshalSortable encodes the value into sortable encoding: v1 < v2, marshal(v1) < marshal(v2).
	MarshalSortable() ([]byte, error)
}

Sortable is an extension of Value interface that allows to use it in building low-level indexes.

type SortableDest

type SortableDest interface {
	ValueDest
	Sortable() Sortable
	// UnmarshalSortable decodes the value from sortable encoding.
	UnmarshalSortable(p []byte) error
}

type SortableType

type SortableType interface {
	Type
	// NewSortable creates a new zero value of this type.
	NewSortable() SortableDest
}

type String

type String string

func (String) Compare

func (v String) Compare(b Sortable) int

func (String) MarshalBinary

func (v String) MarshalBinary() ([]byte, error)

func (String) MarshalSortable

func (v String) MarshalSortable() ([]byte, error)

func (String) Native

func (v String) Native() interface{}

func (*String) NativePtr

func (v *String) NativePtr() interface{}

func (String) PrefixEnd

func (v String) PrefixEnd() BinaryString

PrefixEnd returns the next binary key that ends the prefix.

func (*String) Primitive

func (v *String) Primitive() Primitive

func (String) PrimitiveType

func (String) PrimitiveType() PrimitiveType

func (*String) Sortable

func (v *String) Sortable() Sortable

func (String) SortableType

func (String) SortableType() SortableType

func (String) Type

func (String) Type() Type

func (*String) UnmarshalBinary

func (v *String) UnmarshalBinary(p []byte) error

func (*String) UnmarshalSortable

func (v *String) UnmarshalSortable(p []byte) error

func (*String) Value

func (v *String) Value() Value

type StringType

type StringType struct{}

func (StringType) New

func (tp StringType) New() ValueDest

func (StringType) NewPrimitive

func (StringType) NewPrimitive() PrimitiveDest

func (StringType) NewSortable

func (StringType) NewSortable() SortableDest

type Time

type Time time.Time

func AsTime

func AsTime(t time.Time) Time

func (Time) Compare

func (v Time) Compare(b Sortable) int

func (Time) MarshalBinary

func (v Time) MarshalBinary() ([]byte, error)

func (Time) MarshalSortable

func (v Time) MarshalSortable() ([]byte, error)

func (Time) Native

func (v Time) Native() interface{}

func (*Time) NativePtr

func (v *Time) NativePtr() interface{}

func (*Time) Sortable

func (v *Time) Sortable() Sortable

func (Time) SortableType

func (Time) SortableType() SortableType

func (Time) String

func (v Time) String() string

func (Time) Type

func (Time) Type() Type

func (*Time) UnmarshalBinary

func (v *Time) UnmarshalBinary(p []byte) error

func (*Time) UnmarshalSortable

func (v *Time) UnmarshalSortable(p []byte) error

func (*Time) Value

func (v *Time) Value() Value

type TimeType

type TimeType struct{}

func (TimeType) New

func (tp TimeType) New() ValueDest

func (TimeType) NewSortable

func (TimeType) NewSortable() SortableDest

type Type

type Type interface {
	// New creates a new zero value of this type.
	New() ValueDest
}

type UInt

type UInt uint64

func (UInt) Compare

func (v UInt) Compare(b Sortable) int

func (UInt) MarshalBinary

func (v UInt) MarshalBinary() ([]byte, error)

func (UInt) MarshalSortable

func (v UInt) MarshalSortable() ([]byte, error)

func (UInt) Native

func (v UInt) Native() interface{}

func (*UInt) NativePtr

func (v *UInt) NativePtr() interface{}

func (*UInt) Primitive

func (v *UInt) Primitive() Primitive

func (UInt) PrimitiveType

func (UInt) PrimitiveType() PrimitiveType

func (*UInt) Sortable

func (v *UInt) Sortable() Sortable

func (UInt) SortableType

func (UInt) SortableType() SortableType

func (UInt) Type

func (UInt) Type() Type

func (*UInt) UnmarshalBinary

func (v *UInt) UnmarshalBinary(p []byte) error

func (*UInt) UnmarshalSortable

func (v *UInt) UnmarshalSortable(p []byte) error

func (*UInt) Value

func (v *UInt) Value() Value

type UIntType

type UIntType struct{}

func (UIntType) New

func (tp UIntType) New() ValueDest

func (UIntType) NewPrimitive

func (UIntType) NewPrimitive() PrimitiveDest

func (UIntType) NewSortable

func (UIntType) NewSortable() SortableDest

type Value

type Value interface {
	// Native returns a native Go value represented by this type.
	Native() interface{}
	// Type returns a type associated with this value.
	Type() Type
	// Marshal implementations should not include the length of the value.
	encoding.BinaryMarshaler
}

type ValueDest

type ValueDest interface {
	Value() Value
	NativePtr() interface{}
	encoding.BinaryUnmarshaler
}

Jump to

Keyboard shortcuts

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