types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NumericValueMaxInt16 = decimal.NewFromInt(32767)                // NumericValueMaxInt16 is the max Int16 value for NUMERIC types
	NumericValueMaxInt32 = decimal.NewFromInt(2147483647)           // NumericValueMaxInt16 is the max Int32 value for NUMERIC types
	NumericValueMaxInt64 = decimal.NewFromInt(9223372036854775807)  // NumericValueMaxInt16 is the max Int64 value for NUMERIC types
	NumericValueMinInt16 = decimal.NewFromInt(-32768)               // NumericValueMaxInt16 is the min Int16 value for NUMERIC types
	NumericValueMinInt32 = decimal.NewFromInt(-2147483648)          // NumericValueMaxInt16 is the min Int32 value for NUMERIC types
	NumericValueMinInt64 = decimal.NewFromInt(-9223372036854775808) // NumericValueMaxInt16 is the min Int64 value for NUMERIC types
)
View Source
var Bool = BoolType{}

Bool is the standard boolean.

View Source
var BoolArray = BoolArrayType{}

BoolArray is the standard boolean array.

View Source
var Float32 = Float32Type{}

Float32 is an float32.

View Source
var Float64 = Float64Type{}

Float64 is an float64.

View Source
var Int16 = Int16Type{}

Int16 is an int16.

View Source
var Int32 = Int32Type{}

Int32 is an int32.

View Source
var Int64 = Int64Type{}

Int64 is an int64.

View Source
var Null = NullType{}

Null is the null type

View Source
var Numeric = NumericType{}

Numeric is a precise and unbounded decimal value.

View Source
var Uuid = UuidType{}

Uuid is the UUID type.

View Source
var VarCharInline = VarCharType{Length: varCharInline}

VarCharInline is a varchar that has the max inline length automatically set.

View Source
var VarCharMax = VarCharType{Length: varCharMax}

VarCharMax is a varchar that has the max length.

Functions

func DeserializeType

func DeserializeType(serializedType []byte) (types.ExtendedType, error)

DeserializeType is able to deserialize the given serialized type into an appropriate extended type. All extended types will be defined by DoltgreSQL.

func MustSerializeType

func MustSerializeType(extendedType types.ExtendedType) []byte

MustSerializeType internally calls SerializeType and panics on error. In general, panics should only occur when a type has not yet had its Serialization implemented yet.

func SerializeType

func SerializeType(extendedType types.ExtendedType) ([]byte, error)

SerializeType is able to serialize the given extended type into a byte slice. All extended types will be defined by DoltgreSQL.

Types

type BoolArrayType

type BoolArrayType struct{}

BoolArrayType is the extended type implementation of the PostgreSQL boolean.

func (BoolArrayType) BaseID added in v0.5.0

func (b BoolArrayType) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (BoolArrayType) CollationCoercibility

func (b BoolArrayType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (BoolArrayType) Compare

func (b BoolArrayType) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (BoolArrayType) Convert

func (b BoolArrayType) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (BoolArrayType) DeserializeValue

func (b BoolArrayType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (BoolArrayType) Equals

func (b BoolArrayType) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (BoolArrayType) FormatSerializedValue

func (b BoolArrayType) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (BoolArrayType) FormatValue

func (b BoolArrayType) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (BoolArrayType) MaxSerializedWidth

func (b BoolArrayType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (BoolArrayType) MaxTextResponseByteLength

func (b BoolArrayType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (BoolArrayType) OID added in v0.5.0

func (b BoolArrayType) OID() uint32

OID implements the DoltgresType interface.

func (BoolArrayType) Promote

func (b BoolArrayType) Promote() sql.Type

Promote implements the DoltgresType interface.

func (BoolArrayType) SQL

func (b BoolArrayType) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (BoolArrayType) SerializeValue

func (b BoolArrayType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (BoolArrayType) SerializedCompare

func (b BoolArrayType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (BoolArrayType) String

func (b BoolArrayType) String() string

String implements the DoltgresType interface.

func (BoolArrayType) Type

func (b BoolArrayType) Type() query.Type

Type implements the DoltgresType interface.

func (BoolArrayType) ValueType

func (b BoolArrayType) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (BoolArrayType) Zero

func (b BoolArrayType) Zero() any

Zero implements the DoltgresType interface.

type BoolType

type BoolType struct{}

BoolType is the extended type implementation of the PostgreSQL boolean.

func (BoolType) BaseID added in v0.5.0

func (b BoolType) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (BoolType) CollationCoercibility

func (b BoolType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (BoolType) Compare

func (b BoolType) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (BoolType) Convert

func (b BoolType) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (BoolType) DeserializeValue

func (b BoolType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (BoolType) Equals

func (b BoolType) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (BoolType) FormatSerializedValue

func (b BoolType) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (BoolType) FormatValue

func (b BoolType) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (BoolType) MaxSerializedWidth

func (b BoolType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (BoolType) MaxTextResponseByteLength

func (b BoolType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (BoolType) OID added in v0.5.0

func (b BoolType) OID() uint32

OID implements the DoltgresType interface.

func (BoolType) Promote

func (b BoolType) Promote() sql.Type

Promote implements the DoltgresType interface.

func (BoolType) SQL

func (b BoolType) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (BoolType) SerializeValue

func (b BoolType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (BoolType) SerializedCompare

func (b BoolType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (BoolType) String

func (b BoolType) String() string

String implements the DoltgresType interface.

func (BoolType) Type

func (b BoolType) Type() query.Type

Type implements the DoltgresType interface.

func (BoolType) ValueType

func (b BoolType) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (BoolType) Zero

func (b BoolType) Zero() any

Zero implements the DoltgresType interface.

type DoltgresType added in v0.5.0

type DoltgresType interface {
	types.ExtendedType
	// BaseID returns the DoltgresTypeBaseID for this type.
	BaseID() DoltgresTypeBaseID
	// OID returns an OID that we are associating with this type. OIDs are not unique, and are not guaranteed to be the
	// same between versions of Postgres. However, they've so far appeared relatively stable, and many libraries rely on
	// them for type identification, so we return them here. These should not be used for any sort of identification on
	// our side. For that, we should use DoltgresTypeBaseID, which we can guarantee will be unique and non-changing once
	// we've stabilized development.
	OID() uint32
}

DoltgresType is a type that is distinct from the MySQL types in GMS.

func FromBaseID added in v0.5.0

func FromBaseID(baseID DoltgresTypeBaseID) DoltgresType

FromBaseID returns a DoltgresType that matches the Base ID. This type will usually be the most permissive version of the type, along with any default values.

type DoltgresTypeBaseID added in v0.5.0

type DoltgresTypeBaseID uint32

DoltgresTypeBaseID is an ID that is common between all variations of a DoltgresType. For example, VARCHAR(3) and VARCHAR(6) are different types, however they will return the same DoltgresTypeBaseID. This ID is not suitable for serialization, as it may change over time.

type Float32Type added in v0.5.0

type Float32Type struct{}

Float32Type is the extended type implementation of the PostgreSQL real.

func (Float32Type) BaseID added in v0.5.0

func (b Float32Type) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (Float32Type) CollationCoercibility added in v0.5.0

func (b Float32Type) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (Float32Type) Compare added in v0.5.0

func (b Float32Type) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (Float32Type) Convert added in v0.5.0

func (b Float32Type) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (Float32Type) DeserializeValue added in v0.5.0

func (b Float32Type) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (Float32Type) Equals added in v0.5.0

func (b Float32Type) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (Float32Type) FormatSerializedValue added in v0.5.0

func (b Float32Type) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (Float32Type) FormatValue added in v0.5.0

func (b Float32Type) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (Float32Type) MaxSerializedWidth added in v0.5.0

func (b Float32Type) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (Float32Type) MaxTextResponseByteLength added in v0.5.0

func (b Float32Type) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (Float32Type) OID added in v0.5.0

func (b Float32Type) OID() uint32

OID implements the DoltgresType interface.

func (Float32Type) Promote added in v0.5.0

func (b Float32Type) Promote() sql.Type

Promote implements the DoltgresType interface.

func (Float32Type) SQL added in v0.5.0

func (b Float32Type) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (Float32Type) SerializeValue added in v0.5.0

func (b Float32Type) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (Float32Type) SerializedCompare added in v0.5.0

func (b Float32Type) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (Float32Type) String added in v0.5.0

func (b Float32Type) String() string

String implements the DoltgresType interface.

func (Float32Type) Type added in v0.5.0

func (b Float32Type) Type() query.Type

Type implements the DoltgresType interface.

func (Float32Type) ValueType added in v0.5.0

func (b Float32Type) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (Float32Type) Zero added in v0.5.0

func (b Float32Type) Zero() any

Zero implements the DoltgresType interface.

type Float64Type added in v0.5.0

type Float64Type struct{}

Float64Type is the extended type implementation of the PostgreSQL double precision.

func (Float64Type) BaseID added in v0.5.0

func (b Float64Type) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (Float64Type) CollationCoercibility added in v0.5.0

func (b Float64Type) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (Float64Type) Compare added in v0.5.0

func (b Float64Type) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (Float64Type) Convert added in v0.5.0

func (b Float64Type) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (Float64Type) DeserializeValue added in v0.5.0

func (b Float64Type) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (Float64Type) Equals added in v0.5.0

func (b Float64Type) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (Float64Type) FormatSerializedValue added in v0.5.0

func (b Float64Type) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (Float64Type) FormatValue added in v0.5.0

func (b Float64Type) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (Float64Type) MaxSerializedWidth added in v0.5.0

func (b Float64Type) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (Float64Type) MaxTextResponseByteLength added in v0.5.0

func (b Float64Type) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (Float64Type) OID added in v0.5.0

func (b Float64Type) OID() uint32

OID implements the DoltgresType interface.

func (Float64Type) Promote added in v0.5.0

func (b Float64Type) Promote() sql.Type

Promote implements the DoltgresType interface.

func (Float64Type) SQL added in v0.5.0

func (b Float64Type) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (Float64Type) SerializeValue added in v0.5.0

func (b Float64Type) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (Float64Type) SerializedCompare added in v0.5.0

func (b Float64Type) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (Float64Type) String added in v0.5.0

func (b Float64Type) String() string

String implements the DoltgresType interface.

func (Float64Type) Type added in v0.5.0

func (b Float64Type) Type() query.Type

Type implements the DoltgresType interface.

func (Float64Type) ValueType added in v0.5.0

func (b Float64Type) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (Float64Type) Zero added in v0.5.0

func (b Float64Type) Zero() any

Zero implements the DoltgresType interface.

type Int16Type added in v0.5.0

type Int16Type struct{}

Int16Type is the extended type implementation of the PostgreSQL smallint.

func (Int16Type) BaseID added in v0.5.0

func (b Int16Type) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (Int16Type) CollationCoercibility added in v0.5.0

func (b Int16Type) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (Int16Type) Compare added in v0.5.0

func (b Int16Type) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (Int16Type) Convert added in v0.5.0

func (b Int16Type) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (Int16Type) DeserializeValue added in v0.5.0

func (b Int16Type) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (Int16Type) Equals added in v0.5.0

func (b Int16Type) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (Int16Type) FormatSerializedValue added in v0.5.0

func (b Int16Type) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (Int16Type) FormatValue added in v0.5.0

func (b Int16Type) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (Int16Type) MaxSerializedWidth added in v0.5.0

func (b Int16Type) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (Int16Type) MaxTextResponseByteLength added in v0.5.0

func (b Int16Type) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (Int16Type) OID added in v0.5.0

func (b Int16Type) OID() uint32

OID implements the DoltgresType interface.

func (Int16Type) Promote added in v0.5.0

func (b Int16Type) Promote() sql.Type

Promote implements the DoltgresType interface.

func (Int16Type) SQL added in v0.5.0

func (b Int16Type) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (Int16Type) SerializeValue added in v0.5.0

func (b Int16Type) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (Int16Type) SerializedCompare added in v0.5.0

func (b Int16Type) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (Int16Type) String added in v0.5.0

func (b Int16Type) String() string

String implements the DoltgresType interface.

func (Int16Type) Type added in v0.5.0

func (b Int16Type) Type() query.Type

Type implements the DoltgresType interface.

func (Int16Type) ValueType added in v0.5.0

func (b Int16Type) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (Int16Type) Zero added in v0.5.0

func (b Int16Type) Zero() any

Zero implements the DoltgresType interface.

type Int32Type added in v0.5.0

type Int32Type struct{}

Int32Type is the extended type implementation of the PostgreSQL integer.

func (Int32Type) BaseID added in v0.5.0

func (b Int32Type) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (Int32Type) CollationCoercibility added in v0.5.0

func (b Int32Type) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (Int32Type) Compare added in v0.5.0

func (b Int32Type) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (Int32Type) Convert added in v0.5.0

func (b Int32Type) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (Int32Type) DeserializeValue added in v0.5.0

func (b Int32Type) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (Int32Type) Equals added in v0.5.0

func (b Int32Type) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (Int32Type) FormatSerializedValue added in v0.5.0

func (b Int32Type) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (Int32Type) FormatValue added in v0.5.0

func (b Int32Type) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (Int32Type) MaxSerializedWidth added in v0.5.0

func (b Int32Type) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (Int32Type) MaxTextResponseByteLength added in v0.5.0

func (b Int32Type) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (Int32Type) OID added in v0.5.0

func (b Int32Type) OID() uint32

OID implements the DoltgresType interface.

func (Int32Type) Promote added in v0.5.0

func (b Int32Type) Promote() sql.Type

Promote implements the DoltgresType interface.

func (Int32Type) SQL added in v0.5.0

func (b Int32Type) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (Int32Type) SerializeValue added in v0.5.0

func (b Int32Type) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (Int32Type) SerializedCompare added in v0.5.0

func (b Int32Type) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (Int32Type) String added in v0.5.0

func (b Int32Type) String() string

String implements the DoltgresType interface.

func (Int32Type) Type added in v0.5.0

func (b Int32Type) Type() query.Type

Type implements the DoltgresType interface.

func (Int32Type) ValueType added in v0.5.0

func (b Int32Type) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (Int32Type) Zero added in v0.5.0

func (b Int32Type) Zero() any

Zero implements the DoltgresType interface.

type Int64Type added in v0.5.0

type Int64Type struct{}

Int64Type is the extended type implementation of the PostgreSQL bigint.

func (Int64Type) BaseID added in v0.5.0

func (b Int64Type) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (Int64Type) CollationCoercibility added in v0.5.0

func (b Int64Type) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (Int64Type) Compare added in v0.5.0

func (b Int64Type) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (Int64Type) Convert added in v0.5.0

func (b Int64Type) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (Int64Type) DeserializeValue added in v0.5.0

func (b Int64Type) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (Int64Type) Equals added in v0.5.0

func (b Int64Type) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (Int64Type) FormatSerializedValue added in v0.5.0

func (b Int64Type) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (Int64Type) FormatValue added in v0.5.0

func (b Int64Type) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (Int64Type) MaxSerializedWidth added in v0.5.0

func (b Int64Type) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (Int64Type) MaxTextResponseByteLength added in v0.5.0

func (b Int64Type) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (Int64Type) OID added in v0.5.0

func (b Int64Type) OID() uint32

OID implements the DoltgresType interface.

func (Int64Type) Promote added in v0.5.0

func (b Int64Type) Promote() sql.Type

Promote implements the DoltgresType interface.

func (Int64Type) SQL added in v0.5.0

func (b Int64Type) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (Int64Type) SerializeValue added in v0.5.0

func (b Int64Type) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (Int64Type) SerializedCompare added in v0.5.0

func (b Int64Type) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (Int64Type) String added in v0.5.0

func (b Int64Type) String() string

String implements the DoltgresType interface.

func (Int64Type) Type added in v0.5.0

func (b Int64Type) Type() query.Type

Type implements the DoltgresType interface.

func (Int64Type) ValueType added in v0.5.0

func (b Int64Type) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (Int64Type) Zero added in v0.5.0

func (b Int64Type) Zero() any

Zero implements the DoltgresType interface.

type NullType added in v0.5.0

type NullType struct{}

NullType is the extended type implementation of the PostgreSQL null.

func (NullType) BaseID added in v0.5.0

func (b NullType) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (NullType) CollationCoercibility added in v0.5.0

func (b NullType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (NullType) Compare added in v0.5.0

func (b NullType) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (NullType) Convert added in v0.5.0

func (b NullType) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (NullType) DeserializeValue added in v0.5.0

func (b NullType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (NullType) Equals added in v0.5.0

func (b NullType) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (NullType) FormatSerializedValue added in v0.5.0

func (b NullType) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (NullType) FormatValue added in v0.5.0

func (b NullType) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (NullType) MaxSerializedWidth added in v0.5.0

func (b NullType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (NullType) MaxTextResponseByteLength added in v0.5.0

func (b NullType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (NullType) OID added in v0.5.0

func (b NullType) OID() uint32

OID implements the DoltgresType interface.

func (NullType) Promote added in v0.5.0

func (b NullType) Promote() sql.Type

Promote implements the DoltgresType interface.

func (NullType) SQL added in v0.5.0

func (b NullType) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (NullType) SerializeValue added in v0.5.0

func (b NullType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (NullType) SerializedCompare added in v0.5.0

func (b NullType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (NullType) String added in v0.5.0

func (b NullType) String() string

String implements the DoltgresType interface.

func (NullType) Type added in v0.5.0

func (b NullType) Type() query.Type

Type implements the DoltgresType interface.

func (NullType) ValueType added in v0.5.0

func (b NullType) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (NullType) Zero added in v0.5.0

func (b NullType) Zero() any

Zero implements the DoltgresType interface.

type NumericType added in v0.5.0

type NumericType struct{}

NumericType is the extended type implementation of the PostgreSQL numeric.

func (NumericType) BaseID added in v0.5.0

func (b NumericType) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (NumericType) CollationCoercibility added in v0.5.0

func (b NumericType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (NumericType) Compare added in v0.5.0

func (b NumericType) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (NumericType) Convert added in v0.5.0

func (b NumericType) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (NumericType) DeserializeValue added in v0.5.0

func (b NumericType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (NumericType) Equals added in v0.5.0

func (b NumericType) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (NumericType) FormatSerializedValue added in v0.5.0

func (b NumericType) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (NumericType) FormatValue added in v0.5.0

func (b NumericType) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (NumericType) MaxSerializedWidth added in v0.5.0

func (b NumericType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (NumericType) MaxTextResponseByteLength added in v0.5.0

func (b NumericType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (NumericType) OID added in v0.5.0

func (b NumericType) OID() uint32

OID implements the DoltgresType interface.

func (NumericType) Promote added in v0.5.0

func (b NumericType) Promote() sql.Type

Promote implements the DoltgresType interface.

func (NumericType) SQL added in v0.5.0

func (b NumericType) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (NumericType) SerializeValue added in v0.5.0

func (b NumericType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (NumericType) SerializedCompare added in v0.5.0

func (b NumericType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (NumericType) String added in v0.5.0

func (b NumericType) String() string

String implements the DoltgresType interface.

func (NumericType) Type added in v0.5.0

func (b NumericType) Type() query.Type

Type implements the DoltgresType interface.

func (NumericType) ValueType added in v0.5.0

func (b NumericType) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (NumericType) Zero added in v0.5.0

func (b NumericType) Zero() any

Zero implements the DoltgresType interface.

type SerializationID added in v0.5.0

type SerializationID uint16

SerializationID is an ID unique to Doltgres that can uniquely identify any type for the purposes of Serialization. These are different from OIDs, as they are unchanging and unique. If we need to add a new type that does not already have a pre-defined ID, then it must use a new number that has never been previously used.

const (
	SerializationID_Invalid               SerializationID = 0
	SerializationID_Bit                   SerializationID = 1
	SerializationID_BitArray              SerializationID = 2
	SerializationID_Bool                  SerializationID = 3
	SerializationID_BoolArray             SerializationID = 4
	SerializationID_Box                   SerializationID = 5
	SerializationID_BoxArray              SerializationID = 6
	SerializationID_Bytea                 SerializationID = 7
	SerializationID_ByteaArray            SerializationID = 8
	SerializationID_Char                  SerializationID = 9
	SerializationID_CharArray             SerializationID = 10
	SerializationID_Cidr                  SerializationID = 11
	SerializationID_CidrArray             SerializationID = 12
	SerializationID_Circle                SerializationID = 13
	SerializationID_CircleArray           SerializationID = 14
	SerializationID_Date                  SerializationID = 15
	SerializationID_DateArray             SerializationID = 16
	SerializationID_DateMultirange        SerializationID = 17
	SerializationID_DateRange             SerializationID = 18
	SerializationID_Enum                  SerializationID = 19
	SerializationID_EnumArray             SerializationID = 20
	SerializationID_Float32               SerializationID = 21
	SerializationID_Float32Array          SerializationID = 22
	SerializationID_Float64               SerializationID = 23
	SerializationID_Float64Array          SerializationID = 24
	SerializationID_Inet                  SerializationID = 25
	SerializationID_InetArray             SerializationID = 26
	SerializationID_Int16                 SerializationID = 27
	SerializationID_Int16Array            SerializationID = 28
	SerializationID_Int32                 SerializationID = 29
	SerializationID_Int32Array            SerializationID = 30
	SerializationID_Int32Multirange       SerializationID = 31
	SerializationID_Int32Range            SerializationID = 32
	SerializationID_Int64                 SerializationID = 33
	SerializationID_Int64Array            SerializationID = 34
	SerializationID_Int64Multirange       SerializationID = 35
	SerializationID_Int64Range            SerializationID = 36
	SerializationID_Interval              SerializationID = 37
	SerializationID_IntervalArray         SerializationID = 38
	SerializationID_Json                  SerializationID = 39
	SerializationID_JsonArray             SerializationID = 40
	SerializationID_JsonB                 SerializationID = 41
	SerializationID_JsonBArray            SerializationID = 42
	SerializationID_Line                  SerializationID = 43
	SerializationID_LineArray             SerializationID = 44
	SerializationID_LineSegment           SerializationID = 45
	SerializationID_LineSegmentArray      SerializationID = 46
	SerializationID_MacAddress            SerializationID = 47
	SerializationID_MacAddress8           SerializationID = 48
	SerializationID_MacAddress8Array      SerializationID = 49
	SerializationID_MacAddressArray       SerializationID = 50
	SerializationID_Money                 SerializationID = 51
	SerializationID_MoneyArray            SerializationID = 52
	SerializationID_Null                  SerializationID = 53
	SerializationID_Numeric               SerializationID = 54
	SerializationID_NumericArray          SerializationID = 55
	SerializationID_NumericMultirange     SerializationID = 56
	SerializationID_NumericRange          SerializationID = 57
	SerializationID_Path                  SerializationID = 58
	SerializationID_PathArray             SerializationID = 59
	SerializationID_Point                 SerializationID = 60
	SerializationID_PointArray            SerializationID = 61
	SerializationID_Polygon               SerializationID = 62
	SerializationID_PolygonArray          SerializationID = 63
	SerializationID_Text                  SerializationID = 64
	SerializationID_TextArray             SerializationID = 65
	SerializationID_Time                  SerializationID = 66
	SerializationID_TimeArray             SerializationID = 67
	SerializationID_TimeTZ                SerializationID = 68
	SerializationID_TimeTZArray           SerializationID = 69
	SerializationID_Timestamp             SerializationID = 70
	SerializationID_TimestampArray        SerializationID = 71
	SerializationID_TimestampMultirange   SerializationID = 72
	SerializationID_TimestampRange        SerializationID = 73
	SerializationID_TimestampTZ           SerializationID = 74
	SerializationID_TimestampTZArray      SerializationID = 75
	SerializationID_TimestampTZMultirange SerializationID = 76
	SerializationID_TimestampTZRange      SerializationID = 77
	SerializationID_TsQuery               SerializationID = 78
	SerializationID_TsQueryArray          SerializationID = 79
	SerializationID_TsVector              SerializationID = 80
	SerializationID_TsVectorArray         SerializationID = 81
	SerializationID_Uuid                  SerializationID = 82
	SerializationID_UuidArray             SerializationID = 83
	SerializationID_VarBit                SerializationID = 84
	SerializationID_VarBitArray           SerializationID = 85
	SerializationID_VarChar               SerializationID = 86
	SerializationID_VarCharArray          SerializationID = 87
	SerializationID_Xml                   SerializationID = 88
	SerializationID_XmlArray              SerializationID = 89
)

These are declared as constant numbers to signify their intent. Under no circumstances should we use iota, as that runs the risk of an accidental reordering potentially causing data loss. In addition, numbers for pre-existing IDs should never be changed.

func SerializationIDFromBytes added in v0.5.0

func SerializationIDFromBytes(b []byte) SerializationID

SerializationIDFromBytes reads a SerializationID from the given byte slice. The slice must have a length of at least 2 bytes. This function does not perform any validation, and is merely a convenience to ensure that the ID is read correctly.

func (SerializationID) ToByteArray added in v0.5.0

func (id SerializationID) ToByteArray() [2]byte

ToByteArray returns the ID as a 2-byte array.

func (SerializationID) ToByteSlice added in v0.5.0

func (id SerializationID) ToByteSlice() []byte

ToByteSlice returns the ID as a byte slice.

type UuidType

type UuidType struct{}

UuidType is the extended type implementation of the PostgreSQL UUID.

func (UuidType) BaseID added in v0.5.0

func (b UuidType) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (UuidType) CollationCoercibility

func (b UuidType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (UuidType) Compare

func (b UuidType) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (UuidType) Convert

func (b UuidType) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (UuidType) DeserializeValue

func (b UuidType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (UuidType) Equals

func (b UuidType) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (UuidType) FormatSerializedValue

func (b UuidType) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (UuidType) FormatValue

func (b UuidType) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (UuidType) MaxSerializedWidth

func (b UuidType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (UuidType) MaxTextResponseByteLength

func (b UuidType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (UuidType) OID added in v0.5.0

func (b UuidType) OID() uint32

OID implements the DoltgresType interface.

func (UuidType) Promote

func (b UuidType) Promote() sql.Type

Promote implements the DoltgresType interface.

func (UuidType) SQL

func (b UuidType) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (UuidType) SerializeValue

func (b UuidType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (UuidType) SerializedCompare

func (b UuidType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (UuidType) String

func (b UuidType) String() string

String implements the DoltgresType interface.

func (UuidType) Type

func (b UuidType) Type() query.Type

Type implements the DoltgresType interface.

func (UuidType) ValueType

func (b UuidType) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (UuidType) Zero

func (b UuidType) Zero() any

Zero implements the DoltgresType interface.

type VarCharType added in v0.5.0

type VarCharType struct {
	Length uint32
}

VarCharType is the extended type implementation of the PostgreSQL varchar.

func (VarCharType) BaseID added in v0.5.0

func (b VarCharType) BaseID() DoltgresTypeBaseID

BaseID implements the DoltgresType interface.

func (VarCharType) CollationCoercibility added in v0.5.0

func (b VarCharType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the DoltgresType interface.

func (VarCharType) Compare added in v0.5.0

func (b VarCharType) Compare(v1 any, v2 any) (int, error)

Compare implements the DoltgresType interface.

func (VarCharType) Convert added in v0.5.0

func (b VarCharType) Convert(val any) (any, sql.ConvertInRange, error)

Convert implements the DoltgresType interface.

func (VarCharType) DeserializeValue added in v0.5.0

func (b VarCharType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the DoltgresType interface.

func (VarCharType) Equals added in v0.5.0

func (b VarCharType) Equals(otherType sql.Type) bool

Equals implements the DoltgresType interface.

func (VarCharType) FormatSerializedValue added in v0.5.0

func (b VarCharType) FormatSerializedValue(val []byte) (string, error)

FormatSerializedValue implements the DoltgresType interface.

func (VarCharType) FormatValue added in v0.5.0

func (b VarCharType) FormatValue(val any) (string, error)

FormatValue implements the DoltgresType interface.

func (VarCharType) MaxSerializedWidth added in v0.5.0

func (b VarCharType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the DoltgresType interface.

func (VarCharType) MaxTextResponseByteLength added in v0.5.0

func (b VarCharType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the DoltgresType interface.

func (VarCharType) OID added in v0.5.0

func (b VarCharType) OID() uint32

OID implements the DoltgresType interface.

func (VarCharType) Promote added in v0.5.0

func (b VarCharType) Promote() sql.Type

Promote implements the DoltgresType interface.

func (VarCharType) SQL added in v0.5.0

func (b VarCharType) SQL(ctx *sql.Context, dest []byte, v any) (sqltypes.Value, error)

SQL implements the DoltgresType interface.

func (VarCharType) SerializeValue added in v0.5.0

func (b VarCharType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the DoltgresType interface.

func (VarCharType) SerializedCompare added in v0.5.0

func (b VarCharType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the DoltgresType interface.

func (VarCharType) String added in v0.5.0

func (b VarCharType) String() string

String implements the DoltgresType interface.

func (VarCharType) Type added in v0.5.0

func (b VarCharType) Type() query.Type

Type implements the DoltgresType interface.

func (VarCharType) ValueType added in v0.5.0

func (b VarCharType) ValueType() reflect.Type

ValueType implements the DoltgresType interface.

func (VarCharType) Zero added in v0.5.0

func (b VarCharType) Zero() any

Zero implements the DoltgresType interface.

Jump to

Keyboard shortcuts

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