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 ColumnTypeToType(ct *sqlparser.ColumnType) (sql.Type, error)
- func CompareNulls(a interface{}, b interface{}) (bool, int)
- func ConvertToBool(v interface{}) (bool, error)
- func ConvertToCollatedString(val interface{}, typ sql.Type) (string, sql.CollationID, error)
- func ConvertToString(v interface{}, t sql.StringType) (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) (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 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 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 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 MustCreateBinary(baseType query.Type, lengthHint int64) sql.StringType
- func MustCreateColumnDecimalType(precision uint8, scale uint8) sql.DecimalType
- func MustCreateDatetimeType(baseType query.Type) 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 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 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, 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 TypesEqual(a, b sql.Type) bool
- func ValidateTime(t time.Time) interface{}
- func WriteCount(buf []byte, count uint32)
- func WriteEWKBHeader(buf []byte, srid, typ uint32)
- func WriteWKBHeader(buf []byte, typ uint32)
- type BitType
- type BitType_
- func (t BitType_) Compare(a interface{}, b interface{}) (int, error)
- func (t BitType_) Convert(v interface{}) (interface{}, error)
- func (t BitType_) Equals(otherType sql.Type) bool
- func (t BitType_) MaxTextResponseByteLength() 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 DecimalType_
- func (t DecimalType_) BoundsCheck(v decimal.Decimal) (decimal.Decimal, error)
- func (t DecimalType_) Compare(a interface{}, b interface{}) (int, error)
- func (t DecimalType_) Convert(v interface{}) (interface{}, error)
- func (t DecimalType_) ConvertNoBoundsCheck(v interface{}) (decimal.Decimal, error)
- func (t DecimalType_) ConvertToNullDecimal(v interface{}) (decimal.NullDecimal, error)
- func (t DecimalType_) Equals(otherType sql.Type) bool
- func (t DecimalType_) ExclusiveUpperBound() decimal.Decimal
- func (t DecimalType_) MaxTextResponseByteLength() 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(index int) (string, bool)
- func (t EnumType) CharacterSet() sql.CharacterSetID
- func (t EnumType) Collation() sql.CollationID
- func (t EnumType) Compare(a interface{}, b interface{}) (int, error)
- func (t EnumType) Convert(v interface{}) (interface{}, error)
- func (t EnumType) Equals(otherType sql.Type) bool
- func (t EnumType) IndexOf(v string) int
- func (t EnumType) MaxTextResponseByteLength() 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) 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 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 (t GeomCollType) Compare(a interface{}, b interface{}) (int, error)
- func (t GeomCollType) Convert(v interface{}) (interface{}, 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() 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 (t GeometryType) Compare(a any, b any) (int, error)
- func (t GeometryType) Convert(v interface{}) (interface{}, 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() 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 JSONDocument
- func (doc JSONDocument) Compare(ctx *sql.Context, v JSONValue) (int, error)
- func (doc JSONDocument) Contains(ctx *sql.Context, candidate JSONValue) (val interface{}, err error)
- func (doc JSONDocument) Extract(ctx *sql.Context, path string) (JSONValue, error)
- func (doc JSONDocument) Keys(ctx *sql.Context, path string) (val JSONValue, err error)
- func (doc JSONDocument) Overlaps(ctx *sql.Context, val SearchableJSONValue) (ok bool, err error)
- func (doc JSONDocument) Search(ctx *sql.Context) (path string, err error)
- func (doc JSONDocument) ToString(_ *sql.Context) (string, error)
- func (doc JSONDocument) Unmarshall(_ *sql.Context) (JSONDocument, error)
- func (doc JSONDocument) Value() (driver.Value, error)
- type JSONValue
- type JsonType
- func (t JsonType) Compare(a interface{}, b interface{}) (int, error)
- func (t JsonType) Convert(v interface{}) (doc interface{}, err error)
- func (t JsonType) Equals(otherType sql.Type) bool
- func (t JsonType) MaxTextResponseByteLength() 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 LineString
- type LineStringType
- func (t LineStringType) Compare(a interface{}, b interface{}) (int, error)
- func (t LineStringType) Convert(v interface{}) (interface{}, 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() 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 (t MultiLineStringType) Compare(a interface{}, b interface{}) (int, error)
- func (t MultiLineStringType) Convert(v interface{}) (interface{}, 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() 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 (t MultiPointType) Compare(a interface{}, b interface{}) (int, error)
- func (t MultiPointType) Convert(v interface{}) (interface{}, 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() 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 (t MultiPolygonType) Compare(a interface{}, b interface{}) (int, error)
- func (t MultiPolygonType) Convert(v interface{}) (interface{}, 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() 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 NumberTypeImpl_
- 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{}, error)
- func (t NumberTypeImpl_) Convert2(value sql.Value) (sql.Value, error)
- func (t NumberTypeImpl_) Equals(otherType sql.Type) bool
- func (t NumberTypeImpl_) IsFloat() bool
- func (t NumberTypeImpl_) IsSigned() bool
- func (t NumberTypeImpl_) MaxTextResponseByteLength() 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_) 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 (t PointType) Compare(a interface{}, b interface{}) (int, error)
- func (t PointType) Convert(v interface{}) (interface{}, 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() 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 (t PolygonType) Compare(a interface{}, b interface{}) (int, error)
- func (t PolygonType) Convert(v interface{}) (interface{}, 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() 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 SearchableJSONValue
- 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) Compare(a interface{}, b interface{}) (int, error)
- func (t SetType) Convert(v interface{}) (interface{}, error)
- func (t SetType) Equals(otherType sql.Type) bool
- func (t SetType) MaxTextResponseByteLength() 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) 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 StringType
- func (t StringType) CharacterSet() sql.CharacterSetID
- func (t StringType) Collation() sql.CollationID
- func (t StringType) Compare(a interface{}, b interface{}) (int, error)
- func (t StringType) Convert(v interface{}) (interface{}, 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() 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) 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 (t SystemBoolType_) Compare(a interface{}, b interface{}) (int, error)
- func (t SystemBoolType_) Convert(v interface{}) (interface{}, 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() 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_) 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) 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 (t TimespanType_) Compare(a interface{}, b interface{}) (int, error)
- func (t TimespanType_) Convert(v interface{}) (interface{}, 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() uint32
- func (_ TimespanType_) MicrosecondsToTimespan(v int64) Timespan
- func (t TimespanType_) MustConvert(v interface{}) interface{}
- func (t TimespanType_) Promote() sql.Type
- func (t TimespanType_) SQL(ctx *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 (t TupleType) Compare(a, b interface{}) (int, error)
- func (t TupleType) Convert(v interface{}) (interface{}, error)
- func (t TupleType) Equals(otherType sql.Type) bool
- func (t TupleType) MaxTextResponseByteLength() 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 (t YearType_) Compare(a interface{}, b interface{}) (int, error)
- func (t YearType_) Convert(v interface{}) (interface{}, error)
- func (t YearType_) Equals(otherType sql.Type) bool
- func (t YearType_) MaxTextResponseByteLength() 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 ( 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
)
Variables ¶
var ( // ErrConvertingToTime is thrown when a value cannot be converted to a Time ErrConvertingToTime = errors.NewKind("Incorrect datetime value: '%s'") ErrConvertingToTimeOutOfRange = errors.NewKind("value %q is outside of %v range") // 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 = []string{ "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-01-02", "2006-1-2", "2006-1-2 15:4:5.999999", time.RFC3339, time.RFC3339Nano, "2006-01-02T15:04:05", "20060102150405", "20060102", "2006/01/02", "2006-01-02 15:04:05.999999999 -0700 MST", } // Date is a date with day, month and year. Date = MustCreateDatetimeType(sqltypes.Date) // Datetime is a date and a time Datetime = MustCreateDatetimeType(sqltypes.Datetime) // Timestamp is an UNIX timestamp. Timestamp = MustCreateDatetimeType(sqltypes.Timestamp) )
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 ( 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 Boolean = Int8 // 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") 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 (
ErrConvertingToEnum = errors.NewKind("value %v is not valid for this Enum")
)
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
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 ColumnTypeToType ¶
func ColumnTypeToType(ct *sqlparser.ColumnType) (sql.Type, error)
ColumnTypeToType gets the column type using the column definition.
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 ConvertToBool ¶
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) (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 ¶
func CreateDatetimeType(baseType query.Type) (sql.DatetimeType, error)
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 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 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 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) 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 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 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, 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 TypesEqual ¶
TypesEqual compares two Types and returns whether they are equivalent.
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_) 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 DecimalType_ ¶
type DecimalType_ struct {
// contains filtered or unexported fields
}
func (DecimalType_) BoundsCheck ¶
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{}, 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_) 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() 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) 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) WithNewCollation ¶
WithNewCollation implements TypeWithCollation interface.
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) 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{}, 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() 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) 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{}, 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() 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 JSONDocument ¶
type JSONDocument struct {
Val interface{}
}
func MustJSON ¶
func MustJSON(s string) JSONDocument
func (JSONDocument) Contains ¶
func (doc JSONDocument) Contains(ctx *sql.Context, candidate JSONValue) (val interface{}, err error)
Contains returns nil in case of a nil value for either the doc.Val or candidate. Otherwise it returns a bool
func (JSONDocument) Overlaps ¶
func (doc JSONDocument) Overlaps(ctx *sql.Context, val SearchableJSONValue) (ok bool, err error)
func (JSONDocument) Search ¶
func (doc JSONDocument) Search(ctx *sql.Context) (path string, err error)
func (JSONDocument) Unmarshall ¶
func (doc JSONDocument) Unmarshall(_ *sql.Context) (JSONDocument, error)
type JSONValue ¶
type JSONValue interface { // Unmarshall converts a JSONValue to a JSONDocument Unmarshall(ctx *sql.Context) (val JSONDocument, err error) // Compare compares two JSONValues. It maintains the same return value // semantics as Type.Compare() Compare(ctx *sql.Context, v JSONValue) (cmp int, err error) // ToString marshalls a JSONValue to a valid JSON-encoded string. ToString(ctx *sql.Context) (string, error) }
JSONValue is an integrator specific implementation of a JSON field value.
type JsonType ¶
type JsonType struct{}
func (JsonType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
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) 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{}, 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() 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) 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{}, 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() 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) 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{}, 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() 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) 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{}, 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() 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 NumberTypeImpl_ ¶
type NumberTypeImpl_ struct {
// contains filtered or unexported fields
}
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{}, error)
Convert implements Type interface.
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() 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_) 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) 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) 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{}, 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() 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 SearchableJSONValue ¶
type SearchableJSONValue interface { JSONValue // Contains is value-specific implementation of JSON_Contains() Contains(ctx *sql.Context, candidate JSONValue) (val interface{}, err error) // Extract is value-specific implementation of JSON_Extract() Extract(ctx *sql.Context, path string) (val JSONValue, err error) // Keys is value-specific implementation of JSON_Keys() Keys(ctx *sql.Context, path string) (val JSONValue, err error) // Overlaps is value-specific implementation of JSON_Overlaps() Overlaps(ctx *sql.Context, val SearchableJSONValue) (ok bool, err error) // Search is value-specific implementation of JSON_Search() Search(ctx *sql.Context) (path string, err error) }
SearchableJSONValue is JSONValue supporting in-place access operations. The query engine can utilize these optimized access methods improve performance by minimizing the need to unmarshall a JSONValue into a JSONDocument.
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) Convert ¶
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) WithNewCollation ¶
WithNewCollation implements TypeWithCollation interface.
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) 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{}, 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() 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) 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_ ¶
type SystemBoolType_ struct {
// contains filtered or unexported fields
}
SystemBoolType_ is an internal boolean type ONLY for system variables.
func (SystemBoolType_) Compare ¶
func (t SystemBoolType_) Compare(a interface{}, b interface{}) (int, error)
Compare implements Type interface.
func (SystemBoolType_) Convert ¶
func (t SystemBoolType_) Convert(v interface{}) (interface{}, error)
Convert implements Type interface.
func (SystemBoolType_) DecodeValue ¶
func (t SystemBoolType_) DecodeValue(val string) (interface{}, error)
DecodeValue implements SystemVariableType interface.
func (SystemBoolType_) EncodeValue ¶
func (t SystemBoolType_) EncodeValue(val interface{}) (string, error)
EncodeValue implements SystemVariableType interface.
func (SystemBoolType_) Equals ¶
func (t SystemBoolType_) Equals(otherType sql.Type) bool
Equals implements the Type interface.
func (SystemBoolType_) MaxTextResponseByteLength ¶
func (t SystemBoolType_) MaxTextResponseByteLength() uint32
MaxTextResponseByteLength implements the Type interface
func (SystemBoolType_) MustConvert ¶
func (t SystemBoolType_) MustConvert(v interface{}) interface{}
MustConvert implements the Type interface.
func (SystemBoolType_) Promote ¶
func (t SystemBoolType_) Promote() sql.Type
Promote implements the Type interface.
func (SystemBoolType_) String ¶
func (t SystemBoolType_) String() string
String implements Type interface.
func (SystemBoolType_) Type ¶
func (t SystemBoolType_) Type() query.Type
Type implements Type interface.
func (SystemBoolType_) ValueType ¶
func (t SystemBoolType_) ValueType() reflect.Type
ValueType implements Type interface.
func (SystemBoolType_) Zero ¶
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_) 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{}, 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() 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) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
func (TupleType) MustConvert ¶
func (t TupleType) MustConvert(v interface{}) interface{}
type YearType_ ¶
type YearType_ struct{}
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
- geometry.go
- geometrycollection.go
- json.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
- 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