types

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxUint32 = 4294967295  // MaxUint32 is the largest possible value of Uint32
	MinInt32  = -2147483648 // MinInt32 is the smallest possible value of Int32
)
View Source
const (
	// StringMaxLength is the maximum number of characters (not bytes) that a Char, VarChar, or BpChar may contain.
	StringMaxLength = 10485760

	// StringUnbounded is used to represent that a type does not define a limit on the strings that it accepts. Values
	// are still limited by the field size limit, but it won't be enforced by the type.
	StringUnbounded = 0
)
View Source
const InternalCharLength = 1

InternalCharLength will always be 1.

View Source
const NameLength = 63

NameLength is the constant length of Name in Postgres 15. Represents (NAMEDATALEN-1)

Variables

View Source
var (
	NumericValueMaxInt16  = decimal.NewFromInt(32767)                // NumericValueMaxInt16 is the max Int16 value for NUMERIC types
	NumericValueMaxInt32  = decimal.NewFromInt(2147483647)           // NumericValueMaxInt32 is the max Int32 value for NUMERIC types
	NumericValueMaxInt64  = decimal.NewFromInt(9223372036854775807)  // NumericValueMaxInt64 is the max Int64 value for NUMERIC types
	NumericValueMinInt16  = decimal.NewFromInt(-32768)               // NumericValueMinInt16 is the min Int16 value for NUMERIC types
	NumericValueMinInt32  = decimal.NewFromInt(MinInt32)             // NumericValueMinInt32 is the min Int32 value for NUMERIC types
	NumericValueMinInt64  = decimal.NewFromInt(-9223372036854775808) // NumericValueMinInt64 is the min Int64 value for NUMERIC types
	NumericValueMaxUint32 = decimal.NewFromInt(MaxUint32)            // NumericValueMaxUint32 is the max Uint32 value for NUMERIC types
)
View Source
var Any = &DoltgresType{
	ID:            toInternal("any"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("any_in", toInternal("cstring")),
	OutputFunc:    toFuncID("any_out", toInternal("any")),
	ReceiveFunc:   toFuncID("-"),
	SendFunc:      toFuncID("-"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Any is a type that may contain any type.

View Source
var AnyArray = &DoltgresType{
	ID:            toInternal("anyarray"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("anyarray_in", toInternal("cstring")),
	OutputFunc:    toFuncID("anyarray_out", toInternal("anyarray")),
	ReceiveFunc:   toFuncID("anyarray_recv", toInternal("internal")),
	SendFunc:      toFuncID("anyarray_send", toInternal("anyarray")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btarraycmp", toInternal("anyarray"), toInternal("anyarray")),
}

AnyArray is a pseudo-type that can represent any type that is an array type that may contain elements of any type.

View Source
var AnyElement = &DoltgresType{
	ID:            toInternal("anyelement"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("anyelement_in", toInternal("cstring")),
	OutputFunc:    toFuncID("anyelement_out", toInternal("anyelement")),
	ReceiveFunc:   toFuncID("-"),
	SendFunc:      toFuncID("-"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

AnyElement is a pseudo-type that can represent any type.

View Source
var AnyEnum = &DoltgresType{
	ID:            toInternal("anyenum"),
	TypLength:     4,
	PassedByVal:   true,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("anyenum_in", toInternal("cstring")),
	OutputFunc:    toFuncID("anyenum_out", toInternal("anyenum")),
	ReceiveFunc:   toFuncID("-"),
	SendFunc:      toFuncID("-"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

AnyEnum is a pseudo-type that can represent any type that is an enum type.

View Source
var AnyNonArray = &DoltgresType{
	ID:            toInternal("anynonarray"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("anynonarray_in", toInternal("cstring")),
	OutputFunc:    toFuncID("anynonarray_out", toInternal("anynonarray")),
	ReceiveFunc:   toFuncID("-"),
	SendFunc:      toFuncID("-"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

AnyNonArray is a pseudo-type that can represent any type that isn't an array type.

View Source
var Bool = &DoltgresType{
	ID:            toInternal("bool"),
	TypLength:     int16(1),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_BooleanTypes,
	IsPreferred:   true,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_bool"),
	InputFunc:     toFuncID("boolin", toInternal("cstring")),
	OutputFunc:    toFuncID("boolout", toInternal("bool")),
	ReceiveFunc:   toFuncID("boolrecv", toInternal("internal")),
	SendFunc:      toFuncID("boolsend", toInternal("bool")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Char,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btboolcmp", toInternal("bool"), toInternal("bool")),
	InternalName:  "boolean",
}

Bool is the bool type.

BoolArray is the array variant of Bool.

View Source
var BpChar = &DoltgresType{
	ID:            toInternal("bpchar"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_StringTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_bpchar"),
	InputFunc:     toFuncID("bpcharin", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("bpcharout", toInternal("bpchar")),
	ReceiveFunc:   toFuncID("bpcharrecv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("bpcharsend", toInternal("bpchar")),
	ModInFunc:     toFuncID("bpchartypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("bpchartypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NewCollation("pg_catalog", "default"),
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("bpcharcmp", toInternal("bpchar"), toInternal("bpchar")),
}

BpChar is a char that has an unbounded length.

BpCharArray is the array variant of BpChar.

View Source
var Bytea = &DoltgresType{
	ID:            toInternal("bytea"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_UserDefinedTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_bytea"),
	InputFunc:     toFuncID("byteain", toInternal("cstring")),
	OutputFunc:    toFuncID("byteaout", toInternal("bytea")),
	ReceiveFunc:   toFuncID("bytearecv", toInternal("internal")),
	SendFunc:      toFuncID("byteasend", toInternal("bytea")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("byteacmp", toInternal("bytea"), toInternal("bytea")),
}

Bytea is the byte string type.

ByteaArray is the array variant of Bytea.

View Source
var Cstring = &DoltgresType{
	ID:            toInternal("cstring"),
	TypLength:     int16(-2),
	PassedByVal:   false,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_cstring"),
	InputFunc:     toFuncID("cstring_in", toInternal("cstring")),
	OutputFunc:    toFuncID("cstring_out", toInternal("cstring")),
	ReceiveFunc:   toFuncID("cstring_recv", toInternal("internal")),
	SendFunc:      toFuncID("cstring_send", toInternal("cstring")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Char,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Cstring is the cstring type.

CstringArray is the cstring type.

View Source
var Date = &DoltgresType{
	ID:            toInternal("date"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_DateTimeTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_date"),
	InputFunc:     toFuncID("date_in", toInternal("cstring")),
	OutputFunc:    toFuncID("date_out", toInternal("date")),
	ReceiveFunc:   toFuncID("date_recv", toInternal("internal")),
	SendFunc:      toFuncID("date_send", toInternal("date")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("date_cmp", toInternal("date"), toInternal("date")),
}

Date is the day, month, and year.

DateArray is the day, month, and year array.

View Source
var ErrCannotDropArrayType = errors.NewKind(`cannot drop type %s because type %s requires it`)

ErrCannotDropArrayType is returned when given type to drop is array type that is required for its base type.

View Source
var ErrCannotDropSystemType = errors.NewKind(`cannot drop type %s because it is required by the database system`)

ErrCannotDropSystemType is returned when given type is system/pg_catalog type.

View Source
var ErrDomainDoesNotAllowNullValues = errors.NewKind(`domain %s does not allow null values`)

ErrDomainDoesNotAllowNullValues is returned when given value is NULL and a domain is non-nullable.

View Source
var ErrDomainValueViolatesCheckConstraint = errors.NewKind(`value for domain %s violates check constraint "%s"`)

ErrDomainValueViolatesCheckConstraint is returned when given value violates a domain check.

View Source
var ErrInvalidInputValueForEnum = errors.NewKind(`invalid input value for enum %s: "%s"`)

ErrInvalidInputValueForEnum is returned when the input value does not match given enum type's labels.

View Source
var ErrInvalidSyntaxForType = errors.NewKind(`invalid input syntax for type %s: %q`)

ErrInvalidSyntaxForType is returned when the type of value is invalid for given type.

View Source
var ErrInvalidTypMod = errors.NewKind(`invalid %s type modifier`)

ErrInvalidTypMod is returned when given value is invalid for type modifier.

View Source
var ErrLengthCannotExceed = errors.NewKind(`length for type %s cannot exceed 10485760`)

ErrLengthCannotExceed is returned when given character length exceeds the upper bound, 10485760.

View Source
var ErrLengthMustBeAtLeast1 = errors.NewKind(`length for type %s must be at least 1`)

ErrLengthMustBeAtLeast1 is returned when given character length is less than 1.

View Source
var ErrTypeAlreadyExists = errors.NewKind(`type "%s" already exists`)

ErrTypeAlreadyExists is returned when creating given type when it already exists.

View Source
var ErrTypeDoesNotExist = errors.NewKind(`type "%s" does not exist`)

ErrTypeDoesNotExist is returned when using given type that does not exist.

View Source
var ErrTypeIsOnlyAShell = errors.NewKind(`type "%s" is only a shell`)

ErrTypeIsOnlyAShell is returned when given shell type is attempted to be used.

View Source
var ErrTypmodArrayMustBe1D = errors.NewKind(`typmod array must be one-dimensional`)

ErrTypmodArrayMustBe1D is returned when type modifier value is empty array.

View Source
var ErrUnhandledType = errors.NewKind(`%s: unhandled type: %T`)

ErrUnhandledType is returned when the type of value does not match given type.

View Source
var ErrValueIsOutOfRangeForType = errors.NewKind(`value %q is out of range for type %s`)

ErrValueIsOutOfRangeForType is returned when the value is out-of-range for given type.

View Source
var Float32 = &DoltgresType{
	ID:            toInternal("float4"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_float4"),
	InputFunc:     toFuncID("float4in", toInternal("cstring")),
	OutputFunc:    toFuncID("float4out", toInternal("float4")),
	ReceiveFunc:   toFuncID("float4recv", toInternal("internal")),
	SendFunc:      toFuncID("float4send", toInternal("float4")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btfloat4cmp", toInternal("float4"), toInternal("float4")),
	InternalName:  "real",
}

Float32 is a float32.

Float32Array is the array variant of Float32.

View Source
var Float64 = &DoltgresType{
	ID:            toInternal("float8"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   true,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_float8"),
	InputFunc:     toFuncID("float8in", toInternal("cstring")),
	OutputFunc:    toFuncID("float8out", toInternal("float8")),
	ReceiveFunc:   toFuncID("float8recv", toInternal("internal")),
	SendFunc:      toFuncID("float8send", toInternal("float8")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btfloat8cmp", toInternal("float8"), toInternal("float8")),
	InternalName:  "double precision",
}

Float64 is a float64.

Float64Array is the array variant of Float64.

View Source
var IDToBuiltInDoltgresType = map[id.Type]*DoltgresType{}/* 167 elements not displayed */

IDToBuiltInDoltgresType is a map of id.Id to Doltgres' built-in type.

View Source
var Int16 = &DoltgresType{
	ID:            toInternal("int2"),
	TypLength:     int16(2),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_int2"),
	InputFunc:     toFuncID("int2in", toInternal("cstring")),
	OutputFunc:    toFuncID("int2out", toInternal("int2")),
	ReceiveFunc:   toFuncID("int2recv", toInternal("internal")),
	SendFunc:      toFuncID("int2send", toInternal("int2")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Short,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btint2cmp", toInternal("int2"), toInternal("int2")),
	InternalName:  "smallint",
}

Int16 is an int16.

Int16Array is the array variant of Int16.

View Source
var Int16Serial = &DoltgresType{
	ID:            toInternal("smallserial"),
	TypLength:     int16(2),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_int2"),
	InputFunc:     toFuncID("int2in", toInternal("cstring")),
	OutputFunc:    toFuncID("int2out", toInternal("int2")),
	ReceiveFunc:   toFuncID("int2recv"),
	SendFunc:      toFuncID("int2send"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Short,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btint2cmp", toInternal("int2"), toInternal("int2")),
	IsSerial:      true,
}

Int16Serial is an int16 serial type.

View Source
var Int32 = &DoltgresType{
	ID:            toInternal("int4"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_int4"),
	InputFunc:     toFuncID("int4in", toInternal("cstring")),
	OutputFunc:    toFuncID("int4out", toInternal("int4")),
	ReceiveFunc:   toFuncID("int4recv", toInternal("internal")),
	SendFunc:      toFuncID("int4send", toInternal("int4")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btint4cmp", toInternal("int4"), toInternal("int4")),
	InternalName:  "integer",
}

Int32 is an int32.

Int32Array is the array variant of Int32.

View Source
var Int32Serial = &DoltgresType{
	ID:            toInternal("serial"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_int4"),
	InputFunc:     toFuncID("int4in", toInternal("cstring")),
	OutputFunc:    toFuncID("int4out", toInternal("int4")),
	ReceiveFunc:   toFuncID("int4recv"),
	SendFunc:      toFuncID("int4send"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btint4cmp", toInternal("int4"), toInternal("int4")),
	IsSerial:      true,
}

Int32Serial is an int32 serial type.

View Source
var Int64 = &DoltgresType{
	ID:            toInternal("int8"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_int8"),
	InputFunc:     toFuncID("int8in", toInternal("cstring")),
	OutputFunc:    toFuncID("int8out", toInternal("int8")),
	ReceiveFunc:   toFuncID("int8recv", toInternal("internal")),
	SendFunc:      toFuncID("int8send", toInternal("int8")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btint8cmp", toInternal("int8"), toInternal("int8")),
	InternalName:  "bigint",
}

Int64 is an int64.

Int64Array is the array variant of Int64.

View Source
var Int64Serial = &DoltgresType{
	ID:            toInternal("bigserial"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_int8"),
	InputFunc:     toFuncID("int8in", toInternal("cstring")),
	OutputFunc:    toFuncID("int8out", toInternal("int8")),
	ReceiveFunc:   toFuncID("int8recv"),
	SendFunc:      toFuncID("int8send"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btint8cmp", toInternal("int8"), toInternal("int8")),
	IsSerial:      true,
}

Int64Serial is an int64 serial type.

View Source
var Internal = &DoltgresType{
	ID:            toInternal("internal"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("internal_in", toInternal("cstring")),
	OutputFunc:    toFuncID("internal_out", toInternal("internal")),
	ReceiveFunc:   toFuncID("-"),
	SendFunc:      toFuncID("-"),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Internal is an internal type, which means `external binary` type.

View Source
var InternalChar = &DoltgresType{
	ID:            toInternal("char"),
	TypLength:     int16(InternalCharLength),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_InternalUseTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_char"),
	InputFunc:     toFuncID("charin", toInternal("cstring")),
	OutputFunc:    toFuncID("charout", toInternal("char")),
	ReceiveFunc:   toFuncID("charrecv", toInternal("internal")),
	SendFunc:      toFuncID("charsend", toInternal("char")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Char,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btcharcmp", toInternal("char"), toInternal("char")),
	InternalName:  `"char"`,
}

InternalChar is a single-byte internal type. In Postgres, it's displayed as `"char"`.

InternalCharArray is the array variant of InternalChar.

View Source
var Interval = &DoltgresType{
	ID:            toInternal("interval"),
	TypLength:     int16(16),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_TimespanTypes,
	IsPreferred:   true,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_interval"),
	InputFunc:     toFuncID("interval_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("interval_out", toInternal("interval")),
	ReceiveFunc:   toFuncID("interval_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("interval_send", toInternal("interval")),
	ModInFunc:     toFuncID("intervaltypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("intervaltypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("interval_cmp", toInternal("interval"), toInternal("interval")),
}

Interval is the interval type.

IntervalArray is the array variant of Interval.

View Source
var Json = &DoltgresType{
	ID:            toInternal("json"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_UserDefinedTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_json"),
	InputFunc:     toFuncID("json_in", toInternal("cstring")),
	OutputFunc:    toFuncID("json_out", toInternal("json")),
	ReceiveFunc:   toFuncID("json_recv", toInternal("internal")),
	SendFunc:      toFuncID("json_send", toInternal("json")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Json is the standard JSON type.

JsonArray is the array variant of Json.

View Source
var JsonB = &DoltgresType{
	ID:            toInternal("jsonb"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_UserDefinedTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("jsonb_subscript_handler", toInternal("internal")),
	Elem:          id.NullType,
	Array:         toInternal("_jsonb"),
	InputFunc:     toFuncID("jsonb_in", toInternal("cstring")),
	OutputFunc:    toFuncID("jsonb_out", toInternal("jsonb")),
	ReceiveFunc:   toFuncID("jsonb_recv", toInternal("internal")),
	SendFunc:      toFuncID("jsonb_send", toInternal("jsonb")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("jsonb_cmp", toInternal("jsonb"), toInternal("jsonb")),
}

JsonB is the deserialized and structured version of JSON that deals with JsonDocument.

JsonBArray is the array variant of JsonB.

View Source
var LoadFunctionFromCatalog func(funcName string, parameterTypes []*DoltgresType) any

LoadFunctionFromCatalog returns the function matching the given name and parameter types. This is intended solely for functions that are used for types, as the returned functions are not valid using the Eval function.

View Source
var Name = &DoltgresType{
	ID:            toInternal("name"),
	TypLength:     int16(64),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_StringTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("raw_array_subscript_handler", toInternal("internal")),
	Elem:          toInternal("char"),
	Array:         toInternal("_name"),
	InputFunc:     toFuncID("namein", toInternal("cstring")),
	OutputFunc:    toFuncID("nameout", toInternal("name")),
	ReceiveFunc:   toFuncID("namerecv", toInternal("internal")),
	SendFunc:      toFuncID("namesend", toInternal("name")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Char,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NewCollation("pg_catalog", "C"),
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btnamecmp", toInternal("name"), toInternal("name")),
}

Name is a 63-byte internal type for object names.

NameArray is the array variant of Name.

View Source
var NameToInternalID = map[string]id.Type{}

NameToInternalID is a mapping from a given name to its respective Internal ID.

View Source
var Numeric = &DoltgresType{
	ID:            toInternal("numeric"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_numeric"),
	InputFunc:     toFuncID("numeric_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("numeric_out", toInternal("numeric")),
	ReceiveFunc:   toFuncID("numeric_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("numeric_send", toInternal("numeric")),
	ModInFunc:     toFuncID("numerictypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("numerictypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Main,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("numeric_cmp", toInternal("numeric"), toInternal("numeric")),
}

Numeric is a precise and unbounded decimal value.

NumericArray is the array variant of Numeric.

View Source
var Oid = &DoltgresType{
	ID:            toInternal("oid"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   true,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_oid"),
	InputFunc:     toFuncID("oidin", toInternal("cstring")),
	OutputFunc:    toFuncID("oidout", toInternal("oid")),
	ReceiveFunc:   toFuncID("oidrecv", toInternal("internal")),
	SendFunc:      toFuncID("oidsend", toInternal("oid")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btoidcmp", toInternal("oid"), toInternal("oid")),
}

Oid is a data type used for identifying internal objects. It is implemented as an unsigned 32-bit integer.

OidArray is the array variant of Oid.

View Source
var Record = &DoltgresType{
	ID:            toInternal("record"),
	TypLength:     -1,
	PassedByVal:   false,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_record"),
	InputFunc:     toFuncID("record_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("record_out", toInternal("record")),
	ReceiveFunc:   toFuncID("record_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("record_send", toInternal("record")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("btrecordcmp", toInternal("record"), toInternal("record")),
}

Record is the record type, similar to a row.

RecordArray is the array variant of Record.

View Source
var Regclass = &DoltgresType{
	ID:            toInternal("regclass"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_regclass"),
	InputFunc:     toFuncID("regclassin", toInternal("cstring")),
	OutputFunc:    toFuncID("regclassout", toInternal("regclass")),
	ReceiveFunc:   toFuncID("regclassrecv", toInternal("internal")),
	SendFunc:      toFuncID("regclasssend", toInternal("regclass")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Regclass is the OID type for finding items in pg_class.

RegclassArray is the array variant of Regclass.

View Source
var Regproc = &DoltgresType{
	ID:            toInternal("regproc"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_regproc"),
	InputFunc:     toFuncID("regprocin", toInternal("cstring")),
	OutputFunc:    toFuncID("regprocout", toInternal("regproc")),
	ReceiveFunc:   toFuncID("regprocrecv", toInternal("internal")),
	SendFunc:      toFuncID("regprocsend", toInternal("regproc")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Regproc is the OID type for finding function names.

RegprocArray is the array variant of Regproc.

View Source
var Regtype = &DoltgresType{
	ID:            toInternal("regtype"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_NumericTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_regtype"),
	InputFunc:     toFuncID("regtypein", toInternal("cstring")),
	OutputFunc:    toFuncID("regtypeout", toInternal("regtype")),
	ReceiveFunc:   toFuncID("regtyperecv", toInternal("internal")),
	SendFunc:      toFuncID("regtypesend", toInternal("regtype")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Regtype is the OID type for finding items in pg_type.

RegtypeArray is the array variant of Regtype.

View Source
var Text = &DoltgresType{
	ID:            toInternal("text"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_StringTypes,
	IsPreferred:   true,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_text"),
	InputFunc:     toFuncID("textin", toInternal("cstring")),
	OutputFunc:    toFuncID("textout", toInternal("text")),
	ReceiveFunc:   toFuncID("textrecv", toInternal("internal")),
	SendFunc:      toFuncID("textsend", toInternal("text")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NewCollation("pg_catalog", "default"),
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("bttextcmp", toInternal("text"), toInternal("text")),
}

Text is the text type.

TextArray is the array variant of Text.

View Source
var Time = &DoltgresType{
	ID:            toInternal("time"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_DateTimeTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_time"),
	InputFunc:     toFuncID("time_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("time_out", toInternal("time")),
	ReceiveFunc:   toFuncID("time_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("time_send", toInternal("time")),
	ModInFunc:     toFuncID("timetypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("timetypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("time_cmp", toInternal("time"), toInternal("time")),
}

Time is the time without a time zone. Precision is unbounded.

TimeArray is the array variant of Time.

View Source
var TimeTZ = &DoltgresType{
	ID:            toInternal("timetz"),
	TypLength:     int16(12),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_DateTimeTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_timetz"),
	InputFunc:     toFuncID("timetz_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("timetz_out", toInternal("timetz")),
	ReceiveFunc:   toFuncID("timetz_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("timetz_send", toInternal("timetz")),
	ModInFunc:     toFuncID("timetztypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("timetztypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("timetz_cmp", toInternal("timetz"), toInternal("timetz")),
}

TimeTZ is the time with a time zone. Precision is unbounded.

TimeTZArray is the array variant of TimeTZ.

View Source
var Timestamp = &DoltgresType{
	ID:            toInternal("timestamp"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_DateTimeTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_timestamp"),
	InputFunc:     toFuncID("timestamp_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("timestamp_out", toInternal("timestamp")),
	ReceiveFunc:   toFuncID("timestamp_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("timestamp_send", toInternal("timestamp")),
	ModInFunc:     toFuncID("timestamptypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("timestamptypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("timestamp_cmp", toInternal("timestamp"), toInternal("timestamp")),
}

Timestamp is the timestamp without a time zone. Precision is unbounded.

TimestampArray is the array variant of Timestamp.

View Source
var TimestampTZ = &DoltgresType{
	ID:            toInternal("timestamptz"),
	TypLength:     int16(8),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_DateTimeTypes,
	IsPreferred:   true,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_timestamptz"),
	InputFunc:     toFuncID("timestamptz_in", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("timestamptz_out", toInternal("timestamptz")),
	ReceiveFunc:   toFuncID("timestamptz_recv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("timestamptz_send", toInternal("timestamptz")),
	ModInFunc:     toFuncID("timestamptztypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("timestamptztypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Double,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("timestamptz_cmp", toInternal("timestamptz"), toInternal("timestamptz")),
}

TimestampTZ is the timestamp with a time zone. Precision is unbounded.

TimestampTZArray is the array variant of TimestampTZ.

View Source
var Unknown = &DoltgresType{
	ID:            toInternal("unknown"),
	TypLength:     int16(-2),
	PassedByVal:   false,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_UnknownTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("unknownin", toInternal("cstring")),
	OutputFunc:    toFuncID("unknownout", toInternal("unknown")),
	ReceiveFunc:   toFuncID("unknownrecv", toInternal("internal")),
	SendFunc:      toFuncID("unknownsend", toInternal("unknown")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Char,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Unknown represents an invalid or indeterminate type. This is primarily used internally.

View Source
var Uuid = &DoltgresType{
	ID:            toInternal("uuid"),
	TypLength:     int16(16),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_UserDefinedTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_uuid"),
	InputFunc:     toFuncID("uuid_in", toInternal("cstring")),
	OutputFunc:    toFuncID("uuid_out", toInternal("uuid")),
	ReceiveFunc:   toFuncID("uuid_recv", toInternal("internal")),
	SendFunc:      toFuncID("uuid_send", toInternal("uuid")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Char,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("uuid_cmp", toInternal("uuid"), toInternal("uuid")),
}

Uuid is the UUID type.

UuidArray is the array variant of Uuid.

View Source
var VarChar = &DoltgresType{
	ID:            toInternal("varchar"),
	TypLength:     int16(-1),
	PassedByVal:   false,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_StringTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_varchar"),
	InputFunc:     toFuncID("varcharin", toInternal("cstring"), toInternal("oid"), toInternal("int4")),
	OutputFunc:    toFuncID("varcharout", toInternal("varchar")),
	ReceiveFunc:   toFuncID("varcharrecv", toInternal("internal"), toInternal("oid"), toInternal("int4")),
	SendFunc:      toFuncID("varcharsend", toInternal("varchar")),
	ModInFunc:     toFuncID("varchartypmodin", toInternal("_cstring")),
	ModOutFunc:    toFuncID("varchartypmodout", toInternal("int4")),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Extended,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NewCollation("pg_catalog", "default"),
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("bttextcmp", toInternal("text"), toInternal("text")),
}

VarChar is a varchar that has an unbounded length.

VarCharArray is the array variant of VarChar.

View Source
var Void = &DoltgresType{
	ID:            toInternal("void"),
	TypLength:     4,
	PassedByVal:   true,
	TypType:       TypeType_Pseudo,
	TypCategory:   TypeCategory_PseudoTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         id.NullType,
	InputFunc:     toFuncID("void_in", toInternal("cstring"), toInternal("oid")),
	OutputFunc:    toFuncID("void_out", toInternal("void")),
	ReceiveFunc:   toFuncID("void_recv", toInternal("internal"), toInternal("oid")),
	SendFunc:      toFuncID("void_send", toInternal("void")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Void is the void type.

View Source
var Xid = &DoltgresType{
	ID:            toInternal("xid"),
	TypLength:     int16(4),
	PassedByVal:   true,
	TypType:       TypeType_Base,
	TypCategory:   TypeCategory_UserDefinedTypes,
	IsPreferred:   false,
	IsDefined:     true,
	Delimiter:     ",",
	RelID:         id.Null,
	SubscriptFunc: toFuncID("-"),
	Elem:          id.NullType,
	Array:         toInternal("_xid"),
	InputFunc:     toFuncID("xidin", toInternal("cstring")),
	OutputFunc:    toFuncID("xidout", toInternal("xid")),
	ReceiveFunc:   toFuncID("xidrecv", toInternal("internal")),
	SendFunc:      toFuncID("xidsend", toInternal("xid")),
	ModInFunc:     toFuncID("-"),
	ModOutFunc:    toFuncID("-"),
	AnalyzeFunc:   toFuncID("-"),
	Align:         TypeAlignment_Int,
	Storage:       TypeStorage_Plain,
	NotNull:       false,
	BaseTypeID:    id.NullType,
	TypMod:        -1,
	NDims:         0,
	TypCollation:  id.NullCollation,
	DefaulBin:     "",
	Default:       "",
	Acl:           nil,
	Checks:        nil,
	attTypMod:     -1,
	CompareFunc:   toFuncID("-"),
}

Xid is a data type used for internal transaction IDs. It is implemented as an unsigned 32 bit integer.

XidArray is the array variant of Xid.

Functions

func ArrToString added in v0.16.0

func ArrToString(ctx *sql.Context, arr []any, baseType *DoltgresType, trimBool bool) (string, error)

ArrToString is used for array_out function. |trimBool| parameter allows replacing boolean result of "true" to "t" if the function is `Type.SQL()`.

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 GetCharLengthFromTypmod added in v0.16.0

func GetCharLengthFromTypmod(typmod int32) int32

GetCharLengthFromTypmod takes character type modifier and returns length value.

func GetNumericValueWithTypmod added in v0.16.0

func GetNumericValueWithTypmod(val decimal.Decimal, typmod int32) (decimal.Decimal, error)

GetNumericValueWithTypmod returns either given numeric value or truncated or error depending on the precision and scale decoded from given type modifier value.

func GetPrecisionAndScaleFromTypmod added in v0.16.0

func GetPrecisionAndScaleFromTypmod(typmod int32) (int32, int32)

GetPrecisionAndScaleFromTypmod takes Numeric type modifier and returns precision and scale values.

func GetTimePrecisionFromTypMod added in v0.16.0

func GetTimePrecisionFromTypMod(typmod int32) int32

GetTimePrecisionFromTypMod takes Time type modifier and returns precision value.

func GetTypModFromCharLength added in v0.16.0

func GetTypModFromCharLength(typName string, l int32) (int32, error)

GetTypModFromCharLength takes character type and its length and returns the type modifier value.

func GetTypmodFromNumericPrecisionAndScale added in v0.16.0

func GetTypmodFromNumericPrecisionAndScale(precision, scale int32) (int32, error)

GetTypmodFromNumericPrecisionAndScale takes Numeric type precision and scale and returns the type modifier value.

func GetTypmodFromTimePrecision added in v0.16.0

func GetTypmodFromTimePrecision(precision int32) (int32, error)

GetTypmodFromTimePrecision takes Time type precision and returns the type modifier value.

func JsonValueCompare added in v0.16.0

func JsonValueCompare(v1 JsonValue, v2 JsonValue) int

JsonValueCompare compares two values.

func JsonValueFormatter added in v0.16.0

func JsonValueFormatter(sb *strings.Builder, value JsonValue)

JsonValueFormatter is the recursive formatter for JSON values.

func JsonValueSerialize added in v0.16.0

func JsonValueSerialize(writer *utils.Writer, value JsonValue)

JsonValueSerialize is the recursive serializer for JSON values.

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 CompositeAttribute added in v0.16.0

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

CompositeAttribute represents a composite type attribute. This is a partial pg_attribute row entry.

func NewCompositeAttribute added in v0.16.0

func NewCompositeAttribute(ctx *sql.Context, relID id.Id, name string, typeID id.Type, num int16, collation string) CompositeAttribute

NewCompositeAttribute creates new instance of composite type attribute.

type DoltgresType added in v0.5.0

type DoltgresType struct {
	ID            id.Type
	TypLength     int16
	PassedByVal   bool
	TypType       TypeType
	TypCategory   TypeCategory
	IsPreferred   bool
	IsDefined     bool
	Delimiter     string
	RelID         id.Id // for Composite types
	SubscriptFunc uint32
	Elem          id.Type
	Array         id.Type
	InputFunc     uint32
	OutputFunc    uint32
	ReceiveFunc   uint32
	SendFunc      uint32
	ModInFunc     uint32
	ModOutFunc    uint32
	AnalyzeFunc   uint32
	Align         TypeAlignment
	Storage       TypeStorage
	NotNull       bool    // for Domain types
	BaseTypeID    id.Type // for Domain types
	TypMod        int32   // for Domain types
	NDims         int32   // for Domain types
	TypCollation  id.Collation
	DefaulBin     string // for Domain types
	Default       string
	Acl           []string // TODO: list of privileges

	// Below are not part of pg_type fields
	Checks []*sql.CheckDefinition // TODO: should be in `pg_constraint` for Domain types

	CompareFunc    uint32               // TODO: should be in `pg_amproc`
	InternalName   string               // Name() and InternalName differ for some types. e.g.: "int2" vs "smallint"
	EnumLabels     map[string]EnumLabel // TODO: should be in `pg_enum`
	CompositeAttrs []CompositeAttribute // TODO: should be in `pg_attribute`

	// Below are not stored
	IsSerial            bool    // used for serial types only (e.g.: smallserial)
	IsUnresolved        bool    // used internally to know if a type has been resolved
	BaseTypeForInternal id.Type // used for INTERNAL type only
	// contains filtered or unexported fields
}

DoltgresType represents a single type.

func CreateArrayTypeFromBaseType added in v0.16.0

func CreateArrayTypeFromBaseType(baseType *DoltgresType) *DoltgresType

CreateArrayTypeFromBaseType create array type from given type.

func FromGmsType added in v0.11.0

func FromGmsType(typ sql.Type) *DoltgresType

FromGmsType returns a DoltgresType that is most similar to the given GMS type. It returns UNKNOWN type for GMS types that are not handled.

func FromGmsTypeToDoltgresType added in v0.16.0

func FromGmsTypeToDoltgresType(typ sql.Type) (*DoltgresType, error)

FromGmsTypeToDoltgresType returns a DoltgresType that is most similar to the given GMS type. It errors if GMS type is not handled.

func GetAllBuitInTypes added in v0.16.0

func GetAllBuitInTypes() []*DoltgresType

GetAllBuitInTypes returns a slice containing all registered types. The slice is sorted by each type's ID.

func GetTypeByID added in v0.16.0

func GetTypeByID(internalID id.Type) *DoltgresType

GetTypeByID returns the DoltgresType matching the given Internal ID. If the Internal ID does not match a type, then nil is returned.

func MustCreateNewVarCharType added in v0.16.0

func MustCreateNewVarCharType(maxChars int32) *DoltgresType

MustCreateNewVarCharType panics if used with out-of-bound value.

func NewCharType added in v0.16.0

func NewCharType(length int32) (*DoltgresType, error)

NewCharType returns BpChar type with typmod set.

func NewCompositeType added in v0.16.0

func NewCompositeType(ctx *sql.Context, relID id.Id, arrayID, typeID id.Type, attrs []CompositeAttribute) *DoltgresType

NewCompositeType creates new instance of composite DoltgresType.

func NewDomainType added in v0.14.0

func NewDomainType(
	ctx *sql.Context,
	asType *DoltgresType,
	defaultExpr string,
	notNull bool,
	checks []*sql.CheckDefinition,
	arrayID, internalID id.Type,
) *DoltgresType

NewDomainType creates new instance of domain DoltgresType.

func NewEnumType added in v0.16.0

func NewEnumType(ctx *sql.Context, arrayID, typeID id.Type, labels map[string]EnumLabel) *DoltgresType

NewEnumType creates new instance of enum DoltgresType.

func NewInternalTypeWithBaseType added in v0.16.0

func NewInternalTypeWithBaseType(internalID id.Type) *DoltgresType

NewInternalTypeWithBaseType returns Internal type with internal base type set with given type.

func NewNumericTypeWithPrecisionAndScale added in v0.16.0

func NewNumericTypeWithPrecisionAndScale(precision, scale int32) (*DoltgresType, error)

NewNumericTypeWithPrecisionAndScale returns Numeric type with typmod set.

func NewShellType added in v0.16.0

func NewShellType(ctx *sql.Context, internalID id.Type) *DoltgresType

NewShellType creates new instance of shell DoltgresType.

func NewTimeTZType added in v0.16.0

func NewTimeTZType(precision int32) (*DoltgresType, error)

NewTimeTZType returns TimeTZ type with typmod set. // TODO: implement precision

func NewTimeType added in v0.16.0

func NewTimeType(precision int32) (*DoltgresType, error)

NewTimeType returns Time type with typmod set. // TODO: implement precision

func NewTimestampTZType added in v0.16.0

func NewTimestampTZType(precision int32) (*DoltgresType, error)

NewTimestampTZType returns TimestampTZ type with typmod set. // TODO: implement precision

func NewTimestampType added in v0.16.0

func NewTimestampType(precision int32) (*DoltgresType, error)

NewTimestampType returns Timestamp type with typmod set. // TODO: implement precision

func NewUnresolvedDoltgresType added in v0.16.0

func NewUnresolvedDoltgresType(sch, name string) *DoltgresType

NewUnresolvedDoltgresType returns DoltgresType that is not resolved. The type will have the schema and name defined with given values, with IsUnresolved == true.

func NewVarCharType added in v0.16.0

func NewVarCharType(maxChars int32) (*DoltgresType, error)

NewVarCharType returns VarChar type with type modifier set representing the maximum number of characters that the type may hold.

func (*DoltgresType) AnalyzeFuncName added in v0.16.0

func (t *DoltgresType) AnalyzeFuncName() string

AnalyzeFuncName returns the name that would be displayed in pg_type for the `typanalyze` field.

func (*DoltgresType) ArrayBaseType added in v0.16.0

func (t *DoltgresType) ArrayBaseType() *DoltgresType

ArrayBaseType returns a base type of given array type. If this type is not an array type, it returns itself.

func (*DoltgresType) CharacterSet added in v0.16.0

func (t *DoltgresType) CharacterSet() sql.CharacterSetID

CharacterSet implements the sql.StringType interface.

func (*DoltgresType) Collation added in v0.16.0

func (t *DoltgresType) Collation() sql.CollationID

Collation implements the sql.StringType interface.

func (*DoltgresType) CollationCoercibility added in v0.16.0

func (t *DoltgresType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the types.ExtendedType interface.

func (*DoltgresType) Compare added in v0.16.0

func (t *DoltgresType) Compare(v1 interface{}, v2 interface{}) (int, error)

Compare implements the types.ExtendedType interface.

func (*DoltgresType) Convert added in v0.16.0

func (t *DoltgresType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)

Convert implements the types.ExtendedType interface.

func (*DoltgresType) DeserializeValue added in v0.16.0

func (t *DoltgresType) DeserializeValue(val []byte) (any, error)

DeserializeValue implements the types.ExtendedType interface.

func (*DoltgresType) DomainUnderlyingBaseType added in v0.16.0

func (t *DoltgresType) DomainUnderlyingBaseType() *DoltgresType

DomainUnderlyingBaseType returns an underlying base type of this domain type. It can be a nested domain type, so it recursively searches for a valid base type.

func (*DoltgresType) Equals added in v0.16.0

func (t *DoltgresType) Equals(otherType sql.Type) bool

Equals implements the types.ExtendedType interface.

func (*DoltgresType) FormatValue added in v0.16.0

func (t *DoltgresType) FormatValue(val any) (string, error)

FormatValue implements the types.ExtendedType interface.

func (*DoltgresType) GetAttTypMod added in v0.16.0

func (t *DoltgresType) GetAttTypMod() int32

GetAttTypMod returns the attTypMod field of the type.

func (*DoltgresType) InputFuncName added in v0.16.0

func (t *DoltgresType) InputFuncName() string

InputFuncName returns the name that would be displayed in pg_type for the `typinput` field.

func (*DoltgresType) IoInput added in v0.8.0

func (t *DoltgresType) IoInput(ctx *sql.Context, input string) (any, error)

IoInput converts input string value to given type value.

func (*DoltgresType) IoOutput added in v0.8.0

func (t *DoltgresType) IoOutput(ctx *sql.Context, val any) (string, error)

IoOutput converts given type value to output string.

func (*DoltgresType) IsArrayType added in v0.16.0

func (t *DoltgresType) IsArrayType() bool

IsArrayType returns true if the type is of 'array' category

func (*DoltgresType) IsEmptyType added in v0.16.0

func (t *DoltgresType) IsEmptyType() bool

IsEmptyType returns true if the type is not valid.

func (*DoltgresType) IsPolymorphicType added in v0.16.0

func (t *DoltgresType) IsPolymorphicType() bool

IsPolymorphicType types are special built-in pseudo-types that are used during function resolution to allow a function to handle multiple types from a single definition. All polymorphic types have "any" as a prefix. The exception is the "any" type, which is not a polymorphic type.

func (*DoltgresType) IsResolvedType added in v0.16.0

func (t *DoltgresType) IsResolvedType() bool

IsResolvedType whether the type is resolved and has complete information. This is used to resolve types during analyzing when non-built-in type is used.

func (*DoltgresType) IsValidForPolymorphicType added in v0.16.0

func (t *DoltgresType) IsValidForPolymorphicType(target *DoltgresType) bool

IsValidForPolymorphicType returns whether the given type is valid for the calling polymorphic type.

func (*DoltgresType) Length added in v0.16.0

func (t *DoltgresType) Length() int64

Length implements the sql.StringType interface.

func (*DoltgresType) MaxByteLength added in v0.16.0

func (t *DoltgresType) MaxByteLength() int64

MaxByteLength implements the sql.StringType interface.

func (*DoltgresType) MaxCharacterLength added in v0.16.0

func (t *DoltgresType) MaxCharacterLength() int64

MaxCharacterLength implements the sql.StringType interface.

func (*DoltgresType) MaxSerializedWidth added in v0.16.0

func (t *DoltgresType) MaxSerializedWidth() types.ExtendedTypeSerializedWidth

MaxSerializedWidth implements the types.ExtendedType interface.

func (*DoltgresType) MaxTextResponseByteLength added in v0.16.0

func (t *DoltgresType) MaxTextResponseByteLength(ctx *sql.Context) uint32

MaxTextResponseByteLength implements the types.ExtendedType interface.

func (*DoltgresType) ModInFuncName added in v0.16.0

func (t *DoltgresType) ModInFuncName() string

ModInFuncName returns the name that would be displayed in pg_type for the `typmodin` field.

func (*DoltgresType) ModOutFuncName added in v0.16.0

func (t *DoltgresType) ModOutFuncName() string

ModOutFuncName returns the name that would be displayed in pg_type for the `typmodout` field.

func (*DoltgresType) Name added in v0.16.0

func (t *DoltgresType) Name() string

Name returns the name of the type.

func (*DoltgresType) OutputFuncName added in v0.16.0

func (t *DoltgresType) OutputFuncName() string

OutputFuncName returns the name that would be displayed in pg_type for the `typoutput` field.

func (*DoltgresType) Promote added in v0.16.0

func (t *DoltgresType) Promote() sql.Type

Promote implements the types.ExtendedType interface.

func (*DoltgresType) ReceiveFuncName added in v0.16.0

func (t *DoltgresType) ReceiveFuncName() string

ReceiveFuncName returns the name that would be displayed in pg_type for the `typreceive` field.

func (*DoltgresType) SQL added in v0.16.0

func (t *DoltgresType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)

SQL implements the types.ExtendedType interface.

func (*DoltgresType) Schema added in v0.16.0

func (t *DoltgresType) Schema() string

Schema returns the schema that the type is contained in.

func (*DoltgresType) SendFuncName added in v0.16.0

func (t *DoltgresType) SendFuncName() string

SendFuncName returns the name that would be displayed in pg_type for the `typsend` field.

func (*DoltgresType) Serialize added in v0.16.0

func (t *DoltgresType) Serialize() []byte

Serialize returns the DoltgresType as a byte slice.

func (*DoltgresType) SerializeValue added in v0.16.0

func (t *DoltgresType) SerializeValue(val any) ([]byte, error)

SerializeValue implements the types.ExtendedType interface.

func (*DoltgresType) SerializedCompare added in v0.16.0

func (t *DoltgresType) SerializedCompare(v1 []byte, v2 []byte) (int, error)

SerializedCompare implements the types.ExtendedType interface.

func (*DoltgresType) String added in v0.16.0

func (t *DoltgresType) String() string

String implements the types.ExtendedType interface.

func (*DoltgresType) SubscriptFuncName added in v0.16.0

func (t *DoltgresType) SubscriptFuncName() string

SubscriptFuncName returns the name that would be displayed in pg_type for the `typsubscript` field.

func (*DoltgresType) ToArrayType added in v0.6.0

func (t *DoltgresType) ToArrayType() *DoltgresType

ToArrayType returns an array type of given base type. For array types, ToArrayType causes them to return themselves.

func (*DoltgresType) TypModIn added in v0.16.0

func (t *DoltgresType) TypModIn(ctx *sql.Context, val []any) (int32, error)

TypModIn encodes given text array value to type modifier in int32 format.

func (*DoltgresType) TypModOut added in v0.16.0

func (t *DoltgresType) TypModOut(ctx *sql.Context, val int32) (string, error)

TypModOut decodes type modifier in int32 format to string representation of it.

func (*DoltgresType) Type added in v0.16.0

func (t *DoltgresType) Type() query.Type

Type implements the types.ExtendedType interface.

func (*DoltgresType) ValueType added in v0.16.0

func (t *DoltgresType) ValueType() reflect.Type

ValueType implements the types.ExtendedType interface.

func (*DoltgresType) WithAttTypMod added in v0.16.0

func (t *DoltgresType) WithAttTypMod(tm int32) *DoltgresType

WithAttTypMod returns a copy of the type with attTypMod defined with given value. This function should be used to set attTypMod only, as it creates a copy of the type to avoid updating the original type.

func (*DoltgresType) Zero added in v0.16.0

func (t *DoltgresType) Zero() interface{}

Zero implements the types.ExtendedType interface.

type EnumLabel added in v0.16.0

type EnumLabel struct {
	ID        id.EnumLabel
	SortOrder float32
}

EnumLabel represents an enum type label. This is a pg_enum row entry.

func NewEnumLabel added in v0.16.0

func NewEnumLabel(ctx *sql.Context, labelID id.EnumLabel, so float32) EnumLabel

NewEnumLabel creates new instance of enum type label.

type JsonDocument added in v0.8.0

type JsonDocument struct {
	Value JsonValue
}

JsonDocument represents an entire JSON document.

func UnmarshalToJsonDocument added in v0.16.0

func UnmarshalToJsonDocument(val []byte) (JsonDocument, error)

UnmarshalToJsonDocument converts a JSON document byte slice into the actual JSON document.

type JsonValue added in v0.8.0

type JsonValue interface {
	// contains filtered or unexported methods
}

JsonValue is a value that represents some kind of data in JSON.

func ConvertToJsonDocument added in v0.16.0

func ConvertToJsonDocument(val interface{}) (JsonValue, error)

ConvertToJsonDocument recursively constructs a valid JsonDocument based on the structures returned by the decoder.

func JsonValueCopy added in v0.8.0

func JsonValueCopy(value JsonValue) JsonValue

JsonValueCopy returns a new copy of the given JsonValue that may be freely modified.

func JsonValueDeserialize added in v0.16.0

func JsonValueDeserialize(reader *utils.Reader) (_ JsonValue, err error)

JsonValueDeserialize is the recursive deserializer for JSON values.

type JsonValueArray added in v0.8.0

type JsonValueArray []JsonValue

JsonValueArray represents a JSON array.

type JsonValueBoolean added in v0.8.0

type JsonValueBoolean bool

JsonValueBoolean represents a boolean value.

type JsonValueNull added in v0.8.0

type JsonValueNull byte

JsonValueNull represents a null value.

type JsonValueNumber added in v0.8.0

type JsonValueNumber decimal.Decimal

JsonValueNumber represents a number.

type JsonValueObject added in v0.8.0

type JsonValueObject struct {
	Items []JsonValueObjectItem
	Index map[string]int
}

JsonValueObject represents a JSON object.

type JsonValueObjectItem added in v0.8.0

type JsonValueObjectItem struct {
	Key   string
	Value JsonValue
}

JsonValueObjectItem represents a specific item inside a JsonObject.

type JsonValueString added in v0.8.0

type JsonValueString string

JsonValueString represents a string value.

type JsonValueType added in v0.8.0

type JsonValueType byte

JsonValueType represents a JSON value type. These values are serialized, and therefore should never be modified.

const (
	JsonValueType_Object  JsonValueType = 0
	JsonValueType_Array   JsonValueType = 1
	JsonValueType_String  JsonValueType = 2
	JsonValueType_Number  JsonValueType = 3
	JsonValueType_Boolean JsonValueType = 4
	JsonValueType_Null    JsonValueType = 5
)

type QuickFunction added in v0.16.0

type QuickFunction interface {
	CallVariadic(ctx *sql.Context, args ...any) (interface{}, error)
	ResolvedTypes() []*DoltgresType
	WithResolvedTypes(newTypes []*DoltgresType) any
}

QuickFunction is an interface redefinition of the one defined in the `server/functions/framework` package to avoid cycles.

type TypeAlignment added in v0.10.0

type TypeAlignment string

TypeAlignment represents the alignment required when storing a value of this type.

const (
	TypeAlignment_Char   TypeAlignment = "c"
	TypeAlignment_Short  TypeAlignment = "s"
	TypeAlignment_Int    TypeAlignment = "i"
	TypeAlignment_Double TypeAlignment = "d"
)

type TypeCategory added in v0.8.0

type TypeCategory string

TypeCategory represents the type category that a type belongs to. These are used by Postgres to group similar types for parameter resolution, operator resolution, etc.

const (
	TypeCategory_ArrayTypes          TypeCategory = "A"
	TypeCategory_BooleanTypes        TypeCategory = "B"
	TypeCategory_CompositeTypes      TypeCategory = "C"
	TypeCategory_DateTimeTypes       TypeCategory = "D"
	TypeCategory_EnumTypes           TypeCategory = "E"
	TypeCategory_GeometricTypes      TypeCategory = "G"
	TypeCategory_NetworkAddressTypes TypeCategory = "I"
	TypeCategory_NumericTypes        TypeCategory = "N"
	TypeCategory_PseudoTypes         TypeCategory = "P"
	TypeCategory_RangeTypes          TypeCategory = "R"
	TypeCategory_StringTypes         TypeCategory = "S"
	TypeCategory_TimespanTypes       TypeCategory = "T"
	TypeCategory_UserDefinedTypes    TypeCategory = "U"
	TypeCategory_BitStringTypes      TypeCategory = "V"
	TypeCategory_UnknownTypes        TypeCategory = "X"
	TypeCategory_InternalUseTypes    TypeCategory = "Z"
)

type TypeStorage added in v0.14.0

type TypeStorage string

TypeStorage represents the storage strategy for storing `varlena` (typlen = -1) types.

const (
	TypeStorage_Plain    TypeStorage = "p"
	TypeStorage_External TypeStorage = "e"
	TypeStorage_Main     TypeStorage = "m"
	TypeStorage_Extended TypeStorage = "x"
)

type TypeType added in v0.14.0

type TypeType string

TypeType represents the type of types that can be created/used. This includes 'base', 'composite', 'domain', 'enum', 'shell', 'range' and 'multirange'.

const (
	TypeType_Base       TypeType = "b"
	TypeType_Composite  TypeType = "c"
	TypeType_Domain     TypeType = "d"
	TypeType_Enum       TypeType = "e"
	TypeType_Pseudo     TypeType = "p"
	TypeType_Range      TypeType = "r"
	TypeType_MultiRange TypeType = "m"
)

Jump to

Keyboard shortcuts

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