value

package
v3.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VoidValue = Value{
	// contains filtered or unexported fields
}

Functions

func BigEndianUint128

func BigEndianUint128(hi, lo uint64) (v [16]byte)

BigEndianUint128 builds a big-endian uint128 value.

func PrimitiveFromYDB

func PrimitiveFromYDB(x *Ydb.Value) (v interface{})

PrimitiveFromYDB returns a primitive value stored in x. Currently it may return one of this types:

bool
int32
uint32
int64
uint64
float32
float64
[]byte
string
[16]byte

Or nil.

func ToYDB

func ToYDB(v V) *Ydb.TypedValue

func TypeToYDB

func TypeToYDB(t T) *Ydb.Type

func TypesEqual

func TypesEqual(a, b T) bool

func WriteTypeStringTo

func WriteTypeStringTo(buf *bytes.Buffer, t T)

func WriteValueStringTo

func WriteValueStringTo(buf *bytes.Buffer, v V)

Types

type DecimalType

type DecimalType struct {
	Precision uint32
	Scale     uint32
}

func (DecimalType) String

func (d DecimalType) String() string

type DictType

type DictType struct {
	Key     T
	Payload T
}

func (DictType) String

func (d DictType) String() string

type ListType

type ListType struct {
	T T
}

func (ListType) String

func (l ListType) String() string

type OptionalType

type OptionalType struct {
	T T
}

func (OptionalType) String

func (opt OptionalType) String() string

type PrimitiveType

type PrimitiveType int
const (
	TypeUnknown PrimitiveType = iota
	TypeBool
	TypeInt8
	TypeUint8
	TypeInt16
	TypeUint16
	TypeInt32
	TypeUint32
	TypeInt64
	TypeUint64
	TypeFloat
	TypeDouble
	TypeDate
	TypeDatetime
	TypeTimestamp
	TypeInterval
	TypeTzDate
	TypeTzDatetime
	TypeTzTimestamp
	TypeString
	TypeUTF8
	TypeYSON
	TypeJSON
	TypeUUID
	TypeJSONDocument
	TypeDyNumber
)

Primitive TypesFromYDB known by YDB.

func (PrimitiveType) String

func (t PrimitiveType) String() string

type StructField

type StructField struct {
	Name string
	Type T
}

func StructFields

func StructFields(ms []*Ydb.StructMember) []StructField

type StructType

type StructType struct {
	Fields []StructField
}

func (StructType) Empty

func (s StructType) Empty() bool

func (StructType) Members

func (s StructType) Members() []*Ydb.StructMember

func (StructType) String

func (s StructType) String() string

type StructValueProto

type StructValueProto struct {
	Fields []StructField
	Values []*Ydb.Value
}

func (*StructValueProto) Add

func (s *StructValueProto) Add(name string, value V)

type T

type T interface {
	// contains filtered or unexported methods
}

func Dict

func Dict(key, payload T) T

func TypeFromYDB

func TypeFromYDB(x *Ydb.Type) T

func TypesFromYDB

func TypesFromYDB(es []*Ydb.Type) []T

type TupleType

type TupleType struct {
	Elems []T
}

func (TupleType) Elements

func (t TupleType) Elements() []*Ydb.Type

func (TupleType) Empty

func (t TupleType) Empty() bool

func (TupleType) String

func (t TupleType) String() string

type V

type V interface {
	ToYDB() *Ydb.TypedValue
	// contains filtered or unexported methods
}

func FromYDB

func FromYDB(t *Ydb.Type, v *Ydb.Value) V

type Value

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

func BoolValue

func BoolValue(v bool) Value

func DateValue

func DateValue(v uint32) Value

func DatetimeValue

func DatetimeValue(v uint32) Value

func DecimalValue

func DecimalValue(t T, v [16]byte) Value

func DictValue

func DictValue(n int, it func(int) V) Value

func DoubleValue

func DoubleValue(v float64) Value

func DyNumberValue

func DyNumberValue(v string) Value

func FloatValue

func FloatValue(v float32) Value

func Int16Value

func Int16Value(v int16) Value

func Int32Value

func Int32Value(v int32) Value

func Int64Value

func Int64Value(v int64) Value

func Int8Value

func Int8Value(v int8) Value

func IntervalValue

func IntervalValue(v int64) Value

func JSONDocumentValue

func JSONDocumentValue(v string) Value

func JSONValue

func JSONValue(v string) Value

func ListValue

func ListValue(n int, it func(int) V) Value

It panics if vs is empty or contains not equal types.

func NullValue

func NullValue(t T) Value

NullValue returns NULL value of given types T.

For example, if T is Int32Type, then NullValue(Int32Type) will return value of types Optional<Int32Type> with NULL value.

Nested optional types are handled also.

func OptionalValue

func OptionalValue(v V) Value

func StringValue

func StringValue(v []byte) Value

func StructValue

func StructValue(p *StructValueProto) Value

func TimestampValue

func TimestampValue(v uint64) Value

func TupleValue

func TupleValue(n int, it func(int) V) Value

func TzDateValue

func TzDateValue(v string) Value

func TzDatetimeValue

func TzDatetimeValue(v string) Value

func TzTimestampValue

func TzTimestampValue(v string) Value

func UTF8Value

func UTF8Value(v string) Value

func UUIDValue

func UUIDValue(v [16]byte) Value

func Uint16Value

func Uint16Value(v uint16) Value

func Uint32Value

func Uint32Value(v uint32) Value

func Uint64Value

func Uint64Value(v uint64) Value

func Uint8Value

func Uint8Value(v uint8) Value

func VariantValue

func VariantValue(x V, i uint32, t T) Value

func YSONValue

func YSONValue(v string) Value

func ZeroValue

func ZeroValue(t T) Value

func (Value) String

func (v Value) String() string

func (Value) ToYDB

func (v Value) ToYDB() *Ydb.TypedValue

type VariantType

type VariantType struct {
	S StructType
	T TupleType
}

func (VariantType) String

func (v VariantType) String() string

type VoidType

type VoidType struct{}

func (VoidType) String

func (v VoidType) String() string

Jump to

Keyboard shortcuts

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