value

package
v3.74.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const InfiniteDuration = time.Duration(math.MaxInt64)

Variables

View Source
var (
	ErrCannotCast = errors.New("cannot cast")
)

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 added in v3.39.0

func BytesValue(v []byte) bytesValue

func CastTo added in v3.39.0

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

func DateToTime added in v3.39.0

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 added in v3.39.0

func DateValueFromTime(t time.Time) dateValue

func DatetimeToTime added in v3.39.0

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 added in v3.39.0

func DatetimeValueFromTime(t time.Time) datetimeValue

func DecimalValue

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

func DecimalValueFromBigInt added in v3.39.0

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

func DictValue

func DictValue(values ...DictValueField) *dictValue

func DoubleValue

func DoubleValue(v float64) *doubleValue

func DyNumberValue

func DyNumberValue(v string) dyNumberValue

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 added in v3.39.0

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 added in v3.39.0

func IntervalValueFromDuration(v time.Duration) intervalValue

func JSONDocumentValue

func JSONDocumentValue(v string) jsonDocumentValue

func JSONValue

func JSONValue(v string) jsonValue

func ListValue

func ListValue(items ...Value) *listValue

func NullValue

func NullValue(t types.Type) *optionalValue

func OptionalValue

func OptionalValue(v Value) *optionalValue

func PgValue added in v3.58.0

func PgValue(oid uint32, val string) pgValue

func SetValue added in v3.39.0

func SetValue(items ...Value) *setValue

func StructValue

func StructValue(fields ...StructValueField) *structValue

func TextValue added in v3.39.0

func TextValue(v string) textValue

func TimestampToTime added in v3.39.0

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 added in v3.39.0

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 TzDateToTime added in v3.39.0

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

func TzDateValue

func TzDateValue(v string) tzDateValue

func TzDateValueFromTime added in v3.39.0

func TzDateValueFromTime(t time.Time) tzDateValue

func TzDatetimeToTime added in v3.39.0

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

func TzDatetimeValue

func TzDatetimeValue(v string) tzDatetimeValue

func TzDatetimeValueFromTime added in v3.39.0

func TzDatetimeValueFromTime(t time.Time) tzDatetimeValue

func TzTimestampToTime added in v3.39.0

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

func TzTimestampValue

func TzTimestampValue(v string) tzTimestampValue

func TzTimestampValueFromTime added in v3.39.0

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 VariantValueStruct added in v3.29.0

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

func VariantValueTuple added in v3.29.0

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

func VoidValue

func VoidValue() voidValue

func YSONValue

func YSONValue(v []byte) ysonValue

Types

type DecimalValuer added in v3.47.0

type DecimalValuer interface {
	Value() [16]byte
	Precision() uint32
	Scale() uint32
}

type DictValueField added in v3.29.0

type DictValueField struct {
	K Value
	V Value
}

type StructValueField added in v3.29.0

type StructValueField struct {
	Name string
	V    Value
}

type Value

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

func FromYDB

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

func Nullable added in v3.57.0

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

Nullable makes optional value from nullable type Warning: type interface will be replaced in the future with typed parameters pattern from go1.18

func NullableBoolValue added in v3.57.0

func NullableBoolValue(v *bool) Value

func NullableBytesValue added in v3.57.0

func NullableBytesValue(v *[]byte) Value

func NullableBytesValueFromString added in v3.57.0

func NullableBytesValueFromString(v *string) Value

func NullableDateValue added in v3.57.0

func NullableDateValue(v *uint32) Value

func NullableDateValueFromTime added in v3.57.0

func NullableDateValueFromTime(v *time.Time) Value

func NullableDatetimeValue added in v3.57.0

func NullableDatetimeValue(v *uint32) Value

func NullableDatetimeValueFromTime added in v3.57.0

func NullableDatetimeValueFromTime(v *time.Time) Value

func NullableDoubleValue added in v3.57.0

func NullableDoubleValue(v *float64) Value

func NullableDyNumberValue added in v3.57.0

func NullableDyNumberValue(v *string) Value

func NullableFloatValue added in v3.57.0

func NullableFloatValue(v *float32) Value

func NullableInt16Value added in v3.57.0

func NullableInt16Value(v *int16) Value

func NullableInt32Value added in v3.57.0

func NullableInt32Value(v *int32) Value

func NullableInt64Value added in v3.57.0

func NullableInt64Value(v *int64) Value

func NullableInt8Value added in v3.57.0

func NullableInt8Value(v *int8) Value

func NullableIntervalValueFromDuration added in v3.57.0

func NullableIntervalValueFromDuration(v *time.Duration) Value

func NullableIntervalValueFromMicroseconds added in v3.57.0

func NullableIntervalValueFromMicroseconds(v *int64) Value

func NullableJSONDocumentValue added in v3.57.0

func NullableJSONDocumentValue(v *string) Value

func NullableJSONDocumentValueFromBytes added in v3.57.0

func NullableJSONDocumentValueFromBytes(v *[]byte) Value

func NullableJSONValue added in v3.57.0

func NullableJSONValue(v *string) Value

func NullableJSONValueFromBytes added in v3.57.0

func NullableJSONValueFromBytes(v *[]byte) Value

func NullableTextValue added in v3.57.0

func NullableTextValue(v *string) Value

func NullableTimestampValue added in v3.57.0

func NullableTimestampValue(v *uint64) Value

func NullableTimestampValueFromTime added in v3.57.0

func NullableTimestampValueFromTime(v *time.Time) Value

func NullableTzDateValue added in v3.57.0

func NullableTzDateValue(v *string) Value

func NullableTzDateValueFromTime added in v3.57.0

func NullableTzDateValueFromTime(v *time.Time) Value

func NullableTzDatetimeValue added in v3.57.0

func NullableTzDatetimeValue(v *string) Value

func NullableTzDatetimeValueFromTime added in v3.57.0

func NullableTzDatetimeValueFromTime(v *time.Time) Value

func NullableTzTimestampValue added in v3.57.0

func NullableTzTimestampValue(v *string) Value

func NullableTzTimestampValueFromTime added in v3.57.0

func NullableTzTimestampValueFromTime(v *time.Time) Value

func NullableUUIDValue added in v3.57.0

func NullableUUIDValue(v *[16]byte) Value

func NullableUint16Value added in v3.57.0

func NullableUint16Value(v *uint16) Value

func NullableUint32Value added in v3.57.0

func NullableUint32Value(v *uint32) Value

func NullableUint64Value added in v3.57.0

func NullableUint64Value(v *uint64) Value

func NullableUint8Value added in v3.57.0

func NullableUint8Value(v *uint8) Value

func NullableYSONValue added in v3.57.0

func NullableYSONValue(v *string) Value

func NullableYSONValueFromBytes added in v3.57.0

func NullableYSONValueFromBytes(v *[]byte) Value

func ZeroValue

func ZeroValue(t types.Type) Value

Jump to

Keyboard shortcuts

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