value

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoerceIntsToFloats

func CoerceIntsToFloats(v any) any

Helpers used by encoder/decoder when constructing literals.

func DateFromInt64Value

func DateFromInt64Value(v int64) (time.Time, error)

func EncodeValue

func EncodeValue(v Value) (any, error)

EncodeValue serializes a Value into the over-the-wire form the SQLite layer accepts. INT64 / FLOAT64 / BOOL pass through to their Go primitives; richer types (BYTES, NUMERIC, ARRAY, STRUCT, ...) are JSON-encoded under a small (header, body) envelope and then base64-encoded so SQLite stores them as a flat string.

func IsDate

func IsDate(s string) bool

func IsDatetime

func IsDatetime(s string) bool

func IsNullValue

func IsNullValue(v any) bool

func IsTime

func IsTime(s string) bool

func IsTimestamp

func IsTimestamp(s string) bool

func ModifyTimeZone

func ModifyTimeZone(t time.Time, loc *time.Location) (time.Time, error)

func ParseDate

func ParseDate(s string) (time.Time, error)

func ParseDatetime

func ParseDatetime(s string) (time.Time, error)

func ParseTime

func ParseTime(s string) (time.Time, error)

func ParseTimestamp

func ParseTimestamp(s string, loc *time.Location) (time.Time, error)

func PrintableChar

func PrintableChar(b byte) bool

func TimeFromUnixNano

func TimeFromUnixNano(n int64) time.Time

func TimestampFromFloatValue

func TimestampFromFloatValue(f float64) (time.Time, error)

func TimestampFromInt64Value

func TimestampFromInt64Value(v int64) (time.Time, error)

func ToLocation

func ToLocation(timeZone string) (*time.Location, error)

Types

type ArrayValue

type ArrayValue struct {
	Values []Value
}

func (*ArrayValue) Add

func (av *ArrayValue) Add(v Value) (Value, error)

func (*ArrayValue) Div

func (av *ArrayValue) Div(v Value) (Value, error)

func (*ArrayValue) EQ

func (av *ArrayValue) EQ(v Value) (bool, error)

func (*ArrayValue) Format

func (av *ArrayValue) Format(verb rune) string

func (*ArrayValue) GT

func (av *ArrayValue) GT(v Value) (bool, error)

func (*ArrayValue) GTE

func (av *ArrayValue) GTE(v Value) (bool, error)

func (*ArrayValue) Has

func (av *ArrayValue) Has(v Value) (bool, error)

func (*ArrayValue) Interface

func (av *ArrayValue) Interface() any

func (*ArrayValue) LT

func (av *ArrayValue) LT(v Value) (bool, error)

func (*ArrayValue) LTE

func (av *ArrayValue) LTE(v Value) (bool, error)

func (*ArrayValue) Mul

func (av *ArrayValue) Mul(v Value) (Value, error)

func (*ArrayValue) Sub

func (av *ArrayValue) Sub(v Value) (Value, error)

func (*ArrayValue) ToArray

func (av *ArrayValue) ToArray() (*ArrayValue, error)

func (*ArrayValue) ToBool

func (av *ArrayValue) ToBool() (bool, error)

func (*ArrayValue) ToBytes

func (av *ArrayValue) ToBytes() ([]byte, error)

func (*ArrayValue) ToFloat64

func (av *ArrayValue) ToFloat64() (float64, error)

func (*ArrayValue) ToInt64

func (av *ArrayValue) ToInt64() (int64, error)

func (*ArrayValue) ToJSON

func (av *ArrayValue) ToJSON() (string, error)

func (*ArrayValue) ToRat

func (av *ArrayValue) ToRat() (*big.Rat, error)

func (*ArrayValue) ToString

func (av *ArrayValue) ToString() (string, error)

func (*ArrayValue) ToStruct

func (av *ArrayValue) ToStruct() (*StructValue, error)

func (*ArrayValue) ToTime

func (av *ArrayValue) ToTime() (time.Time, error)

type BoolValue

type BoolValue bool

func (BoolValue) Add

func (bv BoolValue) Add(v Value) (Value, error)

func (BoolValue) Div

func (bv BoolValue) Div(v Value) (Value, error)

func (BoolValue) EQ

func (bv BoolValue) EQ(v Value) (bool, error)

func (BoolValue) Format

func (bv BoolValue) Format(verb rune) string

func (BoolValue) GT

func (bv BoolValue) GT(v Value) (bool, error)

func (BoolValue) GTE

func (bv BoolValue) GTE(v Value) (bool, error)

func (BoolValue) Interface

func (bv BoolValue) Interface() any

func (BoolValue) LT

func (bv BoolValue) LT(v Value) (bool, error)

func (BoolValue) LTE

func (bv BoolValue) LTE(v Value) (bool, error)

func (BoolValue) Mul

func (bv BoolValue) Mul(v Value) (Value, error)

func (BoolValue) Sub

func (bv BoolValue) Sub(v Value) (Value, error)

func (BoolValue) ToArray

func (bv BoolValue) ToArray() (*ArrayValue, error)

func (BoolValue) ToBool

func (bv BoolValue) ToBool() (bool, error)

func (BoolValue) ToBytes

func (bv BoolValue) ToBytes() ([]byte, error)

func (BoolValue) ToFloat64

func (bv BoolValue) ToFloat64() (float64, error)

func (BoolValue) ToInt64

func (bv BoolValue) ToInt64() (int64, error)

func (BoolValue) ToJSON

func (bv BoolValue) ToJSON() (string, error)

func (BoolValue) ToRat

func (bv BoolValue) ToRat() (*big.Rat, error)

func (BoolValue) ToString

func (bv BoolValue) ToString() (string, error)

func (BoolValue) ToStruct

func (bv BoolValue) ToStruct() (*StructValue, error)

func (BoolValue) ToTime

func (bv BoolValue) ToTime() (time.Time, error)

type BytesValue

type BytesValue []byte

func (BytesValue) Add

func (bv BytesValue) Add(v Value) (Value, error)

func (BytesValue) Div

func (bv BytesValue) Div(v Value) (Value, error)

func (BytesValue) EQ

func (bv BytesValue) EQ(v Value) (bool, error)

func (BytesValue) Format

func (bv BytesValue) Format(verb rune) string

func (BytesValue) GT

func (bv BytesValue) GT(v Value) (bool, error)

func (BytesValue) GTE

func (bv BytesValue) GTE(v Value) (bool, error)

func (BytesValue) Interface

func (bv BytesValue) Interface() any

func (BytesValue) LT

func (bv BytesValue) LT(v Value) (bool, error)

func (BytesValue) LTE

func (bv BytesValue) LTE(v Value) (bool, error)

func (BytesValue) Mul

func (bv BytesValue) Mul(v Value) (Value, error)

func (BytesValue) Sub

func (bv BytesValue) Sub(v Value) (Value, error)

func (BytesValue) ToArray

func (bv BytesValue) ToArray() (*ArrayValue, error)

func (BytesValue) ToBool

func (bv BytesValue) ToBool() (bool, error)

func (BytesValue) ToBytes

func (bv BytesValue) ToBytes() ([]byte, error)

func (BytesValue) ToFloat64

func (bv BytesValue) ToFloat64() (float64, error)

func (BytesValue) ToInt64

func (bv BytesValue) ToInt64() (int64, error)

func (BytesValue) ToJSON

func (bv BytesValue) ToJSON() (string, error)

func (BytesValue) ToRat

func (bv BytesValue) ToRat() (*big.Rat, error)

func (BytesValue) ToString

func (bv BytesValue) ToString() (string, error)

func (BytesValue) ToStruct

func (bv BytesValue) ToStruct() (*StructValue, error)

func (BytesValue) ToTime

func (bv BytesValue) ToTime() (time.Time, error)

type DateValue

type DateValue time.Time

func (DateValue) Add

func (d DateValue) Add(v Value) (Value, error)

func (DateValue) AddDateWithInterval

func (d DateValue) AddDateWithInterval(v int, interval string) (Value, error)

func (DateValue) Div

func (d DateValue) Div(v Value) (Value, error)

func (DateValue) EQ

func (d DateValue) EQ(v Value) (bool, error)

func (DateValue) Format

func (d DateValue) Format(verb rune) string

func (DateValue) GT

func (d DateValue) GT(v Value) (bool, error)

func (DateValue) GTE

func (d DateValue) GTE(v Value) (bool, error)

func (DateValue) Interface

func (d DateValue) Interface() any

func (DateValue) LT

func (d DateValue) LT(v Value) (bool, error)

func (DateValue) LTE

func (d DateValue) LTE(v Value) (bool, error)

func (DateValue) Mul

func (d DateValue) Mul(v Value) (Value, error)

func (DateValue) Sub

func (d DateValue) Sub(v Value) (Value, error)

func (DateValue) ToArray

func (d DateValue) ToArray() (*ArrayValue, error)

func (DateValue) ToBool

func (d DateValue) ToBool() (bool, error)

func (DateValue) ToBytes

func (d DateValue) ToBytes() ([]byte, error)

func (DateValue) ToFloat64

func (d DateValue) ToFloat64() (float64, error)

func (DateValue) ToInt64

func (d DateValue) ToInt64() (int64, error)

func (DateValue) ToJSON

func (d DateValue) ToJSON() (string, error)

func (DateValue) ToRat

func (d DateValue) ToRat() (*big.Rat, error)

func (DateValue) ToString

func (d DateValue) ToString() (string, error)

func (DateValue) ToStruct

func (d DateValue) ToStruct() (*StructValue, error)

func (DateValue) ToTime

func (d DateValue) ToTime() (time.Time, error)

type DatetimeValue

type DatetimeValue time.Time

func (DatetimeValue) Add

func (d DatetimeValue) Add(v Value) (Value, error)

func (DatetimeValue) Div

func (d DatetimeValue) Div(v Value) (Value, error)

func (DatetimeValue) EQ

func (d DatetimeValue) EQ(v Value) (bool, error)

func (DatetimeValue) Format

func (d DatetimeValue) Format(verb rune) string

func (DatetimeValue) GT

func (d DatetimeValue) GT(v Value) (bool, error)

func (DatetimeValue) GTE

func (d DatetimeValue) GTE(v Value) (bool, error)

func (DatetimeValue) Interface

func (d DatetimeValue) Interface() any

func (DatetimeValue) LT

func (d DatetimeValue) LT(v Value) (bool, error)

func (DatetimeValue) LTE

func (d DatetimeValue) LTE(v Value) (bool, error)

func (DatetimeValue) Mul

func (d DatetimeValue) Mul(v Value) (Value, error)

func (DatetimeValue) Sub

func (d DatetimeValue) Sub(v Value) (Value, error)

func (DatetimeValue) ToArray

func (d DatetimeValue) ToArray() (*ArrayValue, error)

func (DatetimeValue) ToBool

func (d DatetimeValue) ToBool() (bool, error)

func (DatetimeValue) ToBytes

func (d DatetimeValue) ToBytes() ([]byte, error)

func (DatetimeValue) ToFloat64

func (d DatetimeValue) ToFloat64() (float64, error)

func (DatetimeValue) ToInt64

func (d DatetimeValue) ToInt64() (int64, error)

func (DatetimeValue) ToJSON

func (d DatetimeValue) ToJSON() (string, error)

func (DatetimeValue) ToRat

func (d DatetimeValue) ToRat() (*big.Rat, error)

func (DatetimeValue) ToString

func (d DatetimeValue) ToString() (string, error)

func (DatetimeValue) ToStruct

func (d DatetimeValue) ToStruct() (*StructValue, error)

func (DatetimeValue) ToTime

func (d DatetimeValue) ToTime() (time.Time, error)

type FloatValue

type FloatValue float64

func (FloatValue) Add

func (fv FloatValue) Add(v Value) (Value, error)

func (FloatValue) Div

func (fv FloatValue) Div(v Value) (Value, error)

func (FloatValue) EQ

func (fv FloatValue) EQ(v Value) (bool, error)

func (FloatValue) Format

func (fv FloatValue) Format(verb rune) string

func (FloatValue) GT

func (fv FloatValue) GT(v Value) (bool, error)

func (FloatValue) GTE

func (fv FloatValue) GTE(v Value) (bool, error)

func (FloatValue) Interface

func (fv FloatValue) Interface() any

func (FloatValue) LT

func (fv FloatValue) LT(v Value) (bool, error)

func (FloatValue) LTE

func (fv FloatValue) LTE(v Value) (bool, error)

func (FloatValue) Mul

func (fv FloatValue) Mul(v Value) (Value, error)

func (FloatValue) Sub

func (fv FloatValue) Sub(v Value) (Value, error)

func (FloatValue) ToArray

func (fv FloatValue) ToArray() (*ArrayValue, error)

func (FloatValue) ToBool

func (fv FloatValue) ToBool() (bool, error)

func (FloatValue) ToBytes

func (fv FloatValue) ToBytes() ([]byte, error)

func (FloatValue) ToFloat64

func (fv FloatValue) ToFloat64() (float64, error)

func (FloatValue) ToInt64

func (fv FloatValue) ToInt64() (int64, error)

func (FloatValue) ToJSON

func (fv FloatValue) ToJSON() (string, error)

func (FloatValue) ToRat

func (fv FloatValue) ToRat() (*big.Rat, error)

func (FloatValue) ToString

func (fv FloatValue) ToString() (string, error)

func (FloatValue) ToStruct

func (fv FloatValue) ToStruct() (*StructValue, error)

func (FloatValue) ToTime

func (fv FloatValue) ToTime() (time.Time, error)

type GeographyValue

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

GeographyValue follows the OGC Simple Features specification (SFS). Internally we carry the geometry as a tagged Go struct. The supported tags are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION.

Pure-Go geometry implementations (without S2 / GEOS) cover round-trip storage, structural equality, and distance / intersection for Point–Point pairs. Full spherical computations on non-Point geometries return a clear "unsupported" error rather than wrong numbers.

func GeographyFromWKT

func GeographyFromWKT(wkt string) (*GeographyValue, error)

GeographyFromWKT parses a WKT string into a GeographyValue. Supports POINT / LINESTRING / POLYGON / MULTIPOINT / MULTILINESTRING / MULTIPOLYGON / GEOMETRYCOLLECTION.

func NewGeographyCollection

func NewGeographyCollection(parts []*GeographyValue) *GeographyValue

func NewGeographyLineString

func NewGeographyLineString(points [][2]float64) *GeographyValue

func NewGeographyMultiLineString

func NewGeographyMultiLineString(lines [][][2]float64) *GeographyValue

func NewGeographyMultiPoint

func NewGeographyMultiPoint(points [][2]float64) *GeographyValue

func NewGeographyMultiPolygon

func NewGeographyMultiPolygon(polys [][][][2]float64) *GeographyValue

func NewGeographyPoint

func NewGeographyPoint(longitude, latitude float64) *GeographyValue

func NewGeographyPolygon

func NewGeographyPolygon(rings [][][2]float64) *GeographyValue

func (*GeographyValue) Add

func (g *GeographyValue) Add(_ Value) (Value, error)

func (*GeographyValue) CollectionParts

func (g *GeographyValue) CollectionParts() ([]*GeographyValue, bool)

CollectionParts returns the constituent geographies of a GEOMETRYCOLLECTION. Returns ok=false otherwise.

func (*GeographyValue) DistanceTo

func (g *GeographyValue) DistanceTo(other *GeographyValue) (float64, error)

DistanceTo returns the great-circle (haversine) distance in meters between two GeographyValue points. Non-Point geometries return an error — full polygon / line distance needs spherical geometry (S2) which is out of scope for the pure-Go build.

func (*GeographyValue) Div

func (g *GeographyValue) Div(_ Value) (Value, error)

func (*GeographyValue) EQ

func (g *GeographyValue) EQ(other Value) (bool, error)

EQ implements structural equality for geography. Two geographies compare equal when they have the same kind and identical coordinates in declaration order. SFS spatial-equality (same point set, possibly different orderings) is more permissive but requires S2 / GEOS to compute robustly; structural equality is what every emulator-side workload here expects.

func (*GeographyValue) EqualPoint

func (g *GeographyValue) EqualPoint(other *GeographyValue) bool

EqualPoint returns true when both geographies are points and have equal coordinates.

func (*GeographyValue) Format

func (g *GeographyValue) Format(verb rune) string

func (*GeographyValue) GT

func (g *GeographyValue) GT(_ Value) (bool, error)

func (*GeographyValue) GTE

func (g *GeographyValue) GTE(_ Value) (bool, error)

func (*GeographyValue) Interface

func (g *GeographyValue) Interface() any

func (*GeographyValue) Inverted

func (g *GeographyValue) Inverted() bool

Inverted reports whether the polygon was parsed in oriented mode with a clockwise outer ring (interior is the globe minus the ring's enclosed region).

func (*GeographyValue) IsEmpty

func (g *GeographyValue) IsEmpty() bool

IsEmpty reports whether the geography is one of the WKT EMPTY sentinels (POINT EMPTY, LINESTRING EMPTY, ...): no vertices to participate in distance / area / bounding-box computation. `fullglobe` is NOT empty; it has zero rings but represents the entire surface of Earth.

func (*GeographyValue) Kind

func (g *GeographyValue) Kind() string

Kind returns the WKT-style geometry tag (POINT / LINESTRING / ...). Returns "" for a nil GeographyValue.

func (*GeographyValue) LT

func (g *GeographyValue) LT(_ Value) (bool, error)

func (*GeographyValue) LTE

func (g *GeographyValue) LTE(_ Value) (bool, error)

func (*GeographyValue) LineStringPoints

func (g *GeographyValue) LineStringPoints() ([][2]float64, bool)

LineStringPoints returns the ordered points of a LINESTRING. Returns ok=false for any other geometry kind.

func (*GeographyValue) MarkInverted

func (g *GeographyValue) MarkInverted()

MarkInverted is called by the WKT parser (or any caller that knows the oriented=TRUE convention) to flag the polygon as representing the complement of its enclosed region.

func (*GeographyValue) Mul

func (g *GeographyValue) Mul(_ Value) (Value, error)

func (*GeographyValue) MultiLineStringLines

func (g *GeographyValue) MultiLineStringLines() ([][][2]float64, bool)

MultiLineStringLines returns the individual line strings of a MULTILINESTRING. Returns ok=false otherwise.

func (*GeographyValue) MultiPointPoints

func (g *GeographyValue) MultiPointPoints() ([][2]float64, bool)

MultiPointPoints returns the points of a MULTIPOINT geography. Returns ok=false otherwise.

func (*GeographyValue) MultiPolygonPolys

func (g *GeographyValue) MultiPolygonPolys() ([][][][2]float64, bool)

MultiPolygonPolys returns the polygons of a MULTIPOLYGON, each represented as its ring list (outer then inner).

func (*GeographyValue) PointCoordinates

func (g *GeographyValue) PointCoordinates() (float64, float64, bool)

PointCoordinates returns (longitude, latitude) when the geography is a Point. Returns ok=false otherwise (including POINT EMPTY, which carries no coordinates). Used by ST_X / ST_Y.

func (*GeographyValue) PolygonRings

func (g *GeographyValue) PolygonRings() ([][][2]float64, bool)

PolygonRings returns the rings of a POLYGON (outer ring first, inner rings second). Returns ok=false for any other geometry kind.

func (*GeographyValue) String

func (g *GeographyValue) String() (string, error)

func (*GeographyValue) Sub

func (g *GeographyValue) Sub(_ Value) (Value, error)

func (*GeographyValue) ToArray

func (g *GeographyValue) ToArray() (*ArrayValue, error)

func (*GeographyValue) ToBool

func (g *GeographyValue) ToBool() (bool, error)

func (*GeographyValue) ToBytes

func (g *GeographyValue) ToBytes() ([]byte, error)

func (*GeographyValue) ToFloat64

func (g *GeographyValue) ToFloat64() (float64, error)

func (*GeographyValue) ToInt64

func (g *GeographyValue) ToInt64() (int64, error)

func (*GeographyValue) ToJSON

func (g *GeographyValue) ToJSON() (string, error)

func (*GeographyValue) ToRat

func (g *GeographyValue) ToRat() (*big.Rat, error)

func (*GeographyValue) ToString

func (g *GeographyValue) ToString() (string, error)

func (*GeographyValue) ToStruct

func (g *GeographyValue) ToStruct() (*StructValue, error)

func (*GeographyValue) ToTime

func (g *GeographyValue) ToTime() (time.Time, error)

func (*GeographyValue) ToWKT

func (g *GeographyValue) ToWKT() (string, error)

type IntValue

type IntValue int64

func (IntValue) Add

func (iv IntValue) Add(v Value) (Value, error)

func (IntValue) Div

func (iv IntValue) Div(v Value) (Value, error)

func (IntValue) EQ

func (iv IntValue) EQ(v Value) (bool, error)

func (IntValue) Format

func (iv IntValue) Format(verb rune) string

func (IntValue) GT

func (iv IntValue) GT(v Value) (bool, error)

func (IntValue) GTE

func (iv IntValue) GTE(v Value) (bool, error)

func (IntValue) Interface

func (iv IntValue) Interface() any

func (IntValue) LT

func (iv IntValue) LT(v Value) (bool, error)

func (IntValue) LTE

func (iv IntValue) LTE(v Value) (bool, error)

func (IntValue) Mul

func (iv IntValue) Mul(v Value) (Value, error)

func (IntValue) Sub

func (iv IntValue) Sub(v Value) (Value, error)

func (IntValue) ToArray

func (iv IntValue) ToArray() (*ArrayValue, error)

func (IntValue) ToBool

func (iv IntValue) ToBool() (bool, error)

func (IntValue) ToBytes

func (iv IntValue) ToBytes() ([]byte, error)

func (IntValue) ToFloat64

func (iv IntValue) ToFloat64() (float64, error)

func (IntValue) ToInt64

func (iv IntValue) ToInt64() (int64, error)

func (IntValue) ToJSON

func (iv IntValue) ToJSON() (string, error)

func (IntValue) ToRat

func (iv IntValue) ToRat() (*big.Rat, error)

func (IntValue) ToString

func (iv IntValue) ToString() (string, error)

func (IntValue) ToStruct

func (iv IntValue) ToStruct() (*StructValue, error)

func (IntValue) ToTime

func (iv IntValue) ToTime() (time.Time, error)

type IntervalValue

type IntervalValue struct {
	*intervalvalue.IntervalValue
}

func ParseInterval

func ParseInterval(s string) (*IntervalValue, error)

func (*IntervalValue) Add

func (iv *IntervalValue) Add(v Value) (Value, error)

func (*IntervalValue) Div

func (iv *IntervalValue) Div(v Value) (Value, error)

func (*IntervalValue) EQ

func (iv *IntervalValue) EQ(v Value) (bool, error)

func (*IntervalValue) Format

func (iv *IntervalValue) Format(verb rune) string

func (*IntervalValue) GT

func (iv *IntervalValue) GT(v Value) (bool, error)

func (*IntervalValue) GTE

func (iv *IntervalValue) GTE(v Value) (bool, error)

func (*IntervalValue) Interface

func (iv *IntervalValue) Interface() any

func (*IntervalValue) LT

func (iv *IntervalValue) LT(v Value) (bool, error)

func (*IntervalValue) LTE

func (iv *IntervalValue) LTE(v Value) (bool, error)

func (*IntervalValue) Mul

func (iv *IntervalValue) Mul(v Value) (Value, error)

func (*IntervalValue) Sub

func (iv *IntervalValue) Sub(v Value) (Value, error)

func (*IntervalValue) ToArray

func (iv *IntervalValue) ToArray() (*ArrayValue, error)

func (*IntervalValue) ToBool

func (iv *IntervalValue) ToBool() (bool, error)

func (*IntervalValue) ToBytes

func (iv *IntervalValue) ToBytes() ([]byte, error)

func (*IntervalValue) ToFloat64

func (iv *IntervalValue) ToFloat64() (float64, error)

func (*IntervalValue) ToInt64

func (iv *IntervalValue) ToInt64() (int64, error)

func (*IntervalValue) ToJSON

func (iv *IntervalValue) ToJSON() (string, error)

func (*IntervalValue) ToRat

func (iv *IntervalValue) ToRat() (*big.Rat, error)

func (*IntervalValue) ToString

func (iv *IntervalValue) ToString() (string, error)

func (*IntervalValue) ToStruct

func (iv *IntervalValue) ToStruct() (*StructValue, error)

func (*IntervalValue) ToTime

func (iv *IntervalValue) ToTime() (time.Time, error)

type JsonValue

type JsonValue string

func (JsonValue) Add

func (jv JsonValue) Add(v Value) (Value, error)

func (JsonValue) Div

func (jv JsonValue) Div(v Value) (Value, error)

func (JsonValue) EQ

func (jv JsonValue) EQ(v Value) (bool, error)

func (JsonValue) Format

func (jv JsonValue) Format(verb rune) string

func (JsonValue) GT

func (jv JsonValue) GT(v Value) (bool, error)

func (JsonValue) GTE

func (jv JsonValue) GTE(v Value) (bool, error)

func (JsonValue) Interface

func (jv JsonValue) Interface() any

func (JsonValue) LT

func (jv JsonValue) LT(v Value) (bool, error)

func (JsonValue) LTE

func (jv JsonValue) LTE(v Value) (bool, error)

func (JsonValue) Mul

func (jv JsonValue) Mul(v Value) (Value, error)

func (JsonValue) Sub

func (jv JsonValue) Sub(v Value) (Value, error)

func (JsonValue) ToArray

func (jv JsonValue) ToArray() (*ArrayValue, error)

func (JsonValue) ToBool

func (jv JsonValue) ToBool() (bool, error)

func (JsonValue) ToBytes

func (jv JsonValue) ToBytes() ([]byte, error)

func (JsonValue) ToFloat64

func (jv JsonValue) ToFloat64() (float64, error)

func (JsonValue) ToInt64

func (jv JsonValue) ToInt64() (int64, error)

func (JsonValue) ToJSON

func (jv JsonValue) ToJSON() (string, error)

func (JsonValue) ToRat

func (jv JsonValue) ToRat() (*big.Rat, error)

func (JsonValue) ToString

func (jv JsonValue) ToString() (string, error)

func (JsonValue) ToStruct

func (jv JsonValue) ToStruct() (*StructValue, error)

func (JsonValue) ToTime

func (jv JsonValue) ToTime() (time.Time, error)

func (JsonValue) Type

func (jv JsonValue) Type() string

type NumericValue

type NumericValue struct {
	*big.Rat
	IsBigNumeric bool
}

func (*NumericValue) Add

func (nv *NumericValue) Add(v Value) (Value, error)

func (*NumericValue) Div

func (nv *NumericValue) Div(v Value) (ret Value, e error)

func (*NumericValue) EQ

func (nv *NumericValue) EQ(v Value) (bool, error)

func (*NumericValue) Format

func (nv *NumericValue) Format(verb rune) string

func (*NumericValue) GT

func (nv *NumericValue) GT(v Value) (bool, error)

func (*NumericValue) GTE

func (nv *NumericValue) GTE(v Value) (bool, error)

func (*NumericValue) Interface

func (nv *NumericValue) Interface() any

func (*NumericValue) LT

func (nv *NumericValue) LT(v Value) (bool, error)

func (*NumericValue) LTE

func (nv *NumericValue) LTE(v Value) (bool, error)

func (*NumericValue) Mul

func (nv *NumericValue) Mul(v Value) (Value, error)

func (*NumericValue) Sub

func (nv *NumericValue) Sub(v Value) (Value, error)

func (*NumericValue) ToArray

func (nv *NumericValue) ToArray() (*ArrayValue, error)

func (*NumericValue) ToBool

func (nv *NumericValue) ToBool() (bool, error)

func (*NumericValue) ToBytes

func (nv *NumericValue) ToBytes() ([]byte, error)

func (*NumericValue) ToFloat64

func (nv *NumericValue) ToFloat64() (float64, error)

func (*NumericValue) ToInt64

func (nv *NumericValue) ToInt64() (int64, error)

func (*NumericValue) ToJSON

func (nv *NumericValue) ToJSON() (string, error)

func (*NumericValue) ToRat

func (nv *NumericValue) ToRat() (*big.Rat, error)

func (*NumericValue) ToString

func (nv *NumericValue) ToString() (string, error)

func (*NumericValue) ToStruct

func (nv *NumericValue) ToStruct() (*StructValue, error)

func (*NumericValue) ToTime

func (nv *NumericValue) ToTime() (time.Time, error)

type RangeValue

type RangeValue struct {
	Start Value // nil = unbounded
	End   Value // nil = unbounded
	// ElemHeader records the element ValueType so the decoder can
	// reconstruct typed bounds without redundant type inference.
	ElemHeader ValueType
}

RangeValue is a half-open interval [Start, End) over a comparable element type. Per BigQuery, RANGE supports DATE, DATETIME, and TIMESTAMP element types. Either bound can be NULL — interpreted as "unbounded".

func (*RangeValue) Add

func (r *RangeValue) Add(Value) (Value, error)

func (*RangeValue) Div

func (r *RangeValue) Div(Value) (Value, error)

func (*RangeValue) EQ

func (r *RangeValue) EQ(other Value) (bool, error)

func (*RangeValue) Format

func (r *RangeValue) Format(verb rune) string

func (*RangeValue) GT

func (r *RangeValue) GT(Value) (bool, error)

func (*RangeValue) GTE

func (r *RangeValue) GTE(Value) (bool, error)

func (*RangeValue) Interface

func (r *RangeValue) Interface() any

func (*RangeValue) LT

func (r *RangeValue) LT(Value) (bool, error)

func (*RangeValue) LTE

func (r *RangeValue) LTE(Value) (bool, error)

func (*RangeValue) Mul

func (r *RangeValue) Mul(Value) (Value, error)

func (*RangeValue) Sub

func (r *RangeValue) Sub(Value) (Value, error)

func (*RangeValue) ToArray

func (r *RangeValue) ToArray() (*ArrayValue, error)

func (*RangeValue) ToBool

func (r *RangeValue) ToBool() (bool, error)

func (*RangeValue) ToBytes

func (r *RangeValue) ToBytes() ([]byte, error)

func (*RangeValue) ToFloat64

func (r *RangeValue) ToFloat64() (float64, error)

func (*RangeValue) ToInt64

func (r *RangeValue) ToInt64() (int64, error)

func (*RangeValue) ToJSON

func (r *RangeValue) ToJSON() (string, error)

func (*RangeValue) ToRat

func (r *RangeValue) ToRat() (*big.Rat, error)

func (*RangeValue) ToString

func (r *RangeValue) ToString() (string, error)

func (*RangeValue) ToStruct

func (r *RangeValue) ToStruct() (*StructValue, error)

func (*RangeValue) ToTime

func (r *RangeValue) ToTime() (time.Time, error)

type SafeValue

type SafeValue struct {
	Value Value
}

func (*SafeValue) Add

func (v *SafeValue) Add(arg Value) (Value, error)

func (*SafeValue) Div

func (v *SafeValue) Div(arg Value) (Value, error)

func (*SafeValue) EQ

func (v *SafeValue) EQ(arg Value) (bool, error)

func (*SafeValue) Format

func (v *SafeValue) Format(verb rune) string

func (*SafeValue) GT

func (v *SafeValue) GT(arg Value) (bool, error)

func (*SafeValue) GTE

func (v *SafeValue) GTE(arg Value) (bool, error)

func (*SafeValue) Interface

func (v *SafeValue) Interface() any

func (*SafeValue) LT

func (v *SafeValue) LT(arg Value) (bool, error)

func (*SafeValue) LTE

func (v *SafeValue) LTE(arg Value) (bool, error)

func (*SafeValue) Mul

func (v *SafeValue) Mul(arg Value) (Value, error)

func (*SafeValue) Sub

func (v *SafeValue) Sub(arg Value) (Value, error)

func (*SafeValue) ToArray

func (v *SafeValue) ToArray() (*ArrayValue, error)

func (*SafeValue) ToBool

func (v *SafeValue) ToBool() (bool, error)

func (*SafeValue) ToBytes

func (v *SafeValue) ToBytes() ([]byte, error)

func (*SafeValue) ToFloat64

func (v *SafeValue) ToFloat64() (float64, error)

func (*SafeValue) ToInt64

func (v *SafeValue) ToInt64() (int64, error)

func (*SafeValue) ToJSON

func (v *SafeValue) ToJSON() (string, error)

func (*SafeValue) ToRat

func (v *SafeValue) ToRat() (*big.Rat, error)

func (*SafeValue) ToString

func (v *SafeValue) ToString() (string, error)

func (*SafeValue) ToStruct

func (v *SafeValue) ToStruct() (*StructValue, error)

func (*SafeValue) ToTime

func (v *SafeValue) ToTime() (time.Time, error)

type StringValue

type StringValue string

func (StringValue) Add

func (sv StringValue) Add(v Value) (Value, error)

func (StringValue) Div

func (sv StringValue) Div(v Value) (Value, error)

func (StringValue) EQ

func (sv StringValue) EQ(v Value) (bool, error)

func (StringValue) Format

func (sv StringValue) Format(verb rune) string

func (StringValue) GT

func (sv StringValue) GT(v Value) (bool, error)

func (StringValue) GTE

func (sv StringValue) GTE(v Value) (bool, error)

func (StringValue) Interface

func (sv StringValue) Interface() any

func (StringValue) LT

func (sv StringValue) LT(v Value) (bool, error)

func (StringValue) LTE

func (sv StringValue) LTE(v Value) (bool, error)

func (StringValue) Mul

func (sv StringValue) Mul(v Value) (Value, error)

func (StringValue) Sub

func (sv StringValue) Sub(v Value) (Value, error)

func (StringValue) ToArray

func (sv StringValue) ToArray() (*ArrayValue, error)

func (StringValue) ToBool

func (sv StringValue) ToBool() (bool, error)

func (StringValue) ToBytes

func (sv StringValue) ToBytes() ([]byte, error)

func (StringValue) ToFloat64

func (sv StringValue) ToFloat64() (float64, error)

func (StringValue) ToInt64

func (sv StringValue) ToInt64() (int64, error)

func (StringValue) ToJSON

func (sv StringValue) ToJSON() (string, error)

func (StringValue) ToRat

func (sv StringValue) ToRat() (*big.Rat, error)

func (StringValue) ToString

func (sv StringValue) ToString() (string, error)

func (StringValue) ToStruct

func (sv StringValue) ToStruct() (*StructValue, error)

func (StringValue) ToTime

func (sv StringValue) ToTime() (time.Time, error)

type StructValue

type StructValue struct {
	Keys   []string
	Values []Value
	M      map[string]Value
}

func (*StructValue) Add

func (sv *StructValue) Add(v Value) (Value, error)

func (*StructValue) Div

func (sv *StructValue) Div(v Value) (Value, error)

func (*StructValue) EQ

func (sv *StructValue) EQ(v Value) (bool, error)

func (*StructValue) Format

func (sv *StructValue) Format(verb rune) string

func (*StructValue) GT

func (sv *StructValue) GT(v Value) (bool, error)

func (*StructValue) GTE

func (sv *StructValue) GTE(v Value) (bool, error)

func (*StructValue) Interface

func (sv *StructValue) Interface() any

func (*StructValue) LT

func (sv *StructValue) LT(v Value) (bool, error)

func (*StructValue) LTE

func (sv *StructValue) LTE(v Value) (bool, error)

func (*StructValue) Mul

func (sv *StructValue) Mul(v Value) (Value, error)

func (*StructValue) Sub

func (sv *StructValue) Sub(v Value) (Value, error)

func (*StructValue) ToArray

func (sv *StructValue) ToArray() (*ArrayValue, error)

func (*StructValue) ToBool

func (sv *StructValue) ToBool() (bool, error)

func (*StructValue) ToBytes

func (sv *StructValue) ToBytes() ([]byte, error)

func (*StructValue) ToFloat64

func (sv *StructValue) ToFloat64() (float64, error)

func (*StructValue) ToInt64

func (sv *StructValue) ToInt64() (int64, error)

func (*StructValue) ToJSON

func (sv *StructValue) ToJSON() (string, error)

func (*StructValue) ToRat

func (sv *StructValue) ToRat() (*big.Rat, error)

func (*StructValue) ToString

func (sv *StructValue) ToString() (string, error)

func (*StructValue) ToStruct

func (sv *StructValue) ToStruct() (*StructValue, error)

func (*StructValue) ToTime

func (sv *StructValue) ToTime() (time.Time, error)

type StructValueLayout

type StructValueLayout struct {
	Keys   []string `json:"keys"`
	Values []any    `json:"values"`
}

type TimeValue

type TimeValue time.Time

func (TimeValue) Add

func (t TimeValue) Add(v Value) (Value, error)

func (TimeValue) Div

func (t TimeValue) Div(v Value) (Value, error)

func (TimeValue) EQ

func (t TimeValue) EQ(v Value) (bool, error)

func (TimeValue) Format

func (t TimeValue) Format(verb rune) string

func (TimeValue) GT

func (t TimeValue) GT(v Value) (bool, error)

func (TimeValue) GTE

func (t TimeValue) GTE(v Value) (bool, error)

func (TimeValue) Interface

func (t TimeValue) Interface() any

func (TimeValue) LT

func (t TimeValue) LT(v Value) (bool, error)

func (TimeValue) LTE

func (t TimeValue) LTE(v Value) (bool, error)

func (TimeValue) Mul

func (t TimeValue) Mul(v Value) (Value, error)

func (TimeValue) Sub

func (t TimeValue) Sub(v Value) (Value, error)

func (TimeValue) ToArray

func (t TimeValue) ToArray() (*ArrayValue, error)

func (TimeValue) ToBool

func (t TimeValue) ToBool() (bool, error)

func (TimeValue) ToBytes

func (t TimeValue) ToBytes() ([]byte, error)

func (TimeValue) ToFloat64

func (t TimeValue) ToFloat64() (float64, error)

func (TimeValue) ToInt64

func (t TimeValue) ToInt64() (int64, error)

func (TimeValue) ToJSON

func (t TimeValue) ToJSON() (string, error)

func (TimeValue) ToRat

func (t TimeValue) ToRat() (*big.Rat, error)

func (TimeValue) ToString

func (t TimeValue) ToString() (string, error)

func (TimeValue) ToStruct

func (t TimeValue) ToStruct() (*StructValue, error)

func (TimeValue) ToTime

func (t TimeValue) ToTime() (time.Time, error)

type TimestampValue

type TimestampValue time.Time

func (TimestampValue) Add

func (t TimestampValue) Add(v Value) (Value, error)

func (TimestampValue) AddValueWithPart

func (t TimestampValue) AddValueWithPart(v int64, part string) (Value, error)

func (TimestampValue) Div

func (t TimestampValue) Div(v Value) (Value, error)

func (TimestampValue) EQ

func (t TimestampValue) EQ(v Value) (bool, error)

func (TimestampValue) Format

func (t TimestampValue) Format(verb rune) string

func (TimestampValue) GT

func (t TimestampValue) GT(v Value) (bool, error)

func (TimestampValue) GTE

func (t TimestampValue) GTE(v Value) (bool, error)

func (TimestampValue) Interface

func (t TimestampValue) Interface() any

func (TimestampValue) LT

func (t TimestampValue) LT(v Value) (bool, error)

func (TimestampValue) LTE

func (t TimestampValue) LTE(v Value) (bool, error)

func (TimestampValue) Mul

func (t TimestampValue) Mul(v Value) (Value, error)

func (TimestampValue) Sub

func (t TimestampValue) Sub(v Value) (Value, error)

func (TimestampValue) ToArray

func (t TimestampValue) ToArray() (*ArrayValue, error)

func (TimestampValue) ToBool

func (t TimestampValue) ToBool() (bool, error)

func (TimestampValue) ToBytes

func (t TimestampValue) ToBytes() ([]byte, error)

func (TimestampValue) ToFloat64

func (t TimestampValue) ToFloat64() (float64, error)

func (TimestampValue) ToInt64

func (t TimestampValue) ToInt64() (int64, error)

func (TimestampValue) ToJSON

func (t TimestampValue) ToJSON() (string, error)

func (TimestampValue) ToRat

func (t TimestampValue) ToRat() (*big.Rat, error)

func (TimestampValue) ToString

func (t TimestampValue) ToString() (string, error)

func (TimestampValue) ToStruct

func (t TimestampValue) ToStruct() (*StructValue, error)

func (TimestampValue) ToTime

func (t TimestampValue) ToTime() (time.Time, error)

type Value

type Value interface {
	Add(Value) (Value, error)
	Sub(Value) (Value, error)
	Mul(Value) (Value, error)
	Div(Value) (Value, error)
	EQ(Value) (bool, error)
	GT(Value) (bool, error)
	GTE(Value) (bool, error)
	LT(Value) (bool, error)
	LTE(Value) (bool, error)
	ToInt64() (int64, error)
	ToString() (string, error)
	ToBytes() ([]byte, error)
	ToFloat64() (float64, error)
	ToBool() (bool, error)
	ToArray() (*ArrayValue, error)
	ToStruct() (*StructValue, error)
	ToJSON() (string, error)
	ToTime() (time.Time, error)
	ToRat() (*big.Rat, error)
	Format(verb rune) string
	Interface() any
}

func ConvertArgs

func ConvertArgs(args ...any) ([]Value, error)

ConvertArgs decodes a sequence of SQLite-side Go values (the form the ncruces driver hands us in Step / scalar callbacks) into a slice of googlesqlite Values. It is a thin loop around DecodeValue.

func DecodeValue

func DecodeValue(v any) (Value, error)

DecodeValue is the inverse of EncodeValue: given the over-the-wire form (Go primitive or base64-encoded ValueLayout JSON) produce the matching googlesqlite Value.

func ValueFromGoValue

func ValueFromGoValue(v any) (Value, error)

ValueFromGoValue converts a plain Go value (the kind a SQL driver hands us across the FFI boundary) into a googlesqlite Value.

type ValueLayout

type ValueLayout struct {
	Header ValueType `json:"header"`
	Body   string    `json:"body"`
}

func ValueLayoutFromValue

func ValueLayoutFromValue(v Value) (*ValueLayout, error)

ValueLayoutFromValue is the public entry point for the layout builder used by the over-the-wire encoder and by literal rendering.

type ValueType

type ValueType string
const (
	IntValueType        ValueType = "int64"
	StringValueType     ValueType = "string"
	BytesValueType      ValueType = "bytes"
	FloatValueType      ValueType = "float"
	NumericValueType    ValueType = "numeric"
	BigNumericValueType ValueType = "bignumeric"
	BoolValueType       ValueType = "bool"
	JsonValueType       ValueType = "json"
	ArrayValueType      ValueType = "array"
	StructValueType     ValueType = "struct"
	DateValueType       ValueType = "date"
	DatetimeValueType   ValueType = "datetime"
	TimeValueType       ValueType = "time"
	TimestampValueType  ValueType = "timestamp"
	IntervalValueType   ValueType = "interval"
	GeographyValueType  ValueType = "geography"
	RangeValueType      ValueType = "range"
)

Jump to

Keyboard shortcuts

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