package value

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/value"

Index

Constants

const (
	LayoutDate        = "2006-01-02"
	LayoutDatetime    = "2006-01-02T15:04:05Z"
	LayoutTimestamp   = "2006-01-02T15:04:05.000000Z"
	LayoutTzDatetime  = "2006-01-02T15:04:05"
	LayoutTzTimestamp = "2006-01-02T15:04:05.000000"
)

Date format layouts described in time.Format and time.ANSIC docs.

const InfiniteDuration = time.Duration(math.MaxInt64)

Functions

func BigEndianUint128

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

BigEndianUint128 builds a big-endian uint128 value.

func BoolValue

func BoolValue(v bool) boolValue

func BytesValue

func BytesValue(v []byte) bytesValue

func CastTo

func CastTo(v Value, dst interface{}) error

func DateToTime

func DateToTime(n uint32) time.Time

DateToTime up to 11761191-01-20 00:00:00 +0000 UTC.

func DateValue

func DateValue(v uint32) dateValue

DateValue returns ydb date value by given days since Epoch

func DateValueFromTime

func DateValueFromTime(t time.Time) dateValue

func DatetimeToTime

func DatetimeToTime(n uint32) time.Time

DatetimeToTime converts seconds to time.Time Up to 2106-02-07 06:28:15 +0000 UTC.

func DatetimeValue

func DatetimeValue(v uint32) datetimeValue

DatetimeValue makes ydb datetime value from seconds since Epoch

func DatetimeValueFromTime

func DatetimeValueFromTime(t time.Time) datetimeValue

func DecimalValue

func DecimalValue(v [16]byte, precision uint32, scale uint32) *decimalValue

func DecimalValueFromBigInt

func DecimalValueFromBigInt(v *big.Int, precision, scale uint32) *decimalValue

func Dict

func Dict(key, value Type) (v *dictType)

func DictValue

func DictValue(values ...DictValueField) *dictValue

func DoubleValue

func DoubleValue(v float64) *doubleValue

func DyNumberValue

func DyNumberValue(v string) dyNumberValue

func EmptyDict

func EmptyDict() emptyDictType

func EmptyList

func EmptyList() emptyListType

func EmptySet

func EmptySet() emptyDictType

func FloatValue

func FloatValue(v float32) *floatValue

func Int16Value

func Int16Value(v int16) int16Value

func Int32Value

func Int32Value(v int32) int32Value

func Int64Value

func Int64Value(v int64) int64Value

func Int8Value

func Int8Value(v int8) int8Value

func IntervalToDuration

func IntervalToDuration(n int64) time.Duration

IntervalToDuration returns time.Duration from given microseconds

func IntervalValue

func IntervalValue(v int64) intervalValue

IntervalValue makes Value from given microseconds value

func IntervalValueFromDuration

func IntervalValueFromDuration(v time.Duration) intervalValue

func JSONDocumentValue

func JSONDocumentValue(v string) jsonDocumentValue

func JSONValue

func JSONValue(v string) jsonValue

func List

func List(t Type) *listType

func ListValue

func ListValue(items ...Value) *listValue

func Null

func Null() nullType

func NullValue

func NullValue(t Type) *optionalValue

func Optional

func Optional(t Type) optionalType

func OptionalValue

func OptionalValue(v Value) *optionalValue

func Set

func Set(t Type) *setType

func SetValue

func SetValue(items ...Value) *setValue

func StructValue

func StructValue(fields ...StructValueField) *structValue

func TextValue

func TextValue(v string) textValue

func TimestampToTime

func TimestampToTime(n uint64) time.Time

TimestampToTime converts given microseconds to time.Time Up to 586524-01-19 08:01:49.000551615 +0000 UTC.

func TimestampValue

func TimestampValue(v uint64) timestampValue

TimestampValue makes ydb timestamp value by given microseconds since Epoch

func TimestampValueFromTime

func TimestampValueFromTime(t time.Time) timestampValue

func ToYDB

func ToYDB(v Value, a *allocator.Allocator) *Ydb.TypedValue

func TupleValue

func TupleValue(values ...Value) *tupleValue

func TypeToYDB

func TypeToYDB(t Type, a *allocator.Allocator) *Ydb.Type

func TypesEqual

func TypesEqual(a, b Type) bool

func TzDateToTime

func TzDateToTime(s string) (t time.Time, err error)

func TzDateValue

func TzDateValue(v string) tzDateValue

func TzDateValueFromTime

func TzDateValueFromTime(t time.Time) tzDateValue

func TzDatetimeToTime

func TzDatetimeToTime(s string) (t time.Time, err error)

func TzDatetimeValue

func TzDatetimeValue(v string) tzDatetimeValue

func TzDatetimeValueFromTime

func TzDatetimeValueFromTime(t time.Time) tzDatetimeValue

func TzTimestampToTime

func TzTimestampToTime(s string) (t time.Time, err error)

func TzTimestampValue

func TzTimestampValue(v string) tzTimestampValue

func TzTimestampValueFromTime

func TzTimestampValueFromTime(t time.Time) tzTimestampValue

func UUIDValue

func UUIDValue(v [16]byte) *uuidValue

func Uint16Value

func Uint16Value(v uint16) uint16Value

func Uint32Value

func Uint32Value(v uint32) uint32Value

func Uint64Value

func Uint64Value(v uint64) uint64Value

func Uint8Value

func Uint8Value(v uint8) uint8Value

func VariantStruct

func VariantStruct(fields ...StructField) *variantStructType

func VariantTuple

func VariantTuple(items ...Type) *variantTupleType

func VariantValueStruct

func VariantValueStruct(v Value, name string, t Type) *variantValue

func VariantValueTuple

func VariantValueTuple(v Value, idx uint32, t Type) *variantValue

func Void

func Void() voidType

func VoidValue

func VoidValue() voidValue

func YSONValue

func YSONValue(v []byte) ysonValue

Types

type DecimalType

type DecimalType struct {
	Precision uint32
	Scale     uint32
}

func Decimal

func Decimal(precision, scale uint32) *DecimalType

func (*DecimalType) Name

func (v *DecimalType) Name() string

func (*DecimalType) String

func (v *DecimalType) String() string

func (*DecimalType) Yql

func (v *DecimalType) Yql() string

type DictValueField

type DictValueField struct {
	K Value
	V Value
}

type PrimitiveType

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

func (PrimitiveType) String

func (v PrimitiveType) String() string

func (PrimitiveType) Yql

func (v PrimitiveType) Yql() string

type StructField

type StructField struct {
	Name string
	T    Type
}

func StructFields

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

type StructType

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

func Struct

func Struct(fields ...StructField) (v *StructType)

func (*StructType) String

func (v *StructType) String() string

func (*StructType) Yql

func (v *StructType) Yql() string

type StructValueField

type StructValueField struct {
	Name string
	V    Value
}

type TupleType

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

func Tuple

func Tuple(items ...Type) (v *TupleType)

func (*TupleType) String

func (v *TupleType) String() string

func (*TupleType) Yql

func (v *TupleType) Yql() string

type Type

type Type interface {
	Yql() string
	String() string
	// contains filtered or unexported methods
}

func TypeFromYDB

func TypeFromYDB(x *Ydb.Type) Type

func TypesFromYDB

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

type Value

type Value interface {
	Type() Type
	Yql() string
	// contains filtered or unexported methods
}

func FromYDB

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

func ZeroValue

func ZeroValue(t Type) Value

Source Files

cast.go time.go type.go value.go

Version
v3.44.2
Published
Apr 22, 2023
Platform
js/wasm
Imports
14 packages
Last checked
3 minutes ago

Tools for package owners.