Documentation
¶
Index ¶
- Constants
- Variables
- func AllocateGeoTypeBuffer(numPoints, numCounts, numWKBHeaders int) []byte
- func AppendAndSliceBytes(buffer, addition []byte) (slice []byte)
- func AppendAndSliceString(buffer []byte, addition string) (slice []byte)
- func ApproximateTypeFromValue(val interface{}) sql.Type
- func CoalesceInt(val interface{}) (int, bool)
- func ColumnTypeToType(ct *sqlparser.ColumnType) (sql.Type, error)
- func CompareJSON(a, b interface{}) (int, error)
- func CompareNulls(a interface{}, b interface{}) (bool, int)
- func ConcatenateJSONValues(ctx *sql.Context, vals ...sql.JSONWrapper) (sql.JSONWrapper, error)
- func ContainsJSON(a, b interface{}) (bool, error)
- func ConvertToBytes(v interface{}, t sql.StringType, dest []byte) ([]byte, error)
- func ConvertToCollatedString(val interface{}, typ sql.Type) (string, sql.CollationID, error)
- func ConvertToString(v interface{}, t sql.StringType, dest []byte) (string, error)
- func ConvertToTime(v interface{}, t datetimeType) (time.Time, error)
- func CreateBinary(baseType query.Type, lengthHint int64) (sql.StringType, error)
- func CreateColumnDecimalType(precision uint8, scale uint8) (sql.DecimalType, error)
- func CreateDatetimeType(baseType query.Type, precision int) (sql.DatetimeType, error)
- func CreateDecimalType(precision uint8, scale uint8) (sql.DecimalType, error)
- func CreateEnumType(values []string, collation sql.CollationID) (sql.EnumType, error)
- func CreateLongText(collation sql.CollationID) sql.StringType
- func CreateMediumText(collation sql.CollationID) sql.StringType
- func CreateNumberType(baseType query.Type) (sql.NumberType, error)
- func CreateNumberTypeWithDisplayWidth(baseType query.Type, displayWidth int) (sql.NumberType, error)
- func CreateSetType(values []string, collation sql.CollationID) (sql.SetType, error)
- func CreateString(baseType query.Type, length int64, collation sql.CollationID) (sql.StringType, error)
- func CreateStringWithDefaults(baseType query.Type, length int64) (sql.StringType, error)
- func CreateText(collation sql.CollationID) sql.StringType
- func CreateTinyText(collation sql.CollationID) sql.StringType
- func CreateTuple(types ...sql.Type) sql.Type
- func DeepCopyJson(v interface{}) interface{}
- func DeserializeEWKBHeader(buf []byte) (srid uint32, bigEndian bool, typ uint32, err error)
- func DeserializeWKBHeader(buf []byte) (bigEndian bool, typ uint32, err error)
- func ErrIfMismatchedColumns(t1, t2 sql.Type) error
- func ErrIfMismatchedColumnsInTuple(t1, t2 sql.Type) error
- func IsBinary(sqlType query.Type) bool
- func IsBinaryType(t sql.Type) bool
- func IsBit(t sql.Type) bool
- func IsBlobType(t sql.Type) bool
- func IsDateType(t sql.Type) bool
- func IsDatetimeType(t sql.Type) bool
- func IsDecimal(t sql.Type) bool
- func IsDeferredType(t sql.Type) bool
- func IsEnum(t sql.Type) bool
- func IsExtendedType(typ sql.Type) bool
- func IsFloat(t sql.Type) bool
- func IsGeometry(t sql.Type) bool
- func IsInteger(t sql.Type) bool
- func IsJSON(t sql.Type) bool
- func IsNull(ex sql.Expression) bool
- func IsNumber(t sql.Type) bool
- func IsOkResult(row sql.Row) bool
- func IsOkResultSchema(schema sql.Schema) bool
- func IsSet(t sql.Type) bool
- func IsSigned(t sql.Type) bool
- func IsText(t sql.Type) bool
- func IsTextBlob(t sql.Type) bool
- func IsTextOnly(t sql.Type) bool
- func IsTime(t sql.Type) bool
- func IsTimespan(t sql.Type) bool
- func IsTimestampType(t sql.Type) bool
- func IsTuple(t sql.Type) bool
- func IsUnsigned(t sql.Type) bool
- func IsYear(t sql.Type) bool
- func LookupJSONValue(j sql.JSONWrapper, path string) (sql.JSONWrapper, error)
- func MarshallJson(jsonWrapper sql.JSONWrapper) ([]byte, error)
- func MarshallJsonValue(value interface{}) ([]byte, error)
- func MustCreateBinary(baseType query.Type, lengthHint int64) sql.StringType
- func MustCreateColumnDecimalType(precision uint8, scale uint8) sql.DecimalType
- func MustCreateDatetimeType(baseType query.Type, precision int) sql.DatetimeType
- func MustCreateDecimalType(precision uint8, scale uint8) sql.DecimalType
- func MustCreateEnumType(values []string, collation sql.CollationID) sql.EnumType
- func MustCreateNumberType(baseType query.Type) sql.NumberType
- func MustCreateNumberTypeWithDisplayWidth(baseType query.Type, displayWidth int) sql.NumberType
- func MustCreateSetType(values []string, collation sql.CollationID) sql.SetType
- func MustCreateString(baseType query.Type, length int64, collation sql.CollationID) sql.StringType
- func MustCreateStringWithDefaults(baseType query.Type, length int64) sql.StringType
- func NewDeferredType(name string) sql.Type
- func NewLazyJSONDocument(bytes []byte) sql.JSONWrapper
- func NewSystemBoolType(varName string) sql.SystemVariableType
- func NewSystemDoubleType(varName string, lowerbound, upperbound float64) sql.SystemVariableType
- func NewSystemEnumType(varName string, values ...string) sql.SystemVariableType
- func NewSystemIntType(varName string, lowerbound, upperbound int64, negativeOne bool) sql.SystemVariableType
- func NewSystemSetType(varName string, collation sql.CollationID, values ...string) sql.SystemVariableType
- func NewSystemStringType(varName string) sql.SystemVariableType
- func NewSystemUintType(varName string, lowerbound, upperbound uint64) sql.SystemVariableType
- func NumColumns(t sql.Type) int
- func NumericUnaryValue(t sql.Type) interface{}
- func SerializeType(typ ExtendedType) ([]byte, error)
- func SerializeTypeToString(typ ExtendedType) (string, error)
- func SetExtendedTypeSerializers(serializer ExtendedTypeSerializer, deserializer ExtendedTypeDeserializer)
- func StringifyJSON(jsonWrapper sql.JSONWrapper) (string, error)
- func TypesEqual(a, b sql.Type) bool
- func ValidateSRID(srid int, funcName string) error
- func ValidateTime(t time.Time) interface{}
- func WriteCount(buf []byte, count uint32)
- func WriteEWKBHeader(buf []byte, srid, typ uint32)
- func WriteStrings(wr io.Writer, strs ...string) (int, error)
- func WriteWKBHeader(buf []byte, typ uint32)
- type BitType
- type BitType_
- func (BitType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t BitType_) Compare(a interface{}, b interface{}) (int, error)
- func (t BitType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t BitType_) Equals(otherType sql.Type) bool
- func (t BitType_) MaxTextResponseByteLength(*sql.Context) uint32
- func (t BitType_) MustConvert(v interface{}) interface{}
- func (t BitType_) NumberOfBits() uint8
- func (t BitType_) Promote() sql.Type
- func (t BitType_) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t BitType_) String() string
- func (t BitType_) Type() query.Type
- func (t BitType_) ValueType() reflect.Type
- func (t BitType_) Zero() interface{}
- type ComparableJSON
- type DecimalType_
- func (t DecimalType_) BoundsCheck(v decimal.Decimal) (decimal.Decimal, sql.ConvertInRange, error)
- func (DecimalType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t DecimalType_) Compare(a interface{}, b interface{}) (int, error)
- func (t DecimalType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t DecimalType_) ConvertNoBoundsCheck(v interface{}) (decimal.Decimal, error)
- func (t DecimalType_) ConvertToNullDecimal(v interface{}) (decimal.NullDecimal, error)
- func (t DecimalType_) DecimalValueStringFixed(v decimal.Decimal) string
- func (t DecimalType_) Equals(otherType sql.Type) bool
- func (t DecimalType_) ExclusiveUpperBound() decimal.Decimal
- func (t DecimalType_) MaxTextResponseByteLength(*sql.Context) uint32
- func (t DecimalType_) MaximumScale() uint8
- func (t DecimalType_) MustConvert(v interface{}) interface{}
- func (t DecimalType_) Precision() uint8
- func (t DecimalType_) Promote() sql.Type
- func (t DecimalType_) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t DecimalType_) Scale() uint8
- func (t DecimalType_) String() string
- func (t DecimalType_) Type() query.Type
- func (t DecimalType_) ValueType() reflect.Type
- func (t DecimalType_) Zero() interface{}
- type EnumType
- func (t EnumType) At(idx int) (string, bool)
- func (t EnumType) CharacterSet() sql.CharacterSetID
- func (t EnumType) Collation() sql.CollationID
- func (t EnumType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t EnumType) Compare(a interface{}, b interface{}) (int, error)
- func (t EnumType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t EnumType) Equals(otherType sql.Type) bool
- func (t EnumType) IndexOf(v string) int
- func (t EnumType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t EnumType) MustConvert(v interface{}) interface{}
- func (t EnumType) NumberOfElements() uint16
- func (t EnumType) Promote() sql.Type
- func (t EnumType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t EnumType) String() string
- func (t EnumType) StringWithTableCollation(tableCollation sql.CollationID) string
- func (t EnumType) Type() query.Type
- func (t EnumType) ValueType() reflect.Type
- func (t EnumType) Values() []string
- func (t EnumType) WithNewCollation(collation sql.CollationID) (sql.Type, error)
- func (t EnumType) Zero() interface{}
- type ExtendedType
- type ExtendedTypeDeserializer
- type ExtendedTypeSerializedWidth
- type ExtendedTypeSerializer
- type GeomColl
- func (g GeomColl) BBox() (float64, float64, float64, float64)
- func (g GeomColl) CalculateSize() (numPoints int, numCounts int, numHeaders int)
- func (g GeomColl) GetSRID() uint32
- func (g GeomColl) Serialize() (buf []byte)
- func (g GeomColl) SetSRID(srid uint32) GeometryValue
- func (g GeomColl) Swap() GeometryValue
- func (g GeomColl) WriteData(buf []byte) int
- type GeomCollType
- func (GeomCollType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t GeomCollType) Compare(a interface{}, b interface{}) (int, error)
- func (t GeomCollType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t GeomCollType) Equals(otherType sql.Type) bool
- func (t GeomCollType) GetSpatialTypeSRID() (uint32, bool)
- func (t GeomCollType) MatchSRID(v interface{}) error
- func (t GeomCollType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t GeomCollType) Promote() sql.Type
- func (t GeomCollType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t GeomCollType) SetSRID(v uint32) sql.Type
- func (t GeomCollType) String() string
- func (t GeomCollType) Type() query.Type
- func (t GeomCollType) ValueType() reflect.Type
- func (t GeomCollType) Zero() interface{}
- type GeometryType
- func (GeometryType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t GeometryType) Compare(a any, b any) (int, error)
- func (t GeometryType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t GeometryType) Equals(otherType sql.Type) (ok bool)
- func (t GeometryType) GetSpatialTypeSRID() (uint32, bool)
- func (t GeometryType) MatchSRID(v interface{}) error
- func (t GeometryType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t GeometryType) Promote() sql.Type
- func (t GeometryType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t GeometryType) SetSRID(v uint32) sql.Type
- func (t GeometryType) String() string
- func (t GeometryType) Type() query.Type
- func (t GeometryType) ValueType() reflect.Type
- func (t GeometryType) Zero() interface{}
- type GeometryValue
- type JSONBytes
- type JSONDocument
- func (doc JSONDocument) ArrayAppend(path string, val sql.JSONWrapper) (MutableJSON, bool, error)
- func (doc JSONDocument) ArrayInsert(path string, val sql.JSONWrapper) (MutableJSON, bool, error)
- func (doc JSONDocument) Clone(context.Context) sql.JSONWrapper
- func (doc JSONDocument) Compare(other sql.JSONWrapper) (int, error)
- func (doc JSONDocument) Insert(_ context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error)
- func (doc JSONDocument) JSONString() (string, error)
- func (doc JSONDocument) Lookup(ctx context.Context, path string) (sql.JSONWrapper, error)
- func (doc JSONDocument) Remove(ctx context.Context, path string) (MutableJSON, bool, error)
- func (doc JSONDocument) Replace(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error)
- func (doc JSONDocument) Set(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error)
- func (doc JSONDocument) String() string
- func (doc JSONDocument) ToInterface() (interface{}, error)
- func (doc JSONDocument) Value() (driver.Value, error)
- type JSONIter
- type JSONStringer
- type JsonArray
- type JsonObject
- type JsonType
- func (JsonType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t JsonType) Compare(a interface{}, b interface{}) (int, error)
- func (t JsonType) Convert(v interface{}) (doc interface{}, inRange sql.ConvertInRange, err error)
- func (t JsonType) Equals(otherType sql.Type) bool
- func (t JsonType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t JsonType) Promote() sql.Type
- func (t JsonType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t JsonType) String() string
- func (t JsonType) Type() query.Type
- func (t JsonType) ValueType() reflect.Type
- func (t JsonType) Zero() interface{}
- type LazyJSONDocument
- type LineString
- type LineStringType
- func (LineStringType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t LineStringType) Compare(a interface{}, b interface{}) (int, error)
- func (t LineStringType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t LineStringType) Equals(otherType sql.Type) bool
- func (t LineStringType) GetSpatialTypeSRID() (uint32, bool)
- func (t LineStringType) MatchSRID(v interface{}) error
- func (t LineStringType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t LineStringType) Promote() sql.Type
- func (t LineStringType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t LineStringType) SetSRID(v uint32) sql.Type
- func (t LineStringType) String() string
- func (t LineStringType) Type() query.Type
- func (t LineStringType) ValueType() reflect.Type
- func (t LineStringType) Zero() interface{}
- type MultiLineString
- func (p MultiLineString) BBox() (float64, float64, float64, float64)
- func (p MultiLineString) GetSRID() uint32
- func (p MultiLineString) Serialize() (buf []byte)
- func (p MultiLineString) SetSRID(srid uint32) GeometryValue
- func (p MultiLineString) Swap() GeometryValue
- func (p MultiLineString) WriteData(buf []byte) int
- type MultiLineStringType
- func (MultiLineStringType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t MultiLineStringType) Compare(a interface{}, b interface{}) (int, error)
- func (t MultiLineStringType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t MultiLineStringType) Equals(otherType sql.Type) bool
- func (t MultiLineStringType) GetSpatialTypeSRID() (uint32, bool)
- func (t MultiLineStringType) MatchSRID(v interface{}) error
- func (t MultiLineStringType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t MultiLineStringType) Promote() sql.Type
- func (t MultiLineStringType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t MultiLineStringType) SetSRID(v uint32) sql.Type
- func (t MultiLineStringType) String() string
- func (t MultiLineStringType) Type() query.Type
- func (t MultiLineStringType) ValueType() reflect.Type
- func (t MultiLineStringType) Zero() interface{}
- type MultiPoint
- type MultiPointType
- func (MultiPointType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t MultiPointType) Compare(a interface{}, b interface{}) (int, error)
- func (t MultiPointType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t MultiPointType) Equals(otherType sql.Type) bool
- func (t MultiPointType) GetSpatialTypeSRID() (uint32, bool)
- func (t MultiPointType) MatchSRID(v interface{}) error
- func (t MultiPointType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t MultiPointType) Promote() sql.Type
- func (t MultiPointType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t MultiPointType) SetSRID(v uint32) sql.Type
- func (t MultiPointType) String() string
- func (t MultiPointType) Type() query.Type
- func (t MultiPointType) ValueType() reflect.Type
- func (t MultiPointType) Zero() interface{}
- type MultiPolygon
- type MultiPolygonType
- func (MultiPolygonType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t MultiPolygonType) Compare(a interface{}, b interface{}) (int, error)
- func (t MultiPolygonType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t MultiPolygonType) Equals(otherType sql.Type) bool
- func (t MultiPolygonType) GetSpatialTypeSRID() (uint32, bool)
- func (t MultiPolygonType) MatchSRID(v interface{}) error
- func (t MultiPolygonType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t MultiPolygonType) Promote() sql.Type
- func (t MultiPolygonType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t MultiPolygonType) SetSRID(v uint32) sql.Type
- func (t MultiPolygonType) String() string
- func (t MultiPolygonType) Type() query.Type
- func (t MultiPolygonType) ValueType() reflect.Type
- func (t MultiPolygonType) Zero() interface{}
- type MutableJSON
- type NoCopyBuilder
- type NumberTypeImpl_
- func (NumberTypeImpl_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t NumberTypeImpl_) Compare(a interface{}, b interface{}) (int, error)
- func (t NumberTypeImpl_) Compare2(a sql.Value, b sql.Value) (int, error)
- func (t NumberTypeImpl_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t NumberTypeImpl_) Convert2(value sql.Value) (sql.Value, error)
- func (t NumberTypeImpl_) DisplayWidth() int
- func (t NumberTypeImpl_) Equals(otherType sql.Type) bool
- func (t NumberTypeImpl_) IsFloat() bool
- func (t NumberTypeImpl_) IsSigned() bool
- func (t NumberTypeImpl_) MaxTextResponseByteLength(*sql.Context) uint32
- func (t NumberTypeImpl_) MustConvert(v interface{}) interface{}
- func (t NumberTypeImpl_) Promote() sql.Type
- func (t NumberTypeImpl_) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t NumberTypeImpl_) SQL2(v sql.Value) (sqltypes.Value, error)
- func (t NumberTypeImpl_) SQLFloat32(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLFloat64(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLInt16(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLInt24(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLInt32(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLInt64(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLInt8(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLUint16(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLUint24(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLUint32(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLUint64(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) SQLUint8(ctx *sql.Context, dest []byte, v interface{}) ([]byte, error)
- func (t NumberTypeImpl_) String() string
- func (t NumberTypeImpl_) Type() query.Type
- func (t NumberTypeImpl_) ValueType() reflect.Type
- func (t NumberTypeImpl_) Zero() interface{}
- func (t NumberTypeImpl_) Zero2() sql.Value
- type OkResult
- type Point
- type PointType
- func (PointType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t PointType) Compare(a interface{}, b interface{}) (int, error)
- func (t PointType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t PointType) Equals(otherType sql.Type) bool
- func (t PointType) GetSpatialTypeSRID() (uint32, bool)
- func (t PointType) MatchSRID(v interface{}) error
- func (t PointType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t PointType) Promote() sql.Type
- func (t PointType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t PointType) SetSRID(v uint32) sql.Type
- func (t PointType) String() string
- func (t PointType) Type() query.Type
- func (t PointType) ValueType() reflect.Type
- func (t PointType) Zero() interface{}
- type Polygon
- type PolygonType
- func (PolygonType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t PolygonType) Compare(a interface{}, b interface{}) (int, error)
- func (t PolygonType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t PolygonType) Equals(otherType sql.Type) bool
- func (t PolygonType) GetSpatialTypeSRID() (uint32, bool)
- func (t PolygonType) MatchSRID(v interface{}) error
- func (t PolygonType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t PolygonType) Promote() sql.Type
- func (t PolygonType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t PolygonType) SetSRID(v uint32) sql.Type
- func (t PolygonType) String() string
- func (t PolygonType) Type() query.Type
- func (t PolygonType) ValueType() reflect.Type
- func (t PolygonType) Zero() interface{}
- type SearchableJSON
- type SetType
- func (t SetType) BitsToString(v uint64) (string, error)
- func (t SetType) CharacterSet() sql.CharacterSetID
- func (t SetType) Collation() sql.CollationID
- func (t SetType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t SetType) Compare(a interface{}, b interface{}) (int, error)
- func (t SetType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t SetType) Equals(otherType sql.Type) bool
- func (t SetType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t SetType) MustConvert(v interface{}) interface{}
- func (t SetType) NumberOfElements() uint16
- func (t SetType) Promote() sql.Type
- func (t SetType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t SetType) String() string
- func (t SetType) StringWithTableCollation(tableCollation sql.CollationID) string
- func (t SetType) Type() query.Type
- func (t SetType) ValueType() reflect.Type
- func (t SetType) Values() []string
- func (t SetType) WithNewCollation(collation sql.CollationID) (sql.Type, error)
- func (t SetType) Zero() interface{}
- type SpatialRef
- type StringType
- func (t StringType) CharacterSet() sql.CharacterSetID
- func (t StringType) Collation() sql.CollationID
- func (t StringType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t StringType) Compare(a interface{}, b interface{}) (int, error)
- func (t StringType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t StringType) Equals(otherType sql.Type) bool
- func (t StringType) Length() int64
- func (t StringType) MaxByteLength() int64
- func (t StringType) MaxCharacterLength() int64
- func (t StringType) MaxTextResponseByteLength(ctx *sql.Context) uint32
- func (t StringType) MustConvert(v interface{}) interface{}
- func (t StringType) Promote() sql.Type
- func (t StringType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t StringType) String() string
- func (t StringType) StringWithTableCollation(tableCollation sql.CollationID) string
- func (t StringType) Type() query.Type
- func (t StringType) ValueType() reflect.Type
- func (t StringType) WithNewCollation(collation sql.CollationID) (sql.Type, error)
- func (t StringType) Zero() interface{}
- type SystemBoolType
- func (SystemBoolType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t SystemBoolType) Compare(a interface{}, b interface{}) (int, error)
- func (t SystemBoolType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t SystemBoolType) DecodeValue(val string) (interface{}, error)
- func (t SystemBoolType) EncodeValue(val interface{}) (string, error)
- func (t SystemBoolType) Equals(otherType sql.Type) bool
- func (t SystemBoolType) MaxTextResponseByteLength(ctx *sql.Context) uint32
- func (t SystemBoolType) MustConvert(v interface{}) interface{}
- func (t SystemBoolType) Promote() sql.Type
- func (t SystemBoolType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t SystemBoolType) String() string
- func (t SystemBoolType) Type() query.Type
- func (t SystemBoolType) UnderlyingType() sql.Type
- func (t SystemBoolType) ValueType() reflect.Type
- func (t SystemBoolType) Zero() interface{}
- type TimeType
- type Timespan
- func (t Timespan) Add(other Timespan) Timespan
- func (t Timespan) AsMicroseconds() int64
- func (t Timespan) AsTimeDuration() time.Duration
- func (t Timespan) Bytes() []byte
- func (t Timespan) Compare(other Timespan) int
- func (t Timespan) Equals(other Timespan) bool
- func (t Timespan) Negate() Timespan
- func (t Timespan) String() string
- func (t Timespan) Subtract(other Timespan) Timespan
- type TimespanType_
- func (TimespanType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t TimespanType_) Compare(a interface{}, b interface{}) (int, error)
- func (t TimespanType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t TimespanType_) ConvertToTimeDuration(v interface{}) (time.Duration, error)
- func (t TimespanType_) ConvertToTimespan(v interface{}) (Timespan, error)
- func (t TimespanType_) Equals(otherType sql.Type) bool
- func (t TimespanType_) MaxTextResponseByteLength(*sql.Context) uint32
- func (_ TimespanType_) MicrosecondsToTimespan(v int64) Timespan
- func (t TimespanType_) MustConvert(v interface{}) interface{}
- func (t TimespanType_) Promote() sql.Type
- func (t TimespanType_) SQL(_ *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t TimespanType_) String() string
- func (t TimespanType_) Type() query.Type
- func (t TimespanType_) ValueType() reflect.Type
- func (t TimespanType_) Zero() interface{}
- type TupleType
- func (TupleType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t TupleType) Compare(a, b interface{}) (int, error)
- func (t TupleType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t TupleType) Equals(otherType sql.Type) bool
- func (t TupleType) MaxTextResponseByteLength(*sql.Context) uint32
- func (t TupleType) MustConvert(v interface{}) interface{}
- func (t TupleType) Promote() sql.Type
- func (t TupleType) SQL(*sql.Context, []byte, interface{}) (sqltypes.Value, error)
- func (t TupleType) String() string
- func (t TupleType) Type() query.Type
- func (t TupleType) ValueType() reflect.Type
- func (t TupleType) Zero() interface{}
- type YearType_
- func (YearType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (t YearType_) Compare(a interface{}, b interface{}) (int, error)
- func (t YearType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
- func (t YearType_) Equals(otherType sql.Type) bool
- func (t YearType_) MaxTextResponseByteLength(*sql.Context) uint32
- func (t YearType_) MustConvert(v interface{}) interface{}
- func (t YearType_) Promote() sql.Type
- func (t YearType_) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t YearType_) String() string
- func (t YearType_) Type() query.Type
- func (t YearType_) ValueType() reflect.Type
- func (t YearType_) Zero() interface{}
Constants ¶
const ( // BitTypeMinBits returns the minimum number of bits for Bit. BitTypeMinBits = 1 // BitTypeMaxBits returns the maximum number of bits for Bit. BitTypeMaxBits = 64 )
const ( // DecimalTypeMaxPrecision returns the maximum precision allowed for the Decimal type. DecimalTypeMaxPrecision = 65 // DecimalTypeMaxScale returns the maximum scale allowed for the Decimal type, assuming the // maximum precision is used. For a maximum scale that is relative to the precision of a given // decimal type, use its MaximumScale function. DecimalTypeMaxScale = 30 )
const ( // EnumTypeMinElements returns the minimum number of enumerations for the Enum type. EnumTypeMinElements = 1 // EnumTypeMaxElements returns the maximum number of enumerations for the Enum type. EnumTypeMaxElements = 65535 )
const ( CartesianSRID = uint32(0) GeoSpatialSRID = uint32(4326) )
const ( SRIDSize = 4 EndianSize = 1 TypeSize = 4 EWKBHeaderSize = SRIDSize + EndianSize + TypeSize WKBHeaderSize = EndianSize + TypeSize PointSize = 16 CountSize = 4 GeometryMaxByteLength = 4*(1024*1024*1024) - 1 )
const ( WKBUnknown = iota WKBPointID WKBLineID WKBPolyID WKBMultiPointID WKBMultiLineID WKBMultiPolyID WKBGeomCollID )
Type IDs
const ( SET = iota INSERT REPLACE REMOVE ARRAY_APPEND ARRAY_INSERT )
const ( MaxRowLength = 65_535 TinyTextBlobMax = charBinaryMax TextBlobMax = varcharVarbinaryMax MediumTextBlobMax = 16_777_215 LongTextBlobMax = int64(4_294_967_295) )
const OkResultColumnName = "__ok_result__"
OkResultColumnName should be used as the schema column name for Nodes that return an OkResult
const (
// SetTypeMaxElements returns the maximum number of elements for the Set type.
SetTypeMaxElements = 64
)
const ZeroDateStr = "0000-00-00"
const ZeroTimestampDatetimeStr = "0000-00-00 00:00:00"
Variables ¶
var ( // ErrConvertingToTime is thrown when a value cannot be converted to a Time ErrConvertingToTime = errors.NewKind("Incorrect datetime value: '%v'") ErrConvertingToTimeOutOfRange = errors.NewKind("value %q is outside of %v range") DateOnlyLayouts = []string{ "20060102", "2006-1-2", "2006-01-02", "2006/01/02", } // TimestampDatetimeLayouts hold extra timestamps allowed for parsing. It does // not have all the layouts supported by mysql. Missing are two digit year // versions of common cases and dates that use non common separators. // // https://github.com/MariaDB/server/blob/mysql-5.5.36/sql-common/my_time.c#L124 TimestampDatetimeLayouts = append([]string{ time.RFC3339, time.RFC3339Nano, "2006-01-02 15:4", "2006-01-02 15:04", "2006-01-02 15:04:", "2006-01-02 15:04:.", "2006-01-02 15:04:05.", "2006-01-02 15:04:05.999999", "2006-1-2 15:4:5.999999", "2006-01-02T15:04:05", "20060102150405", "2006-01-02 15:04:05.999999999 -0700 MST", }, DateOnlyLayouts...) // Date is a date with day, month and year. Date = MustCreateDatetimeType(sqltypes.Date, 0) // Datetime is a date and a time with default precision (no fractional seconds). Datetime = MustCreateDatetimeType(sqltypes.Datetime, 0) // DatetimeMaxPrecision is a date and a time with maximum precision DatetimeMaxPrecision = MustCreateDatetimeType(sqltypes.Datetime, 6) // Timestamp is a UNIX timestamp with default precision (no fractional seconds). Timestamp = MustCreateDatetimeType(sqltypes.Timestamp, 0) // TimestampMaxPrecision is a UNIX timestamp with maximum precision TimestampMaxPrecision = MustCreateDatetimeType(sqltypes.Timestamp, 6) )
var ( ErrConvertingToDecimal = errors.NewKind("value %v is not a valid Decimal") ErrConvertToDecimalLimit = errors.NewKind("Out of range value for column of Decimal type ") ErrMarshalNullDecimal = errors.NewKind("Decimal cannot marshal a null value") )
var ( ErrConvertingToEnum = errors.NewKind("value %v is not valid for this Enum") ErrDataTruncatedForColumn = errors.NewKind("Data truncated for column '%s'") )
var ( Null sql.NullType = nullType{} // ErrValueNotNil is thrown when a value that was expected to be nil, is not ErrValueNotNil = errors.NewKind("value not nil: %#v") )
var ( // Boolean is a synonym for TINYINT(1) Boolean = MustCreateNumberTypeWithDisplayWidth(sqltypes.Int8, 1) // Int8 is an integer of 8 bits Int8 = MustCreateNumberType(sqltypes.Int8) // Uint8 is an unsigned integer of 8 bits Uint8 = MustCreateNumberType(sqltypes.Uint8) // Int16 is an integer of 16 bits Int16 = MustCreateNumberType(sqltypes.Int16) // Uint16 is an unsigned integer of 16 bits Uint16 = MustCreateNumberType(sqltypes.Uint16) // Int24 is an integer of 24 bits. Int24 = MustCreateNumberType(sqltypes.Int24) // Uint24 is an unsigned integer of 24 bits. Uint24 = MustCreateNumberType(sqltypes.Uint24) // Int32 is an integer of 32 bits. Int32 = MustCreateNumberType(sqltypes.Int32) // Uint32 is an unsigned integer of 32 bits. Uint32 = MustCreateNumberType(sqltypes.Uint32) // Int64 is an integer of 64 bytes. Int64 = MustCreateNumberType(sqltypes.Int64) // Uint64 is an unsigned integer of 64 bits. Uint64 = MustCreateNumberType(sqltypes.Uint64) // Float32 is a floating point number of 32 bits. Float32 = MustCreateNumberType(sqltypes.Float32) // Float64 is a floating point number of 64 bits. Float64 = MustCreateNumberType(sqltypes.Float64) )
var ( // ErrLengthTooLarge is thrown when a string's length is too large given the other parameters. ErrLengthTooLarge = errors.NewKind("length is %v but max allowed is %v") ErrLengthBeyondLimit = errors.NewKind("string '%v' is too large for column '%v'") ErrBinaryCollation = errors.NewKind("binary types must have the binary collation: %v") ErrBadCharsetString = errors.NewKind("invalid string for charset %s: '%v'") TinyText = MustCreateStringWithDefaults(sqltypes.Text, TinyTextBlobMax) Text = MustCreateStringWithDefaults(sqltypes.Text, TextBlobMax) MediumText = MustCreateStringWithDefaults(sqltypes.Text, MediumTextBlobMax) LongText = MustCreateStringWithDefaults(sqltypes.Text, LongTextBlobMax) TinyBlob = MustCreateBinary(sqltypes.Blob, TinyTextBlobMax) Blob = MustCreateBinary(sqltypes.Blob, TextBlobMax) MediumBlob = MustCreateBinary(sqltypes.Blob, MediumTextBlobMax) LongBlob = MustCreateBinary(sqltypes.Blob, LongTextBlobMax) )
var ( Year sql.YearType = YearType_{} ErrConvertingToYear = errors.NewKind("value %v is not a valid Year") )
var ErrCharacterSetOnInvalidType = errors.NewKind("Only character columns, enums, and sets can have a CHARACTER SET option")
var (
ErrNotGeomColl = errors.NewKind("value of type %T is not a point")
)
var (
ErrNotGeometry = errors.NewKind("Value of type %T is not a geometry")
)
var (
ErrNotMultiLineString = errors.NewKind("value of type %T is not a multilinestring")
)
var (
ErrNotMultiPoint = errors.NewKind("value of type %T is not a multipoint")
)
var (
ErrNotMultiPolygon = errors.NewKind("value of type %T is not a multipolygon")
)
var (
ErrNotPolygon = errors.NewKind("value of type %T is not a polygon")
)
var InternalDecimalType sql.DecimalType = DecimalType_{ // contains filtered or unexported fields }
InternalDecimalType is a special DecimalType that is used internally for Decimal comparisons. Not intended for usage from integrators.
var JSON sql.Type = JsonType{}
var (
MaxJsonFieldByteLength = int64(1024) * int64(1024) * int64(1024)
)
var OkResultColumnType = Int64
OkResultColumnType should be used as the schema column type for Nodes that return an OkResult
var OkResultSchema = sql.Schema{ { Name: OkResultColumnName, Type: OkResultColumnType, }, }
OkResultSchema should be used as the schema of Nodes that return an OkResult
var SupportedSRIDs = map[uint32]SpatialRef{}/* 5152 elements not displayed */
Functions ¶
func AllocateGeoTypeBuffer ¶
TODO: unexport
func AppendAndSliceBytes ¶
func AppendAndSliceString ¶
TODO: move me
func ApproximateTypeFromValue ¶
ApproximateTypeFromValue returns the closest matching type to the given value. For example, an int16 will return SMALLINT.
func CoalesceInt ¶ added in v0.18.0
CoalesceInt converts a int8/int16/... to int
func ColumnTypeToType ¶
func ColumnTypeToType(ct *sqlparser.ColumnType) (sql.Type, error)
ColumnTypeToType gets the column type using the column definition.
func CompareJSON ¶ added in v0.18.0
CompareJSON compares two JSON values. It returns 0 if the values are equal, -1 if a < b, and 1 if a > b. JSON values can be compared using the =, <, <=, >, >=, <>, !=, and <=> operators. BETWEEN IN() GREATEST() LEAST() are not yet supported with JSON values.
For comparison of JSON and non-JSON values, the non-JSON value is first converted to JSON (see JsonType.Convert()). Comparison of JSON values takes place at two levels. The first level of comparison is based on the JSON types of the compared values. If the types differ, the comparison result is determined solely by which type has higher precedence. If the two values have the same JSON type, a second level of comparison occurs using type-specific rules. The following list shows the precedences of JSON types, from highest precedence to the lowest. (The type names are those returned by the JSON_TYPE() function.) Types shown together on a line have the same precedence. Any value having a JSON type listed earlier in the list compares greater than any value having a JSON type listed later in the list.
BLOB, BIT, OPAQUE, DATETIME, TIME, DATE, BOOLEAN, ARRAY, OBJECT, STRING, INTEGER, DOUBLE, NULL TODO(andy): implement BLOB BIT OPAQUE DATETIME TIME DATE current precedence: BOOLEAN, ARRAY, OBJECT, STRING, DOUBLE, NULL
For JSON values of the same precedence, the comparison rules are type specific:
ARRAY Two JSON arrays are equal if they have the same length and values in corresponding positions in the arrays are equal. If the arrays are not equal, their order is determined by the elements in the first position where there is a difference. The array with the smaller value in that position is ordered first. If all values of the shorter array are equal to the corresponding values in the longer array, the shorter array is ordered first. e.g. [] < ["a"] < ["ab"] < ["ab", "cd", "ef"] < ["ab", "ef"]
BOOLEAN The JSON false literal is less than the JSON true literal.
OBJECT Two JSON objects are equal if they have the same set of keys, and each key has the same value in both objects. The order of two objects that are not equal is unspecified but deterministic. e.g. {"a": 1, "b": 2} = {"b": 2, "a": 1}
STRING Strings are ordered lexically on the first N bytes of the utf8mb4 representation of the two strings being compared, where N is the length of the shorter string. If the first N bytes of the two strings are identical, the shorter string is considered smaller than the longer string. e.g. "a" < "ab" < "b" < "bc" This ordering is equivalent to the ordering of SQL strings with collation utf8mb4_bin. Because utf8mb4_bin is a binary collation, comparison of JSON values is case-sensitive: e.g. "A" < "a"
DOUBLE JSON values can contain exact-value numbers and approximate-value numbers. For a general discussion of these types of numbers, see Section 9.1.2, “Numeric Literals”. The rules for comparing native MySQL numeric types are discussed in Section 12.3, “Type Conversion in Expression Evaluation”, but the rules for comparing numbers within JSON values differ somewhat:
In a comparison between two columns that use the native MySQL INT and DOUBLE numeric types, respectively, it is known that all comparisons involve an integer and a double, so the integer is converted to double for all rows. That is, exact-value numbers are converted to approximate-value numbers.
On the other hand, if the query compares two JSON columns containing numbers, it cannot be known in advance whether numbers are integer or double. To provide the most consistent behavior across all rows, MySQL converts approximate-value numbers to exact-value numbers. The resulting ordering is consistent and does not lose precision for the exact-value numbers. e.g. 9223372036854775805 < 9223372036854775806 < 9223372036854775807 < 9.223372036854776e18 = 9223372036854776000 < 9223372036854776001
NULL For comparison of any JSON value to SQL NULL, the result is UNKNOWN.
TODO(andy): BLOB, BIT, OPAQUE, DATETIME, TIME, DATE, INTEGER
https://dev.mysql.com/doc/refman/8.0/en/json.html#json-comparison
func CompareNulls ¶
CompareNulls compares two values, and returns true if either is null. The returned integer represents the ordering, with a rule that states nulls as being ordered before non-nulls.
func ConcatenateJSONValues ¶
func ConcatenateJSONValues(ctx *sql.Context, vals ...sql.JSONWrapper) (sql.JSONWrapper, error)
func ContainsJSON ¶ added in v0.18.0
func ConvertToBytes ¶ added in v0.19.0
func ConvertToBytes(v interface{}, t sql.StringType, dest []byte) ([]byte, error)
func ConvertToCollatedString ¶
ConvertToCollatedString returns the given interface as a string, along with its collation. If the Type possess a collation, then that collation is returned. If the Type does not possess a collation (such as an integer), then the value is converted to a string and the default collation is used. If the value is already a string then no additional conversions are made. If the value is a byte slice then a non-copying conversion is made, which means that the original byte slice MUST NOT be modified after being passed to this function. If modifications need to be made, then you must allocate a new byte slice and pass that new one in.
func ConvertToString ¶
func ConvertToString(v interface{}, t sql.StringType, dest []byte) (string, error)
func ConvertToTime ¶
func CreateBinary ¶
CreateBinary creates a StringType with a binary collation and character set of the given size.
func CreateColumnDecimalType ¶
func CreateColumnDecimalType(precision uint8, scale uint8) (sql.DecimalType, error)
CreateColumnDecimalType creates a DecimalType for VALID-TABLE-COLUMN. Creating a decimal type for a column ensures that when operating on instances of this type, the result will be restricted to the defined precision and scale.
func CreateDatetimeType ¶
CreateDatetimeType creates a Type dealing with all temporal types that are not TIME nor YEAR.
func CreateDecimalType ¶
func CreateDecimalType(precision uint8, scale uint8) (sql.DecimalType, error)
CreateDecimalType creates a DecimalType for NON-TABLE-COLUMN.
func CreateEnumType ¶
CreateEnumType creates a EnumType.
func CreateLongText ¶
func CreateLongText(collation sql.CollationID) sql.StringType
CreateLongText creates a LONGTEXT with the given collation.
func CreateMediumText ¶
func CreateMediumText(collation sql.CollationID) sql.StringType
CreateMediumText creates a MEDIUMTEXT with the given collation.
func CreateNumberType ¶
func CreateNumberType(baseType query.Type) (sql.NumberType, error)
CreateNumberType creates a NumberType.
func CreateNumberTypeWithDisplayWidth ¶ added in v0.18.0
func CreateNumberTypeWithDisplayWidth(baseType query.Type, displayWidth int) (sql.NumberType, error)
CreateNumberTypeWithDisplayWidth creates a NumberType that includes optional |displayWidth| metadata. Note that MySQL only allows a |displayWidth| of 1 for Int8 (i.e. TINYINT(1)); any other combination of |displayWidth| and |baseType| is not supported and will cause this function to return an error.
func CreateSetType ¶
CreateSetType creates a SetType.
func CreateString ¶
func CreateString(baseType query.Type, length int64, collation sql.CollationID) (sql.StringType, error)
CreateString creates a new StringType based on the specified type, length, and collation. Length is interpreted as the length of bytes in the new StringType for SQL types that are based on bytes (i.e. TEXT, BLOB, BINARY, and VARBINARY). For all other char-based SQL types, length is interpreted as the length of chars in the new StringType (i.e. CHAR, and VARCHAR).
func CreateStringWithDefaults ¶
CreateStringWithDefaults creates a StringType with the default character set and collation of the given size.
func CreateText ¶
func CreateText(collation sql.CollationID) sql.StringType
CreateText creates a TEXT with the given collation.
func CreateTinyText ¶
func CreateTinyText(collation sql.CollationID) sql.StringType
CreateTinyText creates a TINYTEXT with the given collation.
func CreateTuple ¶
CreateTuple returns a new tuple type with the given element types.
func DeepCopyJson ¶
func DeepCopyJson(v interface{}) interface{}
DeepCopyJson implements deep copy of JSON document
func DeserializeEWKBHeader ¶
DeserializeEWKBHeader parses the header portion of a byte array in EWKB format to extract endianness and type
func DeserializeWKBHeader ¶
DeserializeWKBHeader parses the header potion of a byte array in WKB format There is no SRID
func ErrIfMismatchedColumns ¶
ErrIfMismatchedColumns returns an operand error if the number of columns in t1 is not equal to the number of columns in t2. If the number of columns is equal, and both types are tuple types, it recurses into each subtype, asserting that those subtypes are structurally identical as well.
func ErrIfMismatchedColumnsInTuple ¶
ErrIfMismatchedColumnsInTuple returns an operand error is t2 is not a tuple type whose subtypes are structurally identical to t1.
func IsBinaryType ¶
IsBinaryType checks if t is BINARY, VARBINARY, or BLOB
func IsDeferredType ¶
func IsExtendedType ¶ added in v0.18.0
IsExtendedType returns whether the given sql.Type is an ExtendedType.
func IsGeometry ¶
IsGeometry returns true if the specified type is a Geometry type.
func IsNull ¶
func IsNull(ex sql.Expression) bool
IsNull returns true if expression is nil or is Null Type, otherwise false.
func IsOkResult ¶
IsOkResult returns whether the given row represents an OkResult.
func IsOkResultSchema ¶
func IsText ¶
IsText checks if t is a CHAR, VARCHAR, TEXT, BINARY, VARBINARY, or BLOB (including TEXT and BLOB variants).
func IsTextBlob ¶
IsTextBlob checks if t is one of the TEXTs or BLOBs.
func IsTextOnly ¶
IsTextOnly checks if t is CHAR, VARCHAR, or one of the TEXTs.
func IsTimestampType ¶
IsTimestampType checks if t is a timestamp
func IsTuple ¶
IsTuple checks if t is a tuple type. Note that TupleType instances with just 1 value are not considered as a tuple, but a parenthesized value.
func LookupJSONValue ¶ added in v0.18.0
func LookupJSONValue(j sql.JSONWrapper, path string) (sql.JSONWrapper, error)
func MarshallJson ¶ added in v0.19.0
func MarshallJson(jsonWrapper sql.JSONWrapper) ([]byte, error)
JSONBytes returns or generates a byte array for the JSON representation of the underlying sql.JSONWrapper
func MarshallJsonValue ¶ added in v0.19.0
func MustCreateBinary ¶
func MustCreateBinary(baseType query.Type, lengthHint int64) sql.StringType
MustCreateBinary is the same as CreateBinary except it panics on errors.
func MustCreateColumnDecimalType ¶
func MustCreateColumnDecimalType(precision uint8, scale uint8) sql.DecimalType
MustCreateColumnDecimalType is the same as CreateDecimalType except it panics on errors and for VALID-TABLE-COLUMN.
func MustCreateDatetimeType ¶
func MustCreateDatetimeType(baseType query.Type, precision int) sql.DatetimeType
MustCreateDatetimeType is the same as CreateDatetimeType except it panics on errors.
func MustCreateDecimalType ¶
func MustCreateDecimalType(precision uint8, scale uint8) sql.DecimalType
MustCreateDecimalType is the same as CreateDecimalType except it panics on errors and for NON-TABLE-COLUMN.
func MustCreateEnumType ¶
func MustCreateEnumType(values []string, collation sql.CollationID) sql.EnumType
MustCreateEnumType is the same as CreateEnumType except it panics on errors.
func MustCreateNumberType ¶
func MustCreateNumberType(baseType query.Type) sql.NumberType
MustCreateNumberType is the same as CreateNumberType except it panics on errors.
func MustCreateNumberTypeWithDisplayWidth ¶ added in v0.18.0
func MustCreateNumberTypeWithDisplayWidth(baseType query.Type, displayWidth int) sql.NumberType
MustCreateNumberTypeWithDisplayWidth is the same as CreateNumberTypeWithDisplayWidth except it panics on errors.
func MustCreateSetType ¶
func MustCreateSetType(values []string, collation sql.CollationID) sql.SetType
MustCreateSetType is the same as CreateSetType except it panics on errors.
func MustCreateString ¶
func MustCreateString(baseType query.Type, length int64, collation sql.CollationID) sql.StringType
MustCreateString is the same as CreateString except it panics on errors.
func MustCreateStringWithDefaults ¶
func MustCreateStringWithDefaults(baseType query.Type, length int64) sql.StringType
MustCreateStringWithDefaults creates a StringType with the default CharacterSet and Collation.
func NewDeferredType ¶
func NewLazyJSONDocument ¶ added in v0.19.0
func NewLazyJSONDocument(bytes []byte) sql.JSONWrapper
func NewSystemBoolType ¶
func NewSystemBoolType(varName string) sql.SystemVariableType
NewSystemBoolType returns a new systemBoolType.
func NewSystemDoubleType ¶
func NewSystemDoubleType(varName string, lowerbound, upperbound float64) sql.SystemVariableType
NewSystemDoubleType returns a new systemDoubleType.
func NewSystemEnumType ¶
func NewSystemEnumType(varName string, values ...string) sql.SystemVariableType
NewSystemEnumType returns a new systemEnumType.
func NewSystemIntType ¶
func NewSystemIntType(varName string, lowerbound, upperbound int64, negativeOne bool) sql.SystemVariableType
NewSystemIntType returns a new systemIntType.
func NewSystemSetType ¶
func NewSystemSetType(varName string, collation sql.CollationID, values ...string) sql.SystemVariableType
NewSystemSetType returns a new systemSetType.
func NewSystemStringType ¶
func NewSystemStringType(varName string) sql.SystemVariableType
NewSystemStringType returns a new systemStringType.
func NewSystemUintType ¶
func NewSystemUintType(varName string, lowerbound, upperbound uint64) sql.SystemVariableType
NewSystemUintType returns a new systemUintType.
func NumColumns ¶
NumColumns returns the number of columns in a type. This is one for all types, except tuples.
func NumericUnaryValue ¶
func SerializeType ¶ added in v0.18.0
func SerializeType(typ ExtendedType) ([]byte, error)
SerializeType serializes the given extended type into a byte slice.
func SerializeTypeToString ¶ added in v0.18.0
func SerializeTypeToString(typ ExtendedType) (string, error)
SerializeTypeToString serializes the given extended type into a hex-encoded string.
func SetExtendedTypeSerializers ¶ added in v0.18.0
func SetExtendedTypeSerializers(serializer ExtendedTypeSerializer, deserializer ExtendedTypeDeserializer)
SetExtendedTypeSerializers sets the handlers that are able to serialize and deserialize extended types. It is recommended to set these from within an init function within the calling package.
func StringifyJSON ¶ added in v0.19.0
func StringifyJSON(jsonWrapper sql.JSONWrapper) (string, error)
StringifyJSON generates a string representation of a sql.JSONWrapper that is compatible with MySQL's JSON output, including spaces.
func TypesEqual ¶
TypesEqual compares two Types and returns whether they are equivalent.
func ValidateSRID ¶ added in v0.16.0
func ValidateTime ¶
ValidateTime receives a time and returns either that time or nil if it's not a valid time.
func WriteEWKBHeader ¶
WriteEWKBHeader will write EWKB header to the given buffer
func WriteWKBHeader ¶
WriteWKBHeader will write WKB header to the given buffer
Types ¶
type BitType ¶
BitType represents the BIT type. https://dev.mysql.com/doc/refman/8.0/en/bit-type.html The type of the returned value is uint64.
func CreateBitType ¶
CreateBitType creates a BitType.
func MustCreateBitType ¶
MustCreateBitType is the same as CreateBitType except it panics on errors.
type BitType_ ¶
type BitType_ struct {
// contains filtered or unexported fields
}
func (BitType_) CollationCoercibility ¶
func (BitType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (BitType_) Convert ¶
func (t BitType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (BitType_) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements Type interface
func (BitType_) MustConvert ¶
func (t BitType_) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (BitType_) NumberOfBits ¶
NumberOfBits returns the number of bits that this type may contain.
type ComparableJSON ¶ added in v0.19.0
type DecimalType_ ¶
type DecimalType_ struct {
// contains filtered or unexported fields
}
func (DecimalType_) BoundsCheck ¶
func (t DecimalType_) BoundsCheck(v decimal.Decimal) (decimal.Decimal, sql.ConvertInRange, error)
func (DecimalType_) CollationCoercibility ¶
func (DecimalType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (DecimalType_) Compare ¶
func (t DecimalType_) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (DecimalType_) Convert ¶
func (t DecimalType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (DecimalType_) ConvertNoBoundsCheck ¶
func (t DecimalType_) ConvertNoBoundsCheck(v interface{}) (decimal.Decimal, error)
func (DecimalType_) ConvertToNullDecimal ¶
func (t DecimalType_) ConvertToNullDecimal(v interface{}) (decimal.NullDecimal, error)
ConvertToNullDecimal implements DecimalType interface.
func (DecimalType_) DecimalValueStringFixed ¶ added in v0.18.0
func (t DecimalType_) DecimalValueStringFixed(v decimal.Decimal) string
DecimalValueStringFixed returns string value for the given decimal value. If decimal type value is for valid table column only, it should use scale defined by the column. Otherwise, the result value should use its own precision and scale.
func (DecimalType_) Equals ¶
func (t DecimalType_) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (DecimalType_) ExclusiveUpperBound ¶
func (t DecimalType_) ExclusiveUpperBound() decimal.Decimal
ExclusiveUpperBound implements DecimalType interface.
func (DecimalType_) MaxTextResponseByteLength ¶
func (t DecimalType_) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (DecimalType_) MaximumScale ¶
func (t DecimalType_) MaximumScale() uint8
MaximumScale implements DecimalType interface.
func (DecimalType_) MustConvert ¶
func (t DecimalType_) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (DecimalType_) Precision ¶
func (t DecimalType_) Precision() uint8
Precision implements DecimalType interface.
func (DecimalType_) Promote ¶
func (t DecimalType_) Promote() sql.Type
Promote implements the Type interface.
func (DecimalType_) Scale ¶
func (t DecimalType_) Scale() uint8
Scale implements DecimalType interface.
func (DecimalType_) String ¶
func (t DecimalType_) String() string
String implements Type interface.
func (DecimalType_) ValueType ¶
func (t DecimalType_) ValueType() reflect.Type
ValueType implements Type interface.
type EnumType ¶
type EnumType struct {
// contains filtered or unexported fields
}
func (EnumType) CharacterSet ¶
func (t EnumType) CharacterSet() sql.CharacterSetID
CharacterSet implements EnumType interface.
func (EnumType) Collation ¶
func (t EnumType) Collation() sql.CollationID
Collation implements EnumType interface.
func (EnumType) CollationCoercibility ¶
func (t EnumType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (EnumType) Convert ¶
func (t EnumType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (EnumType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
func (EnumType) MustConvert ¶
func (t EnumType) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (EnumType) NumberOfElements ¶
NumberOfElements implements EnumType interface.
func (EnumType) StringWithTableCollation ¶ added in v0.17.0
func (t EnumType) StringWithTableCollation(tableCollation sql.CollationID) string
StringWithTableCollation implements sql.TypeWithCollation interface.
func (EnumType) WithNewCollation ¶
WithNewCollation implements sql.TypeWithCollation interface.
type ExtendedType ¶ added in v0.18.0
type ExtendedType interface { sql.Type // SerializedCompare compares two byte slices that each represent a serialized value, without first deserializing // the value. This should return the same result as the Compare function. SerializedCompare(v1 []byte, v2 []byte) (int, error) // SerializeValue converts the given value into a binary representation. SerializeValue(val any) ([]byte, error) // DeserializeValue converts a binary representation of a value into its canonical type. DeserializeValue(val []byte) (any, error) // FormatValue returns a string version of the value. Primarily intended for display. FormatValue(val any) (string, error) // MaxSerializedWidth returns the maximum size that the serialized value may represent. MaxSerializedWidth() ExtendedTypeSerializedWidth }
ExtendedType is a serializable type that offers an extended interface for interacting with types in a wider context.
func DeserializeType ¶ added in v0.18.0
func DeserializeType(typ []byte) (ExtendedType, error)
DeserializeType deserializes a byte slice representing a serialized extended type.
func DeserializeTypeFromString ¶ added in v0.18.0
func DeserializeTypeFromString(typ string) (ExtendedType, error)
DeserializeTypeFromString deserializes a hex-encoded string representing a serialized extended type.
type ExtendedTypeDeserializer ¶ added in v0.18.0
type ExtendedTypeDeserializer func(serializedType []byte) (ExtendedType, error)
ExtendedTypeDeserializer is the function signature for the extended type deserializer.
type ExtendedTypeSerializedWidth ¶ added in v0.18.0
type ExtendedTypeSerializedWidth uint8
const ( ExtendedTypeSerializedWidth_64K ExtendedTypeSerializedWidth = iota // Represents a variably-sized value. The maximum number of bytes is (2^16)-1. ExtendedTypeSerializedWidth_Unbounded // Represents a variably-sized value. The maximum number of bytes is (2^64)-1, which is practically unbounded. )
type ExtendedTypeSerializer ¶ added in v0.18.0
type ExtendedTypeSerializer func(extendedType ExtendedType) ([]byte, error)
ExtendedTypeSerializer is the function signature for the extended type serializer.
type GeomColl ¶
type GeomColl struct { SRID uint32 Geoms []GeometryValue }
GeomColl is the value type returned from GeomCollType. Implements GeometryValue.
func DeserializeGeomColl ¶
DeserializeGeomColl parses the data portion of a byte array in WKB format to a GeometryCollection object
func (GeomColl) CalculateSize ¶
CalculateSize is a helper method to determine how much space to allocate for geometry collections TODO: recursion could be better; possible to expand to fit all types
func (GeomColl) Serialize ¶
Serialize implements GeometryValue interface. TODO: actually count all points to allocate
func (GeomColl) SetSRID ¶
func (g GeomColl) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (GeomColl) Swap ¶
func (g GeomColl) Swap() GeometryValue
Swap implements GeometryValue interface.
type GeomCollType ¶
GeomCollType represents the GeometryCollection type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-point.html The type of the returned value is GeomColl.
func (GeomCollType) CollationCoercibility ¶
func (GeomCollType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (GeomCollType) Compare ¶
func (t GeomCollType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (GeomCollType) Convert ¶
func (t GeomCollType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (GeomCollType) Equals ¶
func (t GeomCollType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (GeomCollType) GetSpatialTypeSRID ¶
func (t GeomCollType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (GeomCollType) MatchSRID ¶
func (t GeomCollType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (GeomCollType) MaxTextResponseByteLength ¶
func (t GeomCollType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (GeomCollType) Promote ¶
func (t GeomCollType) Promote() sql.Type
Promote implements the Type interface.
func (GeomCollType) SetSRID ¶
func (t GeomCollType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (GeomCollType) String ¶
func (t GeomCollType) String() string
String implements Type interface.
func (GeomCollType) ValueType ¶
func (t GeomCollType) ValueType() reflect.Type
ValueType implements Type interface.
type GeometryType ¶
GeometryType represents the GEOMETRY type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-geometry.html The type of the returned value is one of the following (each implements GeometryValue): Point, Polygon, LineString.
func (GeometryType) CollationCoercibility ¶
func (GeometryType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (GeometryType) Compare ¶
func (t GeometryType) Compare(a any, b any) (int, error)
Compare implements Type interface.
func (GeometryType) Convert ¶
func (t GeometryType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (GeometryType) Equals ¶
func (t GeometryType) Equals(otherType sql.Type) (ok bool)
Equals implements the Type interface.
func (GeometryType) GetSpatialTypeSRID ¶
func (t GeometryType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (GeometryType) MatchSRID ¶
func (t GeometryType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (GeometryType) MaxTextResponseByteLength ¶
func (t GeometryType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (GeometryType) Promote ¶
func (t GeometryType) Promote() sql.Type
Promote implements the Type interface.
func (GeometryType) SetSRID ¶
func (t GeometryType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (GeometryType) String ¶
func (t GeometryType) String() string
String implements Type interface.
func (GeometryType) ValueType ¶
func (t GeometryType) ValueType() reflect.Type
ValueType implements Type interface.
type GeometryValue ¶
type GeometryValue interface { GetSRID() uint32 SetSRID(srid uint32) GeometryValue Serialize() []byte WriteData(buf []byte) int Swap() GeometryValue BBox() (float64, float64, float64, float64) // contains filtered or unexported methods }
GeometryValue is the value type returned from GeometryType, which is an interface over the following types: Point, Polygon, LineString, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection.
type JSONBytes ¶ added in v0.19.0
type JSONBytes interface { sql.JSONWrapper GetBytes() ([]byte, error) }
JSONBytes are values which can be represented as JSON.
type JSONDocument ¶
type JSONDocument struct {
Val interface{}
}
func MustJSON ¶
func MustJSON(s string) JSONDocument
func (JSONDocument) ArrayAppend ¶ added in v0.18.0
func (doc JSONDocument) ArrayAppend(path string, val sql.JSONWrapper) (MutableJSON, bool, error)
func (JSONDocument) ArrayInsert ¶ added in v0.18.0
func (doc JSONDocument) ArrayInsert(path string, val sql.JSONWrapper) (MutableJSON, bool, error)
func (JSONDocument) Clone ¶ added in v0.19.0
func (doc JSONDocument) Clone(context.Context) sql.JSONWrapper
func (JSONDocument) Compare ¶
func (doc JSONDocument) Compare(other sql.JSONWrapper) (int, error)
func (JSONDocument) Insert ¶ added in v0.18.0
func (doc JSONDocument) Insert(_ context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error)
func (JSONDocument) JSONString ¶ added in v0.18.0
func (doc JSONDocument) JSONString() (string, error)
func (JSONDocument) Lookup ¶ added in v0.19.0
func (doc JSONDocument) Lookup(ctx context.Context, path string) (sql.JSONWrapper, error)
func (JSONDocument) Remove ¶ added in v0.18.0
func (doc JSONDocument) Remove(ctx context.Context, path string) (MutableJSON, bool, error)
func (JSONDocument) Replace ¶ added in v0.18.0
func (doc JSONDocument) Replace(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error)
func (JSONDocument) Set ¶ added in v0.18.0
func (doc JSONDocument) Set(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error)
func (JSONDocument) String ¶ added in v0.18.0
func (doc JSONDocument) String() string
JSONDocument implements the fmt.Stringer interface.
func (JSONDocument) ToInterface ¶ added in v0.18.0
func (doc JSONDocument) ToInterface() (interface{}, error)
type JSONIter ¶ added in v0.18.0
type JSONIter struct {
// contains filtered or unexported fields
}
func NewJSONIter ¶ added in v0.18.0
func NewJSONIter(json JsonObject) JSONIter
type JSONStringer ¶ added in v0.18.0
JSONStringer can be converted to a string representation that is compatible with MySQL's JSON output, including spaces.
type JsonObject ¶ added in v0.18.0
type JsonObject = map[string]interface{}
type JsonType ¶
type JsonType struct{}
func (JsonType) CollationCoercibility ¶
func (JsonType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (JsonType) Convert ¶
func (t JsonType) Convert(v interface{}) (doc interface{}, inRange sql.ConvertInRange, err error)
Convert implements Type interface.
func (JsonType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
type LazyJSONDocument ¶ added in v0.19.0
type LazyJSONDocument struct { Bytes []byte // contains filtered or unexported fields }
LazyJSONDocument is an implementation of sql.JSONWrapper that wraps a JSON string and defers deserializing it unless needed. This is more efficient for queries that interact with JSON values but don't care about their structure.
func (*LazyJSONDocument) Clone ¶ added in v0.19.0
func (j *LazyJSONDocument) Clone(context.Context) sql.JSONWrapper
Clone implements sql.JSONWrapper.
func (*LazyJSONDocument) GetBytes ¶ added in v0.19.0
func (j *LazyJSONDocument) GetBytes() ([]byte, error)
func (*LazyJSONDocument) String ¶ added in v0.19.0
func (j *LazyJSONDocument) String() string
LazyJSONDocument implements the fmt.Stringer interface.
func (*LazyJSONDocument) ToInterface ¶ added in v0.19.0
func (j *LazyJSONDocument) ToInterface() (interface{}, error)
type LineString ¶
LineString is the value type returned from LineStringType. Implements GeometryValue.
func DeserializeLine ¶
DeserializeLine parses the data portion of a byte array in WKB format to a LineString object
func (LineString) BBox ¶
func (l LineString) BBox() (float64, float64, float64, float64)
BBox implements GeometryValue interface.
func (LineString) GetSRID ¶
func (l LineString) GetSRID() uint32
GetSRID implements GeometryValue interface.
func (LineString) Serialize ¶
func (l LineString) Serialize() (buf []byte)
Serialize implements GeometryValue interface.
func (LineString) SetSRID ¶
func (l LineString) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (LineString) Swap ¶
func (l LineString) Swap() GeometryValue
Swap implements GeometryValue interface. TODO: possible in place?
func (LineString) WriteData ¶
func (l LineString) WriteData(buf []byte) int
WriteData implements GeometryValue interface.
type LineStringType ¶
LineStringType represents the LINESTRING type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-linestring.html The type of the returned value is LineString.
func (LineStringType) CollationCoercibility ¶
func (LineStringType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (LineStringType) Compare ¶
func (t LineStringType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (LineStringType) Convert ¶
func (t LineStringType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (LineStringType) Equals ¶
func (t LineStringType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (LineStringType) GetSpatialTypeSRID ¶
func (t LineStringType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (LineStringType) MatchSRID ¶
func (t LineStringType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (LineStringType) MaxTextResponseByteLength ¶
func (t LineStringType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (LineStringType) Promote ¶
func (t LineStringType) Promote() sql.Type
Promote implements the Type interface.
func (LineStringType) SetSRID ¶
func (t LineStringType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (LineStringType) String ¶
func (t LineStringType) String() string
String implements Type interface.
func (LineStringType) Type ¶
func (t LineStringType) Type() query.Type
Type implements Type interface.
func (LineStringType) ValueType ¶
func (t LineStringType) ValueType() reflect.Type
ValueType implements Type interface.
func (LineStringType) Zero ¶
func (t LineStringType) Zero() interface{}
Zero implements Type interface.
type MultiLineString ¶
type MultiLineString struct { SRID uint32 Lines []LineString }
MultiLineString is the value type returned from MultiLineStringType. Implements GeometryValue.
func DeserializeMLine ¶
DeserializeMLine parses the data portion of a byte array in WKB format to a MultiLineString object
func (MultiLineString) BBox ¶
func (p MultiLineString) BBox() (float64, float64, float64, float64)
BBox implements GeometryValue interface.
func (MultiLineString) GetSRID ¶
func (p MultiLineString) GetSRID() uint32
GetSRID implements GeometryValue interface.
func (MultiLineString) Serialize ¶
func (p MultiLineString) Serialize() (buf []byte)
Serialize implements GeometryValue interface.
func (MultiLineString) SetSRID ¶
func (p MultiLineString) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (MultiLineString) Swap ¶
func (p MultiLineString) Swap() GeometryValue
Swap implements GeometryValue interface.
func (MultiLineString) WriteData ¶
func (p MultiLineString) WriteData(buf []byte) int
WriteData implements GeometryValue interface.
type MultiLineStringType ¶
MultiLineStringType represents the MUTILINESTRING type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-multilinestring.html The type of the returned value is MultiLineString.
func (MultiLineStringType) CollationCoercibility ¶
func (MultiLineStringType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (MultiLineStringType) Compare ¶
func (t MultiLineStringType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (MultiLineStringType) Convert ¶
func (t MultiLineStringType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (MultiLineStringType) Equals ¶
func (t MultiLineStringType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (MultiLineStringType) GetSpatialTypeSRID ¶
func (t MultiLineStringType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (MultiLineStringType) MatchSRID ¶
func (t MultiLineStringType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (MultiLineStringType) MaxTextResponseByteLength ¶
func (t MultiLineStringType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (MultiLineStringType) Promote ¶
func (t MultiLineStringType) Promote() sql.Type
Promote implements the Type interface.
func (MultiLineStringType) SQL ¶
func (t MultiLineStringType) SQL(ctx *sql.Context, dest []byte, v interface{}) (sqltypes.Value, error)
SQL implements Type interface.
func (MultiLineStringType) SetSRID ¶
func (t MultiLineStringType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (MultiLineStringType) String ¶
func (t MultiLineStringType) String() string
String implements Type interface.
func (MultiLineStringType) Type ¶
func (t MultiLineStringType) Type() query.Type
Type implements Type interface.
func (MultiLineStringType) ValueType ¶
func (t MultiLineStringType) ValueType() reflect.Type
ValueType implements Type interface.
func (MultiLineStringType) Zero ¶
func (t MultiLineStringType) Zero() interface{}
Zero implements Type interface.
type MultiPoint ¶
MultiPoint is the value type returned from MultiPointType. Implements GeometryValue.
func DeserializeMPoint ¶
DeserializeMPoint parses the data portion of a byte array in WKB format to a MultiPoint object
func (MultiPoint) BBox ¶
func (p MultiPoint) BBox() (float64, float64, float64, float64)
BBox implements GeometryValue interface.
func (MultiPoint) GetSRID ¶
func (p MultiPoint) GetSRID() uint32
GetSRID implements GeometryValue interface.
func (MultiPoint) Serialize ¶
func (p MultiPoint) Serialize() (buf []byte)
Serialize implements GeometryValue interface.
func (MultiPoint) SetSRID ¶
func (p MultiPoint) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (MultiPoint) Swap ¶
func (p MultiPoint) Swap() GeometryValue
Swap implements GeometryValue interface.
func (MultiPoint) WriteData ¶
func (p MultiPoint) WriteData(buf []byte) int
WriteData implements GeometryValue interface.
type MultiPointType ¶
MultiPointType represents the MULTIPOINT type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-multipoint.html The type of the returned value is MultiPoint.
func (MultiPointType) CollationCoercibility ¶
func (MultiPointType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (MultiPointType) Compare ¶
func (t MultiPointType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (MultiPointType) Convert ¶
func (t MultiPointType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (MultiPointType) Equals ¶
func (t MultiPointType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (MultiPointType) GetSpatialTypeSRID ¶
func (t MultiPointType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (MultiPointType) MatchSRID ¶
func (t MultiPointType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (MultiPointType) MaxTextResponseByteLength ¶
func (t MultiPointType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (MultiPointType) Promote ¶
func (t MultiPointType) Promote() sql.Type
Promote implements the Type interface.
func (MultiPointType) SetSRID ¶
func (t MultiPointType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (MultiPointType) String ¶
func (t MultiPointType) String() string
String implements Type interface.
func (MultiPointType) Type ¶
func (t MultiPointType) Type() query.Type
Type implements Type interface.
func (MultiPointType) ValueType ¶
func (t MultiPointType) ValueType() reflect.Type
ValueType implements Type interface.
func (MultiPointType) Zero ¶
func (t MultiPointType) Zero() interface{}
Zero implements Type interface.
type MultiPolygon ¶
MultiPolygon is the value type returned from MultiPolygonType. Implements GeometryValue.
func DeserializeMPoly ¶
DeserializeMPoly parses the data portion of a byte array in WKB format to a MultiPolygon object
func (MultiPolygon) BBox ¶
func (p MultiPolygon) BBox() (float64, float64, float64, float64)
BBox implements GeometryValue interface.
func (MultiPolygon) GetSRID ¶
func (p MultiPolygon) GetSRID() uint32
GetSRID implements GeometryValue interface.
func (MultiPolygon) Serialize ¶
func (p MultiPolygon) Serialize() (buf []byte)
Serialize implements GeometryValue interface.
func (MultiPolygon) SetSRID ¶
func (p MultiPolygon) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (MultiPolygon) Swap ¶
func (p MultiPolygon) Swap() GeometryValue
Swap implements GeometryValue interface.
func (MultiPolygon) WriteData ¶
func (p MultiPolygon) WriteData(buf []byte) int
WriteData implements GeometryValue interface.
type MultiPolygonType ¶
MultiPolygonType represents the MULTIPOLYGON type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-multipolygon.html The type of the returned value is MultiPolygon.
func (MultiPolygonType) CollationCoercibility ¶
func (MultiPolygonType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (MultiPolygonType) Compare ¶
func (t MultiPolygonType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (MultiPolygonType) Convert ¶
func (t MultiPolygonType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (MultiPolygonType) Equals ¶
func (t MultiPolygonType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (MultiPolygonType) GetSpatialTypeSRID ¶
func (t MultiPolygonType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (MultiPolygonType) MatchSRID ¶
func (t MultiPolygonType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (MultiPolygonType) MaxTextResponseByteLength ¶
func (t MultiPolygonType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (MultiPolygonType) Promote ¶
func (t MultiPolygonType) Promote() sql.Type
Promote implements the Type interface.
func (MultiPolygonType) SetSRID ¶
func (t MultiPolygonType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (MultiPolygonType) String ¶
func (t MultiPolygonType) String() string
String implements Type interface.
func (MultiPolygonType) Type ¶
func (t MultiPolygonType) Type() query.Type
Type implements Type interface.
func (MultiPolygonType) ValueType ¶
func (t MultiPolygonType) ValueType() reflect.Type
ValueType implements Type interface.
func (MultiPolygonType) Zero ¶
func (t MultiPolygonType) Zero() interface{}
Zero implements Type interface.
type MutableJSON ¶ added in v0.18.0
type MutableJSON interface { sql.JSONWrapper // Insert Adds the value at the given path, only if it is not present. Updated value returned, and bool indicating if // a change was made. Insert(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error) // Remove the value at the given path. Updated value returned, and bool indicating if a change was made. Remove(ctx context.Context, path string) (MutableJSON, bool, error) // Set the value at the given path. Updated value returned, and bool indicating if a change was made. Set(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error) // Replace the value at the given path with the new value. If the path does not exist, no modification is made. Replace(ctx context.Context, path string, val sql.JSONWrapper) (MutableJSON, bool, error) // ArrayInsert inserts into the array object referenced by the given path. If the path does not exist, no modification is made. ArrayInsert(path string, val sql.JSONWrapper) (MutableJSON, bool, error) // ArrayAppend appends to an array object referenced by the given path. If the path does not exist, no modification is made, // or if the path exists and is not an array, the element will be converted into an array and the element will be // appended to it. ArrayAppend(path string, val sql.JSONWrapper) (MutableJSON, bool, error) }
MutableJSON is a JSON value that can be efficiently modified. These modifications return the new value, but they are not required to preserve the state of the original value. If you want to preserve the old value, call |Clone| first and modify the clone, which is guaranteed to not affect the original.
type NoCopyBuilder ¶ added in v0.16.0
type NoCopyBuilder struct {
// contains filtered or unexported fields
}
func NewNoCopyBuilder ¶ added in v0.16.0
func NewNoCopyBuilder(initialAlloc int64) *NoCopyBuilder
func (*NoCopyBuilder) Bytes ¶ added in v0.16.0
func (b *NoCopyBuilder) Bytes() []byte
func (*NoCopyBuilder) String ¶ added in v0.16.0
func (b *NoCopyBuilder) String() string
type NumberTypeImpl_ ¶
type NumberTypeImpl_ struct {
// contains filtered or unexported fields
}
func (NumberTypeImpl_) CollationCoercibility ¶
func (NumberTypeImpl_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (NumberTypeImpl_) Compare ¶
func (t NumberTypeImpl_) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (NumberTypeImpl_) Convert ¶
func (t NumberTypeImpl_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (NumberTypeImpl_) DisplayWidth ¶ added in v0.18.0
func (t NumberTypeImpl_) DisplayWidth() int
DisplayWidth() implements NumberType inteface.
func (NumberTypeImpl_) Equals ¶
func (t NumberTypeImpl_) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (NumberTypeImpl_) IsFloat ¶
func (t NumberTypeImpl_) IsFloat() bool
IsFloat implements NumberType interface.
func (NumberTypeImpl_) IsSigned ¶
func (t NumberTypeImpl_) IsSigned() bool
IsSigned implements NumberType interface.
func (NumberTypeImpl_) MaxTextResponseByteLength ¶
func (t NumberTypeImpl_) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (NumberTypeImpl_) MustConvert ¶
func (t NumberTypeImpl_) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (NumberTypeImpl_) Promote ¶
func (t NumberTypeImpl_) Promote() sql.Type
Promote implements the Type interface.
func (NumberTypeImpl_) SQLFloat32 ¶ added in v0.19.0
func (NumberTypeImpl_) SQLFloat64 ¶ added in v0.19.0
func (NumberTypeImpl_) String ¶
func (t NumberTypeImpl_) String() string
String implements Type interface.
func (NumberTypeImpl_) Type ¶
func (t NumberTypeImpl_) Type() query.Type
Type implements Type interface.
func (NumberTypeImpl_) ValueType ¶
func (t NumberTypeImpl_) ValueType() reflect.Type
ValueType implements Type interface.
func (NumberTypeImpl_) Zero ¶
func (t NumberTypeImpl_) Zero() interface{}
Zero implements Type interface.
func (NumberTypeImpl_) Zero2 ¶
func (t NumberTypeImpl_) Zero2() sql.Value
type OkResult ¶
type OkResult struct { RowsAffected uint64 // Number of rows affected by this operation InsertID uint64 // Inserted ID, if any, or -1 if not Info fmt.Stringer // Human-readable status string for extra status info, echoed verbatim to clients. }
OkResult is a representation of the OK packet MySQL sends for non-select queries such as UPDATE, INSERT, etc. It can be returned as the only element in the row for a Node that doesn't select anything. See https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html
func GetOkResult ¶
GetOkResult extracts the OkResult from the row given
func NewOkResult ¶
NewOkResult returns a new OkResult with the given number of rows affected.
type Point ¶
Point is the value type returned from PointType. Implements GeometryValue.
func DeserializePoint ¶
DeserializePoint parses the data portion of a byte array in WKB format to a Point object
func (Point) SetSRID ¶
func (p Point) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (Point) Swap ¶
func (p Point) Swap() GeometryValue
Swap implements GeometryValue interface. TODO: possible in place?
type PointType ¶
PointType represents the POINT type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-point.html The type of the returned value is Point.
func (PointType) CollationCoercibility ¶
func (PointType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (PointType) Convert ¶
func (t PointType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (PointType) GetSpatialTypeSRID ¶
GetSpatialTypeSRID implements SpatialColumnType interface.
func (PointType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
type Polygon ¶
type Polygon struct { SRID uint32 Lines []LineString }
Polygon is the value type returned from PolygonType. Implements GeometryValue.
func DeserializePoly ¶
DeserializePoly parses the data portion of a byte array in WKB format to a Polygon object
func (Polygon) SetSRID ¶
func (p Polygon) SetSRID(srid uint32) GeometryValue
SetSRID implements GeometryValue interface.
func (Polygon) Swap ¶
func (p Polygon) Swap() GeometryValue
Swap implements GeometryValue interface. TODO: possible in place?
type PolygonType ¶
PolygonType represents the POLYGON type. https://dev.mysql.com/doc/refman/8.0/en/gis-class-polygon.html The type of the returned value is Polygon.
func (PolygonType) CollationCoercibility ¶
func (PolygonType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (PolygonType) Compare ¶
func (t PolygonType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (PolygonType) Convert ¶
func (t PolygonType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (PolygonType) Equals ¶
func (t PolygonType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (PolygonType) GetSpatialTypeSRID ¶
func (t PolygonType) GetSpatialTypeSRID() (uint32, bool)
GetSpatialTypeSRID implements SpatialColumnType interface.
func (PolygonType) MatchSRID ¶
func (t PolygonType) MatchSRID(v interface{}) error
MatchSRID implements SpatialColumnType interface
func (PolygonType) MaxTextResponseByteLength ¶
func (t PolygonType) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (PolygonType) Promote ¶
func (t PolygonType) Promote() sql.Type
Promote implements the Type interface.
func (PolygonType) SetSRID ¶
func (t PolygonType) SetSRID(v uint32) sql.Type
SetSRID implements SpatialColumnType interface.
func (PolygonType) ValueType ¶
func (t PolygonType) ValueType() reflect.Type
ValueType implements Type interface.
type SearchableJSON ¶ added in v0.19.0
type SearchableJSON interface { sql.JSONWrapper Lookup(ctx context.Context, path string) (sql.JSONWrapper, error) }
type SetType ¶
type SetType struct {
// contains filtered or unexported fields
}
func (SetType) BitsToString ¶
BitsToString implements SetType interface.
func (SetType) CharacterSet ¶
func (t SetType) CharacterSet() sql.CharacterSetID
CharacterSet implements SetType interface.
func (SetType) Collation ¶
func (t SetType) Collation() sql.CollationID
Collation implements SetType interface.
func (SetType) CollationCoercibility ¶
func (t SetType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (SetType) Convert ¶
func (t SetType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface. Returns the string representing the given value if applicable.
func (SetType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
func (SetType) MustConvert ¶
func (t SetType) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (SetType) NumberOfElements ¶
NumberOfElements implements SetType interface.
func (SetType) StringWithTableCollation ¶ added in v0.17.0
func (t SetType) StringWithTableCollation(tableCollation sql.CollationID) string
StringWithTableCollation implements sql.TypeWithCollation interface.
func (SetType) WithNewCollation ¶
WithNewCollation implements sql.TypeWithCollation interface.
type SpatialRef ¶ added in v0.16.0
type StringType ¶
type StringType struct {
// contains filtered or unexported fields
}
func (StringType) CharacterSet ¶
func (t StringType) CharacterSet() sql.CharacterSetID
func (StringType) Collation ¶
func (t StringType) Collation() sql.CollationID
func (StringType) CollationCoercibility ¶
func (t StringType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (StringType) Compare ¶
func (t StringType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (StringType) Convert ¶
func (t StringType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (StringType) Equals ¶
func (t StringType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (StringType) Length ¶
func (t StringType) Length() int64
func (StringType) MaxByteLength ¶
func (t StringType) MaxByteLength() int64
MaxByteLength is the maximum number of bytes that may be consumed by a string that conforms to this type.
func (StringType) MaxCharacterLength ¶
func (t StringType) MaxCharacterLength() int64
MaxCharacterLength is the maximum character length for this type.
func (StringType) MaxTextResponseByteLength ¶
func (t StringType) MaxTextResponseByteLength(ctx *sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (StringType) MustConvert ¶
func (t StringType) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (StringType) Promote ¶
func (t StringType) Promote() sql.Type
Promote implements the Type interface.
func (StringType) StringWithTableCollation ¶ added in v0.17.0
func (t StringType) StringWithTableCollation(tableCollation sql.CollationID) string
StringWithTableCollation implements sql.TypeWithCollation interface.
func (StringType) ValueType ¶
func (t StringType) ValueType() reflect.Type
ValueType implements Type interface.
func (StringType) WithNewCollation ¶
func (t StringType) WithNewCollation(collation sql.CollationID) (sql.Type, error)
WithNewCollation implements TypeWithCollation interface.
type SystemBoolType ¶ added in v0.16.0
type SystemBoolType struct {
// contains filtered or unexported fields
}
SystemBoolType is an internal boolean type ONLY for system variables.
func (SystemBoolType) CollationCoercibility ¶ added in v0.16.0
func (SystemBoolType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (SystemBoolType) Compare ¶ added in v0.16.0
func (t SystemBoolType) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (SystemBoolType) Convert ¶ added in v0.16.0
func (t SystemBoolType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (SystemBoolType) DecodeValue ¶ added in v0.16.0
func (t SystemBoolType) DecodeValue(val string) (interface{}, error)
DecodeValue implements SystemVariableType interface.
func (SystemBoolType) EncodeValue ¶ added in v0.16.0
func (t SystemBoolType) EncodeValue(val interface{}) (string, error)
EncodeValue implements SystemVariableType interface.
func (SystemBoolType) Equals ¶ added in v0.16.0
func (t SystemBoolType) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (SystemBoolType) MaxTextResponseByteLength ¶ added in v0.16.0
func (t SystemBoolType) MaxTextResponseByteLength(ctx *sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (SystemBoolType) MustConvert ¶ added in v0.16.0
func (t SystemBoolType) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (SystemBoolType) Promote ¶ added in v0.16.0
func (t SystemBoolType) Promote() sql.Type
Promote implements the Type interface.
func (SystemBoolType) String ¶ added in v0.16.0
func (t SystemBoolType) String() string
String implements Type interface.
func (SystemBoolType) Type ¶ added in v0.16.0
func (t SystemBoolType) Type() query.Type
Type implements Type interface.
func (SystemBoolType) UnderlyingType ¶ added in v0.16.0
func (t SystemBoolType) UnderlyingType() sql.Type
func (SystemBoolType) ValueType ¶ added in v0.16.0
func (t SystemBoolType) ValueType() reflect.Type
ValueType implements Type interface.
func (SystemBoolType) Zero ¶ added in v0.16.0
func (t SystemBoolType) Zero() interface{}
Zero implements Type interface.
type TimeType ¶
type TimeType interface { sql.Type // ConvertToTimespan returns a Timespan from the given interface. Follows the same conversion rules as // Convert(), in that this will process the value based on its base-10 visual representation (for example, Convert() // will interpret the value `1234` as 12 minutes and 34 seconds). Returns an error for nil values. ConvertToTimespan(v interface{}) (Timespan, error) // ConvertToTimeDuration returns a time.Duration from the given interface. Follows the same conversion rules as // Convert(), in that this will process the value based on its base-10 visual representation (for example, Convert() // will interpret the value `1234` as 12 minutes and 34 seconds). Returns an error for nil values. ConvertToTimeDuration(v interface{}) (time.Duration, error) // MicrosecondsToTimespan returns a Timespan from the given number of microseconds. This differs from Convert(), as // that will process the value based on its base-10 visual representation (for example, Convert() will interpret // the value `1234` as 12 minutes and 34 seconds). This clamps the given microseconds to the allowed range. MicrosecondsToTimespan(v int64) Timespan }
TimeType represents the TIME type. https://dev.mysql.com/doc/refman/8.0/en/time.html TIME is implemented as TIME(6). The type of the returned value is Timespan. TODO: implement parameters on the TIME type
var ( Time TimeType = TimespanType_{} ErrConvertingToTimeType = errors.NewKind("value %v is not a valid Time") )
type Timespan ¶
type Timespan int64
Timespan is the value type returned by TimeType.Convert().
func (Timespan) Add ¶
Add returns a new Timespan that is the sum of the calling Timespan and given Timespan. The resulting Timespan is clamped to the allowed range.
func (Timespan) AsMicroseconds ¶
AsMicroseconds returns the Timespan in microseconds.
func (Timespan) AsTimeDuration ¶
AsTimeDuration returns the Timespan as a time.Duration.
func (Timespan) Compare ¶
Compare returns an integer comparing two values. The result will be 0 if t==other, -1 if t < other, and +1 if t > other.
func (Timespan) Equals ¶
Equals returns whether the calling Timespan and given Timespan are equivalent.
type TimespanType_ ¶
type TimespanType_ struct{}
func (TimespanType_) CollationCoercibility ¶
func (TimespanType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (TimespanType_) Compare ¶
func (t TimespanType_) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (TimespanType_) Convert ¶
func (t TimespanType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
func (TimespanType_) ConvertToTimeDuration ¶
func (t TimespanType_) ConvertToTimeDuration(v interface{}) (time.Duration, error)
ConvertToTimeDuration implements the TimeType interface.
func (TimespanType_) ConvertToTimespan ¶
func (t TimespanType_) ConvertToTimespan(v interface{}) (Timespan, error)
ConvertToTimespan converts the given interface value to a Timespan. This follows the conversion rules of MySQL, which are based on the base-10 visual representation of numbers (for example, Time.Convert() will interpret the value `1234` as 12 minutes and 34 seconds). Returns an error on a nil value.
func (TimespanType_) Equals ¶
func (t TimespanType_) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (TimespanType_) MaxTextResponseByteLength ¶
func (t TimespanType_) MaxTextResponseByteLength(*sql.Context) uint32
MaxTextResponseByteLength implements the Type interface
func (TimespanType_) MicrosecondsToTimespan ¶
func (_ TimespanType_) MicrosecondsToTimespan(v int64) Timespan
MicrosecondsToTimespan implements the TimeType interface.
func (TimespanType_) MustConvert ¶
func (t TimespanType_) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (TimespanType_) Promote ¶
func (t TimespanType_) Promote() sql.Type
Promote implements the Type interface.
func (TimespanType_) String ¶
func (t TimespanType_) String() string
String implements Type interface.
func (TimespanType_) Type ¶
func (t TimespanType_) Type() query.Type
Type implements Type interface.
func (TimespanType_) ValueType ¶
func (t TimespanType_) ValueType() reflect.Type
ValueType implements Type interface.
func (TimespanType_) Zero ¶
func (t TimespanType_) Zero() interface{}
Zero implements Type interface.
type TupleType ¶
func (TupleType) CollationCoercibility ¶
func (TupleType) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (TupleType) Convert ¶
func (t TupleType) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
func (TupleType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
func (TupleType) MustConvert ¶
func (t TupleType) MustConvert(v interface{}) interface{}
type YearType_ ¶
type YearType_ struct{}
func (YearType_) CollationCoercibility ¶
func (YearType_) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements sql.CollationCoercible interface.
func (YearType_) Convert ¶
func (t YearType_) Convert(v interface{}) (interface{}, sql.ConvertInRange, error)
Convert implements Type interface.
func (YearType_) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
func (YearType_) MustConvert ¶
func (t YearType_) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
Source Files
¶
- bit.go
- conversion.go
- datetime.go
- decimal.go
- deferred.go
- enum.go
- extended.go
- geometry.go
- geometrycollection.go
- json.go
- json_encode.go
- json_value.go
- linestring.go
- multilinestring.go
- multipoint.go
- multipolygon.go
- null.go
- number.go
- ok_result.go
- point.go
- polygon.go
- set.go
- spatial_reference_systems.go
- strings.go
- system_bool.go
- system_double.go
- system_enum.go
- system_int.go
- system_set.go
- system_string.go
- system_uint.go
- time.go
- tuple.go
- typecheck.go
- year.go