types

package
v3.70.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 32

Documentation

Index

Constants

View Source
const (
	TypeUnknown      = types.Unknown
	TypeBool         = types.Bool
	TypeInt8         = types.Int8
	TypeUint8        = types.Uint8
	TypeInt16        = types.Int16
	TypeUint16       = types.Uint16
	TypeInt32        = types.Int32
	TypeUint32       = types.Uint32
	TypeInt64        = types.Int64
	TypeUint64       = types.Uint64
	TypeFloat        = types.Float
	TypeDouble       = types.Double
	TypeDate         = types.Date
	TypeDatetime     = types.Datetime
	TypeTimestamp    = types.Timestamp
	TypeInterval     = types.Interval
	TypeTzDate       = types.TzDate
	TypeTzDatetime   = types.TzDatetime
	TypeTzTimestamp  = types.TzTimestamp
	TypeString       = types.Bytes
	TypeBytes        = types.Bytes
	TypeUTF8         = types.Text
	TypeText         = types.Text
	TypeYSON         = types.YSON
	TypeJSON         = types.JSON
	TypeUUID         = types.UUID
	TypeJSONDocument = types.JSONDocument
	TypeDyNumber     = types.DyNumber
)

Primitive types known by YDB.

Variables

View Source
var DefaultDecimal = DecimalType(decimalPrecision, decimalScale)

Functions

func CastTo added in v3.39.0

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

CastTo try cast value to destination type value

func DictFields deprecated added in v3.39.0

func DictFields(v Value) (map[Value]Value, error)

DictFields returns dict values from abstract Value

Deprecated: use DictValues instead. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func DictValues added in v3.48.0

func DictValues(v Value) (map[Value]Value, error)

DictValues returns dict values from abstract Value

func Equal added in v3.29.0

func Equal(lhs, rhs Type) bool

Equal checks for type equivalence

func StructFields added in v3.39.0

func StructFields(v Value) (map[string]Value, error)

StructFields returns struct fields from abstract Value

func WriteTypeStringTo deprecated

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

WriteTypeStringTo writes ydb type string representation into buffer

Deprecated: use types.Type.Yql() instead. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

Types

type Decimal

type Decimal = decimal.Decimal

Decimal supported in scanner API

func ToDecimal added in v3.47.0

func ToDecimal(v Value) (*Decimal, error)

ToDecimal returns Decimal struct from abstract Value

type DictValueOption added in v3.29.0

type DictValueOption func(*dictValueFields)

func DictFieldValue added in v3.29.0

func DictFieldValue(k, v Value) DictValueOption

type RawValue

type RawValue = scanner.RawValue

type Scanner

type Scanner = scanner.Scanner

type StructOption

type StructOption func(*tStructType)

func StructField

func StructField(name string, t Type) StructOption

type StructValueOption

type StructValueOption func(*structValueFields)

func StructFieldValue

func StructFieldValue(name string, v Value) StructValueOption

type Type

type Type = types.Type

Type describes YDB data types.

func DecimalType

func DecimalType(precision, scale uint32) Type

func DecimalTypeFromDecimal

func DecimalTypeFromDecimal(d *Decimal) Type

func Dict added in v3.29.5

func Dict(k, v Type) Type

func IsOptional added in v3.48.3

func IsOptional(t Type) (isOptional bool, innerType Type)

IsOptional checks if type is optional and returns innerType if it is.

func List

func List(t Type) Type

func Optional

func Optional(t Type) Type

func Struct

func Struct(opts ...StructOption) Type

func Tuple

func Tuple(elems ...Type) Type

func VariantStruct added in v3.39.0

func VariantStruct(opts ...StructOption) Type

func VariantTuple added in v3.39.0

func VariantTuple(elems ...Type) Type

func Void

func Void() Type

type Value

type Value = value.Value

func BoolValue

func BoolValue(v bool) Value

func BytesValue added in v3.36.0

func BytesValue(v []byte) Value

func BytesValueFromString added in v3.36.0

func BytesValueFromString(v string) Value

func DateValue

func DateValue(v uint32) Value

DateValue returns ydb date value by given days since Epoch

func DateValueFromTime

func DateValueFromTime(t time.Time) Value

DateValueFromTime makes Date value from time.Time

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func DatetimeValue

func DatetimeValue(v uint32) Value

DatetimeValue makes ydb datetime value from seconds since Epoch

func DatetimeValueFromTime

func DatetimeValueFromTime(t time.Time) Value

DatetimeValueFromTime makes Datetime value from time.Time

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func DecimalValue

func DecimalValue(v *Decimal) Value

DecimalValue creates decimal value of given types t and value v. Note that Decimal.Bytes interpreted as big-endian int128.

func DecimalValueFromBigInt

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

func DictValue

func DictValue(opts ...DictValueOption) 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 deprecated

func IntervalValue(v int64) Value

IntervalValue makes Value from given microseconds value

Deprecated: use IntervalValueFromMicroseconds instead. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func IntervalValueFromDuration

func IntervalValueFromDuration(v time.Duration) Value

IntervalValueFromDuration makes Interval value from time.Duration

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func IntervalValueFromMicroseconds added in v3.26.9

func IntervalValueFromMicroseconds(v int64) Value

IntervalValueFromMicroseconds makes Value from given microseconds value

func JSONDocumentValue

func JSONDocumentValue(v string) Value

func JSONDocumentValueFromBytes

func JSONDocumentValueFromBytes(v []byte) Value

JSONDocumentValueFromBytes makes JSONDocument value from bytes

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func JSONValue

func JSONValue(v string) Value

func JSONValueFromBytes

func JSONValueFromBytes(v []byte) Value

JSONValueFromBytes makes JSON value from bytes

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func ListItems added in v3.48.0

func ListItems(v Value) ([]Value, error)

ListItems returns list items from abstract Value

func ListValue

func ListValue(vs ...Value) Value

func NullValue

func NullValue(t Type) Value

func Nullable added in v3.15.0

func Nullable(t Type, v interface{}) Value

func NullableBoolValue added in v3.15.0

func NullableBoolValue(v *bool) Value

func NullableBytesValue added in v3.36.2

func NullableBytesValue(v *[]byte) Value

func NullableBytesValueFromString added in v3.36.2

func NullableBytesValueFromString(v *string) Value

func NullableDateValue added in v3.15.0

func NullableDateValue(v *uint32) Value

func NullableDateValueFromTime added in v3.15.0

func NullableDateValueFromTime(v *time.Time) Value

func NullableDatetimeValue added in v3.15.0

func NullableDatetimeValue(v *uint32) Value

func NullableDatetimeValueFromTime added in v3.15.0

func NullableDatetimeValueFromTime(v *time.Time) Value

func NullableDoubleValue added in v3.15.0

func NullableDoubleValue(v *float64) Value

func NullableDyNumberValue added in v3.15.0

func NullableDyNumberValue(v *string) Value

func NullableFloatValue added in v3.15.0

func NullableFloatValue(v *float32) Value

func NullableInt16Value added in v3.15.0

func NullableInt16Value(v *int16) Value

func NullableInt32Value added in v3.15.0

func NullableInt32Value(v *int32) Value

func NullableInt64Value added in v3.15.0

func NullableInt64Value(v *int64) Value

func NullableInt8Value added in v3.15.0

func NullableInt8Value(v *int8) Value

func NullableIntervalValue deprecated added in v3.15.0

func NullableIntervalValue(v *int64) Value

NullableIntervalValue makes Value which maybe nil or valued

Deprecated: use NullableIntervalValueFromMicroseconds instead. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func NullableIntervalValueFromDuration added in v3.15.0

func NullableIntervalValueFromDuration(v *time.Duration) Value

func NullableIntervalValueFromMicroseconds added in v3.26.9

func NullableIntervalValueFromMicroseconds(v *int64) Value

func NullableJSONDocumentValue added in v3.15.0

func NullableJSONDocumentValue(v *string) Value

func NullableJSONDocumentValueFromBytes added in v3.15.0

func NullableJSONDocumentValueFromBytes(v *[]byte) Value

func NullableJSONValue added in v3.15.0

func NullableJSONValue(v *string) Value

func NullableJSONValueFromBytes added in v3.15.0

func NullableJSONValueFromBytes(v *[]byte) Value

func NullableStringValue deprecated added in v3.15.0

func NullableStringValue(v *[]byte) Value

NullableStringValue

Deprecated: use NullableBytesValue instead. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func NullableStringValueFromString added in v3.15.0

func NullableStringValueFromString(v *string) Value

func NullableTextValue added in v3.36.2

func NullableTextValue(v *string) Value

func NullableTimestampValue added in v3.15.0

func NullableTimestampValue(v *uint64) Value

func NullableTimestampValueFromTime added in v3.15.0

func NullableTimestampValueFromTime(v *time.Time) Value

func NullableTzDateValue added in v3.15.0

func NullableTzDateValue(v *string) Value

func NullableTzDateValueFromTime added in v3.15.0

func NullableTzDateValueFromTime(v *time.Time) Value

func NullableTzDatetimeValue added in v3.15.0

func NullableTzDatetimeValue(v *string) Value

func NullableTzDatetimeValueFromTime added in v3.15.0

func NullableTzDatetimeValueFromTime(v *time.Time) Value

func NullableTzTimestampValue added in v3.15.0

func NullableTzTimestampValue(v *string) Value

func NullableTzTimestampValueFromTime added in v3.15.0

func NullableTzTimestampValueFromTime(v *time.Time) Value

func NullableUTF8Value added in v3.15.0

func NullableUTF8Value(v *string) Value

func NullableUUIDValue added in v3.15.0

func NullableUUIDValue(v *[16]byte) Value

func NullableUint16Value added in v3.15.0

func NullableUint16Value(v *uint16) Value

func NullableUint32Value added in v3.15.0

func NullableUint32Value(v *uint32) Value

func NullableUint64Value added in v3.15.0

func NullableUint64Value(v *uint64) Value

func NullableUint8Value added in v3.15.0

func NullableUint8Value(v *uint8) Value

func NullableYSONValue added in v3.15.0

func NullableYSONValue(v *string) Value

func NullableYSONValueFromBytes added in v3.15.0

func NullableYSONValueFromBytes(v *[]byte) Value

func OptionalValue

func OptionalValue(v Value) Value

func SetValue added in v3.39.0

func SetValue(vs ...Value) Value

func StringValue deprecated

func StringValue(v []byte) Value

StringValue returns bytes value

Deprecated: use BytesValue instead. Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated

func StringValueFromString

func StringValueFromString(v string) Value

StringValueFromString makes String value from string

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func StructValue

func StructValue(opts ...StructValueOption) Value

func TextValue added in v3.36.0

func TextValue(v string) Value

func TimestampValue

func TimestampValue(v uint64) Value

TimestampValue makes ydb timestamp value from microseconds since Epoch

func TimestampValueFromTime

func TimestampValueFromTime(t time.Time) Value

TimestampValueFromTime makes Timestamp value from time.Time

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func TupleItems added in v3.39.0

func TupleItems(v Value) ([]Value, error)

TupleItems returns tuple items from abstract Value

func TupleValue

func TupleValue(vs ...Value) Value

func TzDateValue

func TzDateValue(v string) Value

TzDateValue makes TzDate value from string

func TzDateValueFromTime

func TzDateValueFromTime(t time.Time) Value

TzDateValueFromTime makes TzDate value from time.Time

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func TzDatetimeValue

func TzDatetimeValue(v string) Value

TzDatetimeValue makes TzDatetime value from string

func TzDatetimeValueFromTime

func TzDatetimeValueFromTime(t time.Time) Value

TzDatetimeValueFromTime makes TzDatetime value from time.Time

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func TzTimestampValue

func TzTimestampValue(v string) Value

TzTimestampValue makes TzTimestamp value from string

func TzTimestampValueFromTime

func TzTimestampValueFromTime(t time.Time) Value

TzTimestampValueFromTime makes TzTimestamp value from time.Time

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

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(v Value) (name string, idx uint32, _ Value, _ error)

VariantValue returns variant value from abstract Value

func VariantValueStruct added in v3.39.0

func VariantValueStruct(v Value, name string, variantT Type) Value

func VariantValueTuple added in v3.39.0

func VariantValueTuple(v Value, i uint32, variantT Type) Value

func VoidValue

func VoidValue() Value

func YSONValue

func YSONValue(v string) Value

func YSONValueFromBytes

func YSONValueFromBytes(v []byte) Value

YSONValueFromBytes makes YSON value from bytes

Warning: all *From* helpers will be removed at next major release (functional will be implements with go1.18 type lists)

func ZeroValue

func ZeroValue(t Type) Value

Jump to

Keyboard shortcuts

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