Documentation
¶
Index ¶
- Constants
- Variables
- func AreComparable(types ...Type) bool
- func CastSQLError(err error) *mysql.SQLError
- func ConvertToBool(v interface{}) (bool, error)
- func ConvertToString(v interface{}, t StringType) (string, error)
- func ConvertToTime(v interface{}, t datetimeType) (time.Time, error)
- func DBTableIter(ctx *Context, db Database, cb func(Table) (cont bool, err error)) error
- func DebugString(nodeOrExpression interface{}) string
- 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 Dispose(i interface{})
- func ErrIfMismatchedColumns(t1, t2 Type) error
- func ErrIfMismatchedColumnsInTuple(t1, t2 Type) error
- func EvaluateCondition(ctx *Context, cond Expression, row Row) (interface{}, error)
- func FormatRow(row Row) string
- func GetRangeCutKey(c RangeCut) interface{}
- func GetTableNameInsensitive(tblName string, tableNames []string) (string, bool)
- func GetTmpdirSessionVar() string
- func HasAvailableMemory(r Reporter) bool
- func HasDefaultValue(ctx *Context, s Session, key string) (bool, interface{})
- func HashOf(v Row) (uint64, error)
- func InitSystemVariables()
- func Inspect(expr Expression, f func(expr Expression) bool)
- func IsBinaryType(t Type) bool
- func IsByteType(t Type) bool
- func IsDecimal(t Type) bool
- func IsDeferredType(t Type) bool
- func IsEnum(t Type) bool
- func IsFalse(val interface{}) bool
- func IsFloat(t Type) bool
- func IsGeometry(t Type) bool
- func IsInteger(t Type) bool
- func IsJSON(t Type) bool
- func IsKeyless(s Schema) bool
- func IsNull(ex Expression) bool
- func IsNumber(t Type) bool
- func IsOkResult(row Row) bool
- func IsOkResultSchema(schema Schema) bool
- func IsSet(t Type) bool
- func IsSigned(t Type) bool
- func IsText(t Type) bool
- func IsTextBlob(t Type) bool
- func IsTextOnly(t Type) bool
- func IsTime(t Type) bool
- func IsTrue(val interface{}) bool
- func IsTuple(t Type) bool
- func IsUnsigned(t Type) bool
- func MustConvert(val interface{}, err error) interface{}
- func NewMapCache() mapCache
- func NewUniqueKeyErr(keyStr string, isPK bool, existing Row) error
- func NumColumns(t Type) int
- func NumericUnaryValue(t Type) interface{}
- func OrderedCuts(l, r RangeCut, typ Type) (RangeCut, RangeCut, error)
- func RangeCutIsBinding(c RangeCut) bool
- func RunWithNowFunc(nowFunc func() time.Time, fn func() error) error
- func TypesEqual(a, b Type) bool
- func UnwrapError(err error) error
- func ValidateTime(t time.Time) interface{}
- func Walk(v Visitor, expr Expression)
- func WalkWithNode(v NodeVisitor, n Node, expr Expression)
- func WriteEWKBHeader(buf []byte, srid, typ uint32)
- func WriteWKBHeader(buf []byte, typ uint32)
- type Above
- type AboveAll
- type AboveNull
- type Aggregation
- type AggregationBuffer
- type AlterableTable
- type AutoIncrementSetter
- type AutoIncrementTable
- type BackgroundThreads
- type BaseSession
- func (s *BaseSession) AddLock(lockName string) error
- func (s *BaseSession) Address() string
- func (s *BaseSession) ClearWarnings()
- func (s *BaseSession) Client() Client
- func (s *BaseSession) CommitTransaction(*Context, string, Transaction) error
- func (s *BaseSession) DelLock(lockName string) error
- func (s *BaseSession) GetAllSessionVariables() map[string]interface{}
- func (s *BaseSession) GetCharacterSet() CharacterSetID
- func (s *BaseSession) GetCharacterSetResults() CharacterSetID
- func (s *BaseSession) GetCollation() CollationID
- func (s *BaseSession) GetCurrentDatabase() string
- func (s *BaseSession) GetIgnoreAutoCommit() bool
- func (s *BaseSession) GetIndexRegistry() *IndexRegistry
- func (s *BaseSession) GetLastQueryInfo(key string) int64
- func (s *BaseSession) GetLogger() *logrus.Entry
- func (s *BaseSession) GetPrivilegeSet() (PrivilegeSet, uint64)
- func (s *BaseSession) GetQueriedDatabase() string
- func (s *BaseSession) GetSessionVariable(ctx *Context, sysVarName string) (interface{}, error)
- func (s *BaseSession) GetTransaction() Transaction
- func (s *BaseSession) GetUserVariable(ctx *Context, varName string) (Type, interface{}, error)
- func (s *BaseSession) GetViewRegistry() *ViewRegistry
- func (s *BaseSession) ID() uint32
- func (s *BaseSession) InitSessionVariable(ctx *Context, sysVarName string, value interface{}) error
- func (s *BaseSession) IterLocks(cb func(name string) error) error
- func (s *BaseSession) SetClient(c Client)
- func (s *BaseSession) SetConnectionId(id uint32)
- func (s *BaseSession) SetCurrentDatabase(dbName string)
- func (s *BaseSession) SetIgnoreAutoCommit(ignore bool)
- func (s *BaseSession) SetIndexRegistry(reg *IndexRegistry)
- func (s *BaseSession) SetLastQueryInfo(key string, value int64)
- func (s *BaseSession) SetLogger(logger *logrus.Entry)
- func (s *BaseSession) SetPrivilegeSet(newPs PrivilegeSet, counter uint64)
- func (s *BaseSession) SetQueriedDatabase(dbName string)
- func (s *BaseSession) SetSessionVariable(ctx *Context, sysVarName string, value interface{}) error
- func (s *BaseSession) SetTransaction(tx Transaction)
- func (s *BaseSession) SetUserVariable(ctx *Context, varName string, value interface{}) error
- func (s *BaseSession) SetViewRegistry(reg *ViewRegistry)
- func (s *BaseSession) ValidateSession(ctx *Context, dbName string) error
- func (s *BaseSession) Warn(warn *Warning)
- func (s *BaseSession) WarningCount() uint16
- func (s *BaseSession) Warnings() []*Warning
- type Below
- type BelowNull
- type BinaryNode
- type BitType
- type Catalog
- type CharacterSet
- type CharacterSetID
- func (cs CharacterSetID) BinaryCollation() CollationID
- func (cs CharacterSetID) DefaultCollation() CollationID
- func (cs CharacterSetID) Description() string
- func (cs CharacterSetID) Encoder() encodings.Encoder
- func (cs CharacterSetID) MaxLength() int64
- func (cs CharacterSetID) Name() string
- func (cs CharacterSetID) String() string
- type CharacterSetsIterator
- type CheckAlterableTable
- type CheckConstraint
- type CheckConstraints
- type CheckDefinition
- type CheckTable
- type Checksumable
- type Client
- type Closer
- type CollatedDatabase
- type CollatedDatabaseProvider
- type Collation
- type CollationID
- func (c CollationID) CharacterSet() CharacterSetID
- func (c CollationID) Collation() Collation
- func (c CollationID) Equals(other CollationID) bool
- func (c CollationID) HashToBytes(str string) ([]byte, error)
- func (c CollationID) HashToUint(str string) (uint64, error)
- func (c CollationID) IsCompiled() string
- func (c CollationID) IsDefault() string
- func (c CollationID) Name() string
- func (c CollationID) PadAttribute() string
- func (c CollationID) SortLength() int64
- func (c CollationID) Sorter() func(r rune) int32
- func (c CollationID) String() string
- func (c CollationID) WorksWithCharacterSet(cs CharacterSetID) bool
- type CollationsIterator
- type Column
- type ColumnDefaultValue
- func (e *ColumnDefaultValue) CheckType(ctx *Context) error
- func (e *ColumnDefaultValue) Children() []Expression
- func (e *ColumnDefaultValue) DebugString() string
- func (e *ColumnDefaultValue) Eval(ctx *Context, r Row) (interface{}, error)
- func (e *ColumnDefaultValue) IsLiteral() bool
- func (e *ColumnDefaultValue) IsNullable() bool
- func (e *ColumnDefaultValue) IsParenthesized() bool
- func (e *ColumnDefaultValue) Resolved() bool
- func (e *ColumnDefaultValue) String() string
- func (e *ColumnDefaultValue) Type() Type
- func (e *ColumnDefaultValue) WithChildren(children ...Expression) (Expression, error)
- type ColumnExpressionType
- type ColumnOrder
- type CommentedNode
- type Context
- func (c *Context) ApplyOpts(opts ...ContextOption)
- func (c *Context) Error(code int, msg string, args ...interface{})
- func (c *Context) KillConnection(connID uint32) error
- func (c *Context) LoadInfile(filename string) (io.ReadCloser, error)
- func (c *Context) NewCtxWithClient(client Client) *Context
- func (c *Context) NewErrgroup() (*errgroup.Group, *Context)
- func (c *Context) NewSubContext() (*Context, context.CancelFunc)
- func (c *Context) Pid() uint64
- func (c *Context) Query() string
- func (c *Context) QueryTime() time.Time
- func (c *Context) RootSpan() trace.Span
- func (c *Context) Span(opName string, opts ...trace.SpanStartOption) (trace.Span, *Context)
- func (c *Context) Warn(code int, msg string, args ...interface{})
- func (c *Context) WithContext(ctx context.Context) *Context
- func (c *Context) WithCurrentDB(db string) *Context
- func (c Context) WithQuery(q string) *Context
- type ContextOption
- func WithMemoryManager(m *MemoryManager) ContextOption
- func WithPid(pid uint64) ContextOption
- func WithProcessList(p ProcessList) ContextOption
- func WithQuery(q string) ContextOption
- func WithRootSpan(s trace.Span) ContextOption
- func WithServices(services Services) ContextOption
- func WithSession(s Session) ContextOption
- func WithTracer(t trace.Tracer) ContextOption
- type CreateFunc0Args
- type CreateFunc1Args
- type CreateFunc2Args
- type CreateFunc3Args
- type CreateFunc4Args
- type CreateFunc5Args
- type CreateFunc6Args
- type CreateFunc7Args
- type CreateFuncNArgs
- type Database
- type DatabaseProvider
- type Databaseable
- type Databaser
- type DatetimeType
- type DebugStringer
- type DecimalType
- type DeferredType
- type DeletableTable
- type Disposable
- type DisposeFunc
- type DriverIndex
- type DriverIndexLookup
- type DriverIndexableTable
- type EmptyProcessList
- func (e EmptyProcessList) AddPartitionProgress(pid uint64, tableName, partitionName string, total int64)
- func (e EmptyProcessList) AddProcess(ctx *Context, query string) (*Context, error)
- func (e EmptyProcessList) AddTableProgress(pid uint64, name string, total int64)
- func (e EmptyProcessList) Done(pid uint64)
- func (e EmptyProcessList) Kill(connID uint32)
- func (e EmptyProcessList) Processes() []Process
- func (e EmptyProcessList) RemovePartitionProgress(pid uint64, tableName, partitionName string)
- func (e EmptyProcessList) RemoveTableProgress(pid uint64, name string)
- func (e EmptyProcessList) UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64)
- func (e EmptyProcessList) UpdateTableProgress(pid uint64, name string, delta int64)
- type Engine
- type EnumType
- type Expression
- type Expression2
- type Expressioner
- type ExternalStoredProcedureDetails
- type ExternalStoredProcedureProvider
- type ExternalStoredProcedureRegistry
- func (epd *ExternalStoredProcedureRegistry) LookupByName(name string) ([]ExternalStoredProcedureDetails, error)
- func (epd *ExternalStoredProcedureRegistry) LookupByNameAndParamCount(name string, numOfParams int) (*ExternalStoredProcedureDetails, error)
- func (epd *ExternalStoredProcedureRegistry) Register(procedureDetails ExternalStoredProcedureDetails)
- type FastIntSet
- func (s *FastIntSet) Add(i int)
- func (s *FastIntSet) AddRange(from, to int)
- func (s FastIntSet) Contains(i int) bool
- func (s FastIntSet) Copy() FastIntSet
- func (s *FastIntSet) CopyFrom(c FastIntSet)
- func (s FastIntSet) Difference(rhs FastIntSet) FastIntSet
- func (s *FastIntSet) DifferenceWith(rhs FastIntSet)
- func (s FastIntSet) Empty() bool
- func (s FastIntSet) Equals(rhs FastIntSet) bool
- func (s FastIntSet) ForEach(f func(i int))
- func (s FastIntSet) Intersection(rhs FastIntSet) FastIntSet
- func (s *FastIntSet) IntersectionWith(rhs FastIntSet)
- func (s FastIntSet) Intersects(rhs FastIntSet) bool
- func (s FastIntSet) Len() int
- func (s FastIntSet) Next(startVal int) (int, bool)
- func (s FastIntSet) Ordered() []int
- func (s *FastIntSet) Remove(i int)
- func (s *FastIntSet) Shift(delta int) FastIntSet
- func (s FastIntSet) String() string
- func (s FastIntSet) SubsetOf(rhs FastIntSet) bool
- func (s FastIntSet) Union(rhs FastIntSet) FastIntSet
- func (s *FastIntSet) UnionWith(rhs FastIntSet)
- type FilteredIndex
- type FilteredTable
- type ForeignKeyConstraint
- type ForeignKeyReferentialAction
- type ForeignKeyTable
- type ForeignKeyUpdater
- type Freeable
- type Function
- type Function0
- type Function1
- type Function2
- type Function3
- type Function4
- type Function5
- type Function6
- type Function7
- type FunctionExpression
- type FunctionN
- type FunctionProvider
- type Generator
- type GeomColl
- 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 Type) bool
- func (t GeomCollType) GetSpatialTypeSRID() (uint32, bool)
- func (t GeomCollType) MatchSRID(v interface{}) error
- func (t GeomCollType) MaxTextResponseByteLength() uint32
- func (t GeomCollType) Promote() Type
- func (t GeomCollType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t GeomCollType) SetSRID(v uint32) 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 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() Type
- func (t GeometryType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t GeometryType) SetSRID(v uint32) 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 Histogram
- type HistogramBucket
- type HistogramMap
- type IgnorableError
- type Index
- type IndexAddressable
- type IndexAddressableTable
- type IndexAlterableTable
- type IndexBuilder
- func (b *IndexBuilder) Build(ctx *Context) (IndexLookup, error)
- func (b *IndexBuilder) Equals(ctx *Context, colExpr string, keys ...interface{}) *IndexBuilder
- func (b *IndexBuilder) GreaterOrEqual(ctx *Context, colExpr string, key interface{}) *IndexBuilder
- func (b *IndexBuilder) GreaterThan(ctx *Context, colExpr string, key interface{}) *IndexBuilder
- func (b *IndexBuilder) IsNotNull(ctx *Context, colExpr string) *IndexBuilder
- func (b *IndexBuilder) IsNull(ctx *Context, colExpr string) *IndexBuilder
- func (b *IndexBuilder) LessOrEqual(ctx *Context, colExpr string, key interface{}) *IndexBuilder
- func (b *IndexBuilder) LessThan(ctx *Context, colExpr string, key interface{}) *IndexBuilder
- func (b *IndexBuilder) NotEquals(ctx *Context, colExpr string, key interface{}) *IndexBuilder
- func (b *IndexBuilder) Ranges(ctx *Context) RangeCollection
- type IndexColumn
- type IndexConstraint
- type IndexDef
- type IndexDriver
- type IndexKeyValueIter
- type IndexLookup
- type IndexOrder
- type IndexRegistry
- func (r *IndexRegistry) AddIndex(idx DriverIndex) (created chan<- struct{}, ready <-chan struct{}, err error)
- func (r *IndexRegistry) CanRemoveIndex(idx Index) bool
- func (r *IndexRegistry) CanUseIndex(idx Index) bool
- func (r *IndexRegistry) DefaultIndexDriver() IndexDriver
- func (r *IndexRegistry) DeleteIndex(db, id string, force bool) (<-chan struct{}, error)
- func (r *IndexRegistry) ExpressionsWithIndexes(db string, exprs ...Expression) [][]Expression
- func (r *IndexRegistry) HasIndexes() bool
- func (r *IndexRegistry) Index(db, id string) DriverIndex
- func (r *IndexRegistry) IndexDriver(id string) IndexDriver
- func (r *IndexRegistry) IndexesByTable(db, table string) []DriverIndex
- func (r *IndexRegistry) LoadIndexes(ctx *Context, dbs []Database) error
- func (r *IndexRegistry) MarkOutdated(idx Index)
- func (r *IndexRegistry) MatchingIndex(ctx *Context, db string, expr ...Expression) (index Index, prefixCount int, err error)
- func (r *IndexRegistry) RegisterIndexDriver(driver IndexDriver)
- func (r *IndexRegistry) ReleaseIndex(idx Index)
- type IndexStatus
- type IndexUsing
- type IndexValueIter
- type IndexedTable
- type IndexedTableCreator
- type InsertableTable
- type JSONDocument
- func (doc JSONDocument) Compare(ctx *Context, v JSONValue) (int, error)
- func (doc JSONDocument) Contains(ctx *Context, candidate JSONValue) (val interface{}, err error)
- func (doc JSONDocument) Extract(ctx *Context, path string) (JSONValue, error)
- func (doc JSONDocument) Keys(ctx *Context, path string) (val JSONValue, err error)
- func (doc JSONDocument) Overlaps(ctx *Context, val SearchableJSONValue) (ok bool, err error)
- func (doc JSONDocument) Search(ctx *Context) (path string, err error)
- func (doc JSONDocument) ToString(_ *Context) (string, error)
- func (doc JSONDocument) Unmarshall(_ *Context) (JSONDocument, error)
- func (doc JSONDocument) Value() (driver.Value, error)
- type JSONValue
- type JsonType
- type KeyValueCache
- 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 Type) bool
- func (t LineStringType) GetSpatialTypeSRID() (uint32, bool)
- func (t LineStringType) MatchSRID(v interface{}) error
- func (t LineStringType) MaxTextResponseByteLength() uint32
- func (t LineStringType) Promote() Type
- func (t LineStringType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t LineStringType) SetSRID(v uint32) Type
- func (t LineStringType) String() string
- func (t LineStringType) Type() query.Type
- func (t LineStringType) ValueType() reflect.Type
- func (t LineStringType) Zero() interface{}
- type LockState
- type LockSubsystem
- type Lockable
- type MemoryManager
- func (m *MemoryManager) Free()
- func (m *MemoryManager) HasAvailable() bool
- func (m *MemoryManager) NewHistoryCache() (KeyValueCache, DisposeFunc)
- func (m *MemoryManager) NewLRUCache(size uint) (KeyValueCache, DisposeFunc)
- func (m *MemoryManager) NewRows2Cache() (Rows2Cache, DisposeFunc)
- func (m *MemoryManager) NewRowsCache() (RowsCache, DisposeFunc)
- func (m *MemoryManager) NumCaches() int
- type MultiDatabaser
- type MultiLineString
- 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 Type) bool
- func (t MultiLineStringType) GetSpatialTypeSRID() (uint32, bool)
- func (t MultiLineStringType) MatchSRID(v interface{}) error
- func (t MultiLineStringType) MaxTextResponseByteLength() uint32
- func (t MultiLineStringType) Promote() Type
- func (t MultiLineStringType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t MultiLineStringType) SetSRID(v uint32) 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 Type) bool
- func (t MultiPointType) GetSpatialTypeSRID() (uint32, bool)
- func (t MultiPointType) MatchSRID(v interface{}) error
- func (t MultiPointType) MaxTextResponseByteLength() uint32
- func (t MultiPointType) Promote() Type
- func (t MultiPointType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t MultiPointType) SetSRID(v uint32) 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 Type) bool
- func (t MultiPolygonType) GetSpatialTypeSRID() (uint32, bool)
- func (t MultiPolygonType) MatchSRID(v interface{}) error
- func (t MultiPolygonType) MaxTextResponseByteLength() uint32
- func (t MultiPolygonType) Promote() Type
- func (t MultiPolygonType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t MultiPolygonType) SetSRID(v uint32) Type
- func (t MultiPolygonType) String() string
- func (t MultiPolygonType) Type() query.Type
- func (t MultiPolygonType) ValueType() reflect.Type
- func (t MultiPolygonType) Zero() interface{}
- type MutableDatabaseProvider
- type Nameable
- type Node
- type Node2
- type NodeVisitor
- type NonDeterministicExpression
- type NullOrdering
- type NullType
- type NumberType
- type OkResult
- type OpaqueNode
- type OrderedIndex
- type Partition
- type PartitionCounter
- type PartitionIndexKeyValueIter
- type PartitionIter
- type PartitionProgress
- type PersistableSession
- 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 Type) bool
- func (t PointType) GetSpatialTypeSRID() (uint32, bool)
- func (t PointType) MatchSRID(v interface{}) error
- func (t PointType) MaxTextResponseByteLength() uint32
- func (t PointType) Promote() Type
- func (t PointType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t PointType) SetSRID(v uint32) 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 Type) bool
- func (t PolygonType) GetSpatialTypeSRID() (uint32, bool)
- func (t PolygonType) MatchSRID(v interface{}) error
- func (t PolygonType) MaxTextResponseByteLength() uint32
- func (t PolygonType) Promote() Type
- func (t PolygonType) SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error)
- func (t PolygonType) SetSRID(v uint32) Type
- func (t PolygonType) String() string
- func (t PolygonType) Type() query.Type
- func (t PolygonType) ValueType() reflect.Type
- func (t PolygonType) Zero() interface{}
- type PrimaryKeyAlterableTable
- type PrimaryKeySchema
- type PrimaryKeySchemaTarget
- type PrimaryKeyTable
- type PrivilegeSet
- type PrivilegeSetColumn
- type PrivilegeSetDatabase
- type PrivilegeSetTable
- type PrivilegeType
- type PrivilegedOperation
- type PrivilegedOperationChecker
- type Process
- type ProcessList
- type Progress
- type ProjectedTable
- type Projector
- type Range
- func (rang Range) AsEmpty() Range
- func (rang Range) Compare(otherRange Range) (int, error)
- func (rang Range) Copy() Range
- func (rang Range) DebugString() string
- func (rang Range) Equals(otherRange Range) (bool, error)
- func (rang Range) ExpressionByColumnName(idx Index, colExpr string) (RangeColumnExpr, bool)
- func (rang Range) Intersect(otherRange Range) (Range, error)
- func (rang Range) IsConnected(otherRange Range) (bool, error)
- func (rang Range) IsEmpty() (bool, error)
- func (rang Range) IsSubsetOf(otherRange Range) (bool, error)
- func (rang Range) IsSupersetOf(otherRange Range) (bool, error)
- func (rang Range) Overlaps(otherRange Range) (bool, error)
- func (rang Range) RemoveOverlap(otherRange Range) (RangeCollection, bool, error)
- func (rang Range) String() string
- func (rang Range) TryMerge(otherRange Range) (Range, bool, error)
- type RangeBoundType
- type RangeCollection
- type RangeColumnExpr
- func AllRangeColumnExpr(typ Type) RangeColumnExpr
- func ClosedRangeColumnExpr(lower, upper interface{}, typ Type) RangeColumnExpr
- func CustomRangeColumnExpr(lower, upper interface{}, lowerBound, upperBound RangeBoundType, typ Type) RangeColumnExpr
- func EmptyRangeColumnExpr(typ Type) RangeColumnExpr
- func GreaterOrEqualRangeColumnExpr(lower interface{}, typ Type) RangeColumnExpr
- func GreaterThanRangeColumnExpr(lower interface{}, typ Type) RangeColumnExpr
- func LessOrEqualRangeColumnExpr(upper interface{}, typ Type) RangeColumnExpr
- func LessThanRangeColumnExpr(upper interface{}, typ Type) RangeColumnExpr
- func NotNullRangeColumnExpr(typ Type) RangeColumnExpr
- func NullRangeColumnExpr(typ Type) RangeColumnExpr
- func OpenRangeColumnExpr(lower, upper interface{}, typ Type) RangeColumnExpr
- func SimplifyRangeColumn(rces ...RangeColumnExpr) ([]RangeColumnExpr, error)
- func (r RangeColumnExpr) DebugString() string
- func (r RangeColumnExpr) Equals(other RangeColumnExpr) (bool, error)
- func (r RangeColumnExpr) HasLowerBound() bool
- func (r RangeColumnExpr) HasUpperBound() bool
- func (r RangeColumnExpr) IsConnected(other RangeColumnExpr) (bool, error)
- func (r RangeColumnExpr) IsEmpty() (bool, error)
- func (r RangeColumnExpr) IsSubsetOf(other RangeColumnExpr) (bool, error)
- func (r RangeColumnExpr) IsSupersetOf(other RangeColumnExpr) (bool, error)
- func (r RangeColumnExpr) Overlaps(other RangeColumnExpr) (RangeColumnExpr, bool, error)
- func (r RangeColumnExpr) RepresentsEquals() (bool, error)
- func (r RangeColumnExpr) String() string
- func (r RangeColumnExpr) Subtract(other RangeColumnExpr) ([]RangeColumnExpr, error)
- func (r RangeColumnExpr) TryIntersect(other RangeColumnExpr) (RangeColumnExpr, bool, error)
- func (r RangeColumnExpr) TryUnion(other RangeColumnExpr) (RangeColumnExpr, bool, error)
- func (r RangeColumnExpr) Type() RangeType
- type RangeColumnExprTree
- func (tree *RangeColumnExprTree) FindConnections(rang Range, colExprIdx int) (RangeCollection, error)
- func (tree *RangeColumnExprTree) GetRangeCollection() (RangeCollection, error)
- func (tree *RangeColumnExprTree) Insert(rang Range) error
- func (tree *RangeColumnExprTree) Iterator() *rangeTreeIter
- func (tree *RangeColumnExprTree) Remove(rang Range) error
- func (tree *RangeColumnExprTree) String() string
- type RangeCut
- type RangeType
- type ReadOnlyDatabase
- type ReplaceableTable
- type Reporter
- type Resolvable
- type RewritableTable
- type Row
- type Row2
- type RowDeleter
- type RowFrame
- type RowInserter
- type RowIter
- type RowIter2
- type RowIterTypeSelector
- type RowReplacer
- type RowUpdater
- type Rows2Cache
- type RowsCache
- type Schema
- func (s Schema) CheckRow(row Row) error
- func (s Schema) Contains(column string, source string) bool
- func (s Schema) Copy() Schema
- func (s Schema) Equals(s2 Schema) bool
- func (s Schema) HasAutoIncrement() bool
- func (s Schema) IndexOf(column, source string) int
- func (s Schema) IndexOfColName(column string) int
- type SchemaTarget
- type SearchableJSONValue
- type Services
- type Session
- type SetType
- type SortField
- type SortFields
- type SortOrder
- type SpatialColumnType
- type StatisticsTable
- type StoredProcedureDatabase
- type StoredProcedureDetails
- type StringType
- func CreateBinary(baseType query.Type, lengthHint int64) (StringType, error)
- func CreateLongText(collation CollationID) StringType
- func CreateMediumText(collation CollationID) StringType
- func CreateString(baseType query.Type, length int64, collation CollationID) (StringType, error)
- func CreateStringWithDefaults(baseType query.Type, length int64) (StringType, error)
- func CreateText(collation CollationID) StringType
- func CreateTinyText(collation CollationID) StringType
- func MustCreateBinary(baseType query.Type, lengthHint int64) StringType
- func MustCreateString(baseType query.Type, length int64, collation CollationID) StringType
- func MustCreateStringWithDefaults(baseType query.Type, length int64) StringType
- type SystemVariable
- type SystemVariableScope
- type SystemVariableType
- func NewSystemBoolType(varName string) SystemVariableType
- func NewSystemDoubleType(varName string, lowerbound, upperbound float64) SystemVariableType
- func NewSystemEnumType(varName string, values ...string) SystemVariableType
- func NewSystemIntType(varName string, lowerbound, upperbound int64, negativeOne bool) SystemVariableType
- func NewSystemSetType(varName string, values ...string) SystemVariableType
- func NewSystemStringType(varName string) SystemVariableType
- func NewSystemUintType(varName string, lowerbound, upperbound uint64) SystemVariableType
- type Table
- type Table2
- type TableCopierDatabase
- type TableCreator
- type TableDropper
- type TableEditor
- type TableFunction
- type TableFunctionProvider
- type TableProgress
- type TableRenamer
- type TableRowIter
- type TableStatistics
- type TableWrapper
- type Tableable
- type TemporaryTable
- type TemporaryTableCreator
- type TemporaryTableDatabase
- 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 Transaction
- type TransactionCharacteristic
- type TransactionDatabase
- type TreePrinter
- type TriggerDatabase
- type TriggerDefinition
- type TruncateableTable
- type TupleType
- func (t TupleType) Compare(a, b interface{}) (int, error)
- func (t TupleType) Convert(v interface{}) (interface{}, error)
- func (t TupleType) Equals(otherType Type) bool
- func (t TupleType) MaxTextResponseByteLength() uint32
- func (t TupleType) MustConvert(v interface{}) interface{}
- func (t TupleType) Promote() Type
- func (t TupleType) 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 Type
- type Type2
- type TypeWithCollation
- type TypedValue
- type UnaryNode
- type UniqueKeyError
- type UnresolvedColumnDefault
- func (u UnresolvedColumnDefault) Children() []Expression
- func (u UnresolvedColumnDefault) Eval(ctx *Context, row Row) (interface{}, error)
- func (u UnresolvedColumnDefault) IsNullable() bool
- func (u UnresolvedColumnDefault) Resolved() bool
- func (u UnresolvedColumnDefault) String() string
- func (u UnresolvedColumnDefault) Type() Type
- func (u UnresolvedColumnDefault) WithChildren(children ...Expression) (Expression, error)
- type UnresolvedDatabase
- type UnresolvedTable
- type UnsupportedFunctionStub
- type UpdatableTable
- type Value
- type ValueBytes
- type VersionedDatabase
- type View
- type ViewDatabase
- type ViewDefinition
- type ViewKey
- type ViewRegistry
- func (r *ViewRegistry) Delete(databaseName, viewName string) error
- func (r *ViewRegistry) Exists(databaseName, viewName string) bool
- func (r *ViewRegistry) Register(database string, view *View) error
- func (r *ViewRegistry) View(databaseName, viewName string) (*View, bool)
- func (r *ViewRegistry) ViewsInDatabase(databaseName string) (views []*View)
- type Visitor
- type Warning
- type WindowAdaptableExpression
- type WindowAggregation
- type WindowBuffer
- type WindowDefinition
- type WindowFrame
- type WindowFramer
- type WindowFunction
- type WindowInterval
- type WrappedInsertError
- type WrappedTypeConversionError
- type YearType
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 ( // DateLayout is the layout of the MySQL date format in the representation // Go understands. DateLayout = "2006-01-02" // TimestampDatetimeLayout is the formatting string with the layout of the timestamp // using the format of Go "time" package. TimestampDatetimeLayout = "2006-01-02 15:04:05.999999" )
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 ( ConnectionIdLogField = "connectionID" ConnectionDbLogField = "connectionDb" ConnectTimeLogKey = "connectTime" )
const ( // Numeric representation of False as defined by MySQL. False = int8(0) // Numeric representation of True as defined by MySQL. True = int8(1) )
const ( CurrentDBSessionVar = "current_database" AutoCommitSessionVar = "autocommit" )
const ( RowCount = "row_count" FoundRows = "found_rows" LastInsertId = "last_insert_id" )
const ChecksumKey = "checksum"
ChecksumKey is the key in an index config to store the checksum.
const IndexBatchSize = uint64(10000)
IndexBatchSize is the number of rows to save at a time when creating indexes.
const OkResultColumnName = "__ok_result__"
OkResultColumnName should be used as the schema column name for Nodes that return an OkResult
const ( // QueryKey to access query in the context. QueryKey key = iota )
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 ( ErrConvertingToEnum = errors.NewKind("value %v is not valid for this Enum") ErrUnmarshallingEnum = errors.NewKind("value %v is not a marshalled value for this Enum") ErrTemporaryEnum = errors.NewKind("attempted to use temporary enum") )
var ( // ErrSyntaxError is returned when a syntax error in vitess is encountered. ErrSyntaxError = errors.NewKind("%s") // ErrUnsupportedFeature is thrown when a feature is not already supported ErrUnsupportedFeature = errors.NewKind("unsupported feature: %s") // ErrReadOnly is returned when the engine has been set to Read Only but a write operation was attempted. ErrReadOnly = errors.NewKind("database server is set to read only mode") // ErrInvalidSystemVariableValue is returned when a system variable is assigned a value that it does not accept. ErrInvalidSystemVariableValue = errors.NewKind("Variable '%s' can't be set to the value of '%v'") // ErrSystemVariableCodeFail is returned when failing to encode/decode a system variable. ErrSystemVariableCodeFail = errors.NewKind("unable to encode/decode value '%v' for '%s'") // ErrInvalidType is thrown when there is an unexpected type at some part of // the execution tree. ErrInvalidType = errors.NewKind("invalid type: %s") // ErrTableAlreadyExists is thrown when someone tries to create a // table with a name of an existing one ErrTableAlreadyExists = errors.NewKind("table with name %s already exists") // ErrTableNotFound is returned when the table is not available from the // current scope. ErrTableNotFound = errors.NewKind("table not found: %s") // ErrTableColumnNotFound is thrown when a column named cannot be found in scope ErrTableColumnNotFound = errors.NewKind("table %q does not have column %q") // ErrColumnNotFound is returned when the column does not exist in any // table in scope. ErrColumnNotFound = errors.NewKind("column %q could not be found in any table in scope") // ErrAmbiguousColumnName is returned when there is a column reference that // is present in more than one table. ErrAmbiguousColumnName = errors.NewKind("ambiguous column name %q, it's present in all these tables: %v") // ErrAmbiguousColumnOrAliasName is returned when a column or alias name can't be qualified to a table or alias definition ErrAmbiguousColumnOrAliasName = errors.NewKind("ambiguous column or alias name %q") // ErrAmbiguousColumnInOrderBy is returned when an order by column is ambiguous ErrAmbiguousColumnInOrderBy = errors.NewKind("Column %q in order clause is ambiguous") // ErrColumnExists is returned when an ALTER TABLE statement would create a duplicate column ErrColumnExists = errors.NewKind("Column %q already exists") // ErrCreateTableNotSupported is thrown when the database doesn't support table creation ErrCreateTableNotSupported = errors.NewKind("tables cannot be created on database %s") // ErrDropTableNotSupported is thrown when the database doesn't support dropping tables ErrDropTableNotSupported = errors.NewKind("tables cannot be dropped on database %s") // ErrRenameTableNotSupported is thrown when the database doesn't support renaming tables ErrRenameTableNotSupported = errors.NewKind("tables cannot be renamed on database %s") // ErrDatabaseCollationsNotSupported is thrown when a database does not allow updating its collation ErrDatabaseCollationsNotSupported = errors.NewKind("database %s does not support collation operations") // ErrTableCreatedNotFound is thrown when a table is created from CREATE TABLE but cannot be found immediately afterward ErrTableCreatedNotFound = errors.NewKind("table was created but could not be found") // ErrUnexpectedRowLength is thrown when the obtained row has more columns than the schema ErrUnexpectedRowLength = errors.NewKind("expected %d values, got %d") // ErrInvalidChildrenNumber is returned when the WithChildren method of a // node or expression is called with an invalid number of arguments. ErrInvalidChildrenNumber = errors.NewKind("%T: invalid children number, got %d, expected %d") // ErrInvalidExpressionNumber is returned when the WithExpression method of a node // is called with an invalid number of arguments. ErrInvalidExpressionNumber = errors.NewKind("%T: invalid expression number, got %d, expected %d") // ErrInvalidChildType is returned when the WithChildren method of a // node or expression is called with an invalid child type. This error is indicative of a bug. ErrInvalidChildType = errors.NewKind("%T: invalid child type, got %T, expected %T") // ErrInvalidJSONText is returned when a JSON string cannot be parsed or unmarshalled ErrInvalidJSONText = errors.NewKind("Invalid JSON text: %s") // ErrDeleteRowNotFound ErrDeleteRowNotFound = errors.NewKind("row was not found when attempting to delete") // ErrDuplicateAlias should be returned when a query contains a duplicate alias / table name. ErrDuplicateAliasOrTable = errors.NewKind("Not unique table/alias: %s") // ErrPrimaryKeyViolation is returned when a primary key constraint is violated // This is meant to wrap a sql.UniqueKey error, which provides the key string ErrPrimaryKeyViolation = errors.NewKind("duplicate primary key given") // ErrUniqueKeyViolation is returned when a unique key constraint is violated // This is meant to wrap a sql.UniqueKey error, which provides the key string ErrUniqueKeyViolation = errors.NewKind("duplicate unique key given") // ErrMisusedAlias is returned when a alias is defined and used in the same projection. ErrMisusedAlias = errors.NewKind("column %q does not exist in scope, but there is an alias defined in" + " this projection with that name. Aliases cannot be used in the same projection they're defined in") // ErrInvalidAsOfExpression is returned when an expression for AS OF cannot be used ErrInvalidAsOfExpression = errors.NewKind("expression %s cannot be used in AS OF") // ErrIncompatibleDefaultType is returned when a provided default cannot be coerced into the type of the column ErrIncompatibleDefaultType = errors.NewKind("incompatible type for default value") // ErrInvalidTextBlobColumnDefault is returned when a column of type text/blob (or related) has a literal default set. ErrInvalidTextBlobColumnDefault = errors.NewKind("TEXT, BLOB, GEOMETRY, and JSON types may only have expression default values") // ErrInvalidColumnDefaultFunction is returned when an invalid function is used in a default value. ErrInvalidColumnDefaultFunction = errors.NewKind("function `%s` on column `%s` is not valid for usage in a default value") // ErrColumnDefaultDatetimeOnlyFunc is returned when a non datetime/timestamp column attempts to declare now/current_timestamp as a default value literal. ErrColumnDefaultDatetimeOnlyFunc = errors.NewKind("only datetime/timestamp may declare default values of now()/current_timestamp() without surrounding parentheses") // ErrColumnDefaultSubquery is returned when a default value contains a subquery. ErrColumnDefaultSubquery = errors.NewKind("default value on column `%s` may not contain subqueries") // ErrInvalidColumnDefaultValue is returned when column default function value is not wrapped in parentheses for column types excluding datetime and timestamp ErrInvalidColumnDefaultValue = errors.NewKind("Invalid default value for '%s'") // ErrInvalidDefaultValueOrder is returned when a default value references a column that comes after it and contains a default expression. ErrInvalidDefaultValueOrder = errors.NewKind(`default value of column "%s" cannot refer to a column defined after it if those columns have an expression default value`) // ErrColumnDefaultReturnedNull is returned when a default expression evaluates to nil but the column is non-nullable. ErrColumnDefaultReturnedNull = errors.NewKind(`default value attempted to return null but column is non-nullable`) // ErrDropColumnReferencedInDefault is returned when a column cannot be dropped as it is referenced by another column's default value. ErrDropColumnReferencedInDefault = errors.NewKind(`cannot drop column "%s" as default value of column "%s" references it`) // ErrTriggersNotSupported is returned when attempting to create a trigger on a database that doesn't support them ErrTriggersNotSupported = errors.NewKind(`database "%s" doesn't support triggers`) // ErrTriggerCreateStatementInvalid is returned when a TriggerDatabase returns a CREATE TRIGGER statement that is invalid ErrTriggerCreateStatementInvalid = errors.NewKind(`Invalid CREATE TRIGGER statement: %s`) // ErrTriggerDoesNotExist is returned when a trigger does not exist. ErrTriggerDoesNotExist = errors.NewKind(`trigger "%s" does not exist`) // ErrTriggerTableInUse is returned when trigger execution calls for a table that invoked a trigger being updated by it ErrTriggerTableInUse = errors.NewKind("Can't update table %s in stored function/trigger because it is already used by statement which invoked this stored function/trigger") // ErrTriggerCannotBeDropped is returned when dropping a trigger would cause another trigger to reference a non-existent trigger. ErrTriggerCannotBeDropped = errors.NewKind(`trigger "%s" cannot be dropped as it is referenced by trigger "%s"`) // ErrStoredProceduresNotSupported is returned when attempting to create a stored procedure on a database that doesn't support them. ErrStoredProceduresNotSupported = errors.NewKind(`database "%s" doesn't support stored procedures`) // ErrTriggerDoesNotExist is returned when a stored procedure does not exist. ErrStoredProcedureAlreadyExists = errors.NewKind(`stored procedure "%s" already exists`) // ErrTriggerDoesNotExist is returned when a stored procedure does not exist. ErrStoredProcedureDoesNotExist = errors.NewKind(`stored procedure "%s" does not exist`) // ErrProcedureCreateStatementInvalid is returned when a StoredProcedureDatabase returns a CREATE PROCEDURE statement that is invalid. ErrProcedureCreateStatementInvalid = errors.NewKind(`Invalid CREATE PROCEDURE statement: %s`) // ErrProcedureRecursiveCall is returned when a stored procedure has a CALL statement that refers to itself. ErrProcedureRecursiveCall = errors.NewKind("recursive CALL on stored procedure `%s`") // ErrProcedureInvalidBodyStatement is returned when a stored procedure has a statement that is invalid inside of procedures. ErrProcedureInvalidBodyStatement = errors.NewKind("`%s` statements are invalid inside of stored procedures") // ErrExternalProcedureAmbiguousOverload is returned when an external stored procedure is overloaded and has two // functions with the same number of parameters. ErrExternalProcedureAmbiguousOverload = errors.NewKind("overloaded stored procedure `%s` may only have a single variant with `%d` parameters") // ErrExternalProcedureNonFunction is returned when an external stored procedure is given something other than the // expected function type. ErrExternalProcedureNonFunction = errors.NewKind("received `%T` in place of a function for an external stored procedure") // ErrExternalProcedureMissingContextParam is returned when an external stored procedure's first parameter is not // the context. ErrExternalProcedureMissingContextParam = errors.NewKind("external stored procedures require the first parameter to be the context") // ErrExternalProcedurePointerVariadic is returned when an external stored procedure's variadic parameter has a pointer type. ErrExternalProcedurePointerVariadic = errors.NewKind("an external stored procedures's variadiac parameter may not have a pointer type") // ErrExternalProcedureReturnTypes is returned when an external stored procedure's return types are incorrect. ErrExternalProcedureReturnTypes = errors.NewKind("external stored procedures must return a RowIter and error") // ErrExternalProcedureFirstReturn is returned when an external stored procedure's first return type is incorrect. ErrExternalProcedureFirstReturn = errors.NewKind("external stored procedures require the first return value to be the RowIter") // ErrExternalProcedureSecondReturn is returned when an external stored procedure's second return type is incorrect. ErrExternalProcedureSecondReturn = errors.NewKind("external stored procedures require the second return value to be the error") // ErrExternalProcedureInvalidParamType is returned when one of an external stored procedure's parameters have an // invalid type. ErrExternalProcedureInvalidParamType = errors.NewKind("external stored procedures do not support parameters with type `%s`") // ErrCallIncorrectParameterCount is returned when a CALL statement has the incorrect number of parameters. ErrCallIncorrectParameterCount = errors.NewKind("`%s` expected `%d` parameters but got `%d`") // ErrUnknownSystemVariable is returned when a query references a system variable that doesn't exist ErrUnknownSystemVariable = errors.NewKind(`Unknown system variable '%s'`) // ErrSystemVariableReadOnly is returned when attempting to set a value to a non-Dynamic system variable. ErrSystemVariableReadOnly = errors.NewKind(`Variable '%s' is a read only variable`) ErrSystemVariableReinitialized = errors.NewKind(`Variable '%s' was initialized more than 1x`) // ErrSystemVariableSessionOnly is returned when attempting to set a SESSION-only variable using SET GLOBAL. ErrSystemVariableSessionOnly = errors.NewKind(`Variable '%s' is a SESSION variable and can't be used with SET GLOBAL`) // ErrSystemVariableGlobalOnly is returned when attempting to set a GLOBAL-only variable using SET SESSION. ErrSystemVariableGlobalOnly = errors.NewKind(`Variable '%s' is a GLOBAL variable and should be set with SET GLOBAL`) // ErrUserVariableNoDefault is returned when attempting to set the default value on a user variable. ErrUserVariableNoDefault = errors.NewKind(`User variable '%s' does not have a default value`) // ErrInvalidUseOfOldNew is returned when a trigger attempts to make use of OLD or NEW references when they don't exist ErrInvalidUseOfOldNew = errors.NewKind("There is no %s row in on %s trigger") // ErrInvalidUpdateOfOldRow is returned when a trigger attempts to assign to an old row's value with SET ErrInvalidUpdateOfOldRow = errors.NewKind("Updating of old row is not allowed in trigger") // ErrInvalidUpdateInAfterTrigger is returned when a trigger attempts to assign to a new row in an AFTER trigger ErrInvalidUpdateInAfterTrigger = errors.NewKind("Updating of new row is not allowed in after trigger") // ErrUnknownColumn is returned when the given column is not found in referenced table ErrUnknownColumn = errors.NewKind("Unknown column '%s' in '%s'") // ErrUnboundPreparedStatementVariable is returned when a query is executed without a binding for one its variables. ErrUnboundPreparedStatementVariable = errors.NewKind(`unbound variable "%s" in query`) // ErrTruncateReferencedFromForeignKey is returned when a table is referenced in a foreign key and TRUNCATE is called on it. ErrTruncateReferencedFromForeignKey = errors.NewKind("cannot truncate table %s as it is referenced in foreign key %s on table %s") // ErrInvalidColTypeDefinition is returned when a column type-definition has argument violations. ErrInvalidColTypeDefinition = errors.NewKind("column %s type definition is invalid: %s") // ErrDatabaseExists is returned when CREATE DATABASE attempts to create a database that already exists. ErrDatabaseExists = errors.NewKind("can't create database %s; database exists") // ErrInvalidConstraintFunctionNotSupported is returned when a CONSTRAINT CHECK is called with an unsupported function expression. ErrInvalidConstraintFunctionNotSupported = errors.NewKind("Invalid constraint expression, function not supported: %s") // ErrInvalidConstraintSubqueryNotSupported is returned when a CONSTRAINT CHECK is called with a sub-query expression. ErrInvalidConstraintSubqueryNotSupported = errors.NewKind("Invalid constraint expression, sub-queries not supported: %s") // ErrCheckConstraintViolated is returned when a CONSTRAINT CHECK is called with a sub-query expression. ErrCheckConstraintViolated = errors.NewKind("Check constraint %q violated") // ErrCheckConstraintInvalidatedByColumnAlter is returned when an alter column statement would invalidate a check constraint. ErrCheckConstraintInvalidatedByColumnAlter = errors.NewKind("can't alter column %q because it would invalidate check constraint %q") // ErrColumnCountMismatch is returned when a view, derived table or common table expression has a declared column // list with a different number of columns than the schema of the table. ErrColumnCountMismatch = errors.NewKind("In definition of view, derived table or common table expression, SELECT list and column names list have different column counts") // ErrUuidUnableToParse is returned when a UUID is unable to be parsed. ErrUuidUnableToParse = errors.NewKind("unable to parse '%s' to UUID: %s") // ErrLoadDataCannotOpen is returned when a LOAD DATA operation is unable to open the file specified. ErrLoadDataCannotOpen = errors.NewKind("LOAD DATA is unable to open file: %s") // ErrLoadDataCharacterLength is returned when a symbol is of the wrong character length for a LOAD DATA operation. ErrLoadDataCharacterLength = errors.NewKind("%s must be 1 character long") // ErrJSONObjectAggNullKey is returned when JSON_OBJECTAGG is run on a table with NULL keys ErrJSONObjectAggNullKey = errors.NewKind("JSON documents may not contain NULL member names") // ErrDeclareConditionOrderInvalid is returned when a DECLARE ... CONDITION statement is at an invalid location. ErrDeclareConditionOrderInvalid = errors.NewKind("DECLARE ... CONDITION may only exist at the beginning of a BEGIN/END block") // ErrDeclareVariableOrderInvalid is returned when a DECLARE statement, for variables, is at an invalid location. ErrDeclareVariableOrderInvalid = errors.NewKind("DECLARE variables may only exist at the beginning of a BEGIN/END block") // ErrDeclareCursorOrderInvalid is returned when a DECLARE ... CURSOR statement is at an invalid location. ErrDeclareCursorOrderInvalid = errors.NewKind("DECLARE ... CURSOR may only exist at the beginning of a BEGIN/END block, following all variables and conditions") // ErrDeclareHandlerOrderInvalid is returned when a DECLARE ... HANDLER statement is at an invalid location. ErrDeclareHandlerOrderInvalid = errors.NewKind("DECLARE ... HANDLER may only exist at the beginning of a BEGIN/END block, following all variables, conditions, and cursors") // ErrDeclareConditionNotFound is returned when SIGNAL/RESIGNAL references a non-existent DECLARE CONDITION. ErrDeclareConditionNotFound = errors.NewKind("condition %s does not exist") // ErrDeclareConditionDuplicate is returned when a DECLARE CONDITION statement with the same name was declared in the current scope. ErrDeclareConditionDuplicate = errors.NewKind("duplicate condition '%s'") // ErrDeclareVariableDuplicate is returned when a DECLARE statement reuses an existing variable name in the current scope. ErrDeclareVariableDuplicate = errors.NewKind("duplicate variable '%s'") // ErrDeclareCursorDuplicate is returned when a DECLARE ... CURSOR statement reuses an existing name in the current scope. ErrDeclareCursorDuplicate = errors.NewKind("duplicate cursor '%s'") // ErrDeclareHandlerDuplicate is returned when a DECLARE ... HANDLER statement has a duplicate in the same block. ErrDeclareHandlerDuplicate = errors.NewKind("duplicate handler declared in the same block") // ErrDeclareHandlerUndo is returned when a DECLARE ... HANDLER statement has the UNDO action, which is currently unsupported. ErrDeclareHandlerUndo = errors.NewKind("DECLARE ... HANDLER does not support the UNDO action") // ErrLoopRedefinition is returned when a loop with the same label has already been declared in the current block. ErrLoopRedefinition = errors.NewKind("redefining label '%s'") // ErrLoopLabelNotFound is returned when a control flow statement references a non-existent loop. ErrLoopLabelNotFound = errors.NewKind("%s with no matching label: '%s'") // ErrCursorNotFound is returned when a CURSOR cannot be found. ErrCursorNotFound = errors.NewKind("cursor '%s' does not exist") // ErrCursorAlreadyOpen is returned when a CURSOR is already open. ErrCursorAlreadyOpen = errors.NewKind("cursor '%s' is already open") // ErrCursorNotOpen is returned when a CURSOR has not yet been opened. ErrCursorNotOpen = errors.NewKind("cursor '%s' is not open") // ErrFetchIncorrectCount is returned when a FETCH does not use the correct number of variables. ErrFetchIncorrectCount = errors.NewKind("incorrect number of FETCH variables") // ErrSignalOnlySqlState is returned when SIGNAL/RESIGNAL references a DECLARE CONDITION for a MySQL error code. ErrSignalOnlySqlState = errors.NewKind("SIGNAL/RESIGNAL can only use a condition defined with SQLSTATE") // ErrExpectedSingleRow is returned when a subquery executed in normal queries or aggregation function returns // more than 1 row without an attached IN clause. ErrExpectedSingleRow = errors.NewKind("the subquery returned more than 1 row") // ErrUnknownConstraint is returned when a DROP CONSTRAINT statement refers to a constraint that doesn't exist ErrUnknownConstraint = errors.NewKind("Constraint %q does not exist") // ErrInsertIntoNonNullableDefaultNullColumn is returned when an INSERT excludes a field which is non-nullable and has no default/autoincrement. ErrInsertIntoNonNullableDefaultNullColumn = errors.NewKind("Field '%s' doesn't have a default value") // ErrAlterTableNotSupported is thrown when the table doesn't support ALTER TABLE statements ErrAlterTableNotSupported = errors.NewKind("table %s cannot be altered") // ErrPartitionNotFound is thrown when a partition key on a table is not found ErrPartitionNotFound = errors.NewKind("partition not found %q") // ErrInsertIntoNonNullableProvidedNull is called when a null value is inserted into a non-nullable column ErrInsertIntoNonNullableProvidedNull = errors.NewKind("column name '%v' is non-nullable but attempted to set a value of null") // ErrForeignKeyChildViolation is called when a rows is added but there is no parent row, and a foreign key constraint fails. Add the parent row first. ErrForeignKeyChildViolation = errors.NewKind("cannot add or update a child row - Foreign key violation on fk: `%s`, table: `%s`, referenced table: `%s`, key: `%s`") // ErrForeignKeyParentViolation is called when a parent row that is deleted has children, and a foreign key constraint fails. Delete the children first. ErrForeignKeyParentViolation = errors.NewKind("cannot delete or update a parent row - Foreign key violation on fk: `%s`, table: `%s`, referenced table: `%s`, key: `%s`") // ErrForeignKeyColumnCountMismatch is called when the declared column and referenced column counts do not match. ErrForeignKeyColumnCountMismatch = errors.NewKind("the foreign key must reference an equivalent number of columns") // ErrForeignKeyColumnTypeMismatch is returned when the declared column's type and referenced column's type do not match. ErrForeignKeyColumnTypeMismatch = errors.NewKind("column type mismatch on `%s` and `%s`") // ErrForeignKeyNotResolved is called when an add or update is attempted on a foreign key that has not been resolved yet. ErrForeignKeyNotResolved = errors.NewKind("cannot add or update a child row: a foreign key constraint fails (`%s`.`%s`, CONSTRAINT `%s` FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`))") // ErrNoForeignKeySupport is returned when the table does not support FOREIGN KEY operations. ErrNoForeignKeySupport = errors.NewKind("the table does not support foreign key operations: %s") // ErrForeignKeyMissingColumns is returned when an ALTER TABLE ADD FOREIGN KEY statement does not provide any columns ErrForeignKeyMissingColumns = errors.NewKind("cannot create a foreign key without columns") // ErrForeignKeyDropColumn is returned when attempting to drop a column used in a foreign key ErrForeignKeyDropColumn = errors.NewKind("cannot drop column `%s` as it is used in foreign key `%s`") // ErrForeignKeyDropTable is returned when attempting to drop a table used in a foreign key ErrForeignKeyDropTable = errors.NewKind("cannot drop table `%s` as it is referenced in foreign key `%s`") // ErrForeignKeyDropIndex is returned when attempting to drop an index used in a foreign key when there are no other // indexes which may be used in its place. ErrForeignKeyDropIndex = errors.NewKind("cannot drop index: `%s` is used by foreign key `%s`") // ErrForeignKeyDuplicateName is returned when a foreign key already exists with the given name. ErrForeignKeyDuplicateName = errors.NewKind("duplicate foreign key constraint name `%s`") // ErrAddForeignKeyDuplicateColumn is returned when an ALTER TABLE ADD FOREIGN KEY statement has the same column multiple times ErrAddForeignKeyDuplicateColumn = errors.NewKind("cannot have duplicates of columns in a foreign key: `%v`") // ErrTemporaryTablesForeignKeySupport is returned when a user tries to create a temporary table with a foreign key ErrTemporaryTablesForeignKeySupport = errors.NewKind("temporary tables do not support foreign keys") // ErrForeignKeyNotFound is returned when a foreign key was not found. ErrForeignKeyNotFound = errors.NewKind("foreign key `%s` was not found on the table `%s`") // ErrForeignKeySetDefault is returned when attempting to set a referential action as SET DEFAULT. ErrForeignKeySetDefault = errors.NewKind(`"SET DEFAULT" is not supported`) // ErrForeignKeySetNullNonNullable is returned when attempting to set a referential action as SET NULL when the // column is non-nullable. ErrForeignKeySetNullNonNullable = errors.NewKind("cannot use SET NULL as column `%s` is non-nullable") // ErrForeignKeyTypeChangeSetNull is returned when attempting to change a column's type to disallow NULL values when // a foreign key referential action is SET NULL. ErrForeignKeyTypeChangeSetNull = errors.NewKind("column `%s` must allow NULL values as foreign key `%s` has SET NULL") // ErrForeignKeyMissingReferenceIndex is returned when the referenced columns in a foreign key do not have an index. ErrForeignKeyMissingReferenceIndex = errors.NewKind("missing index for foreign key `%s` on the referenced table `%s`") // ErrForeignKeyTextBlob is returned when a TEXT or BLOB column is used in a foreign key, which are not valid types. ErrForeignKeyTextBlob = errors.NewKind("TEXT/BLOB are not valid types for foreign keys") // ErrForeignKeyTypeChange is returned when attempting to change the type of some column used in a foreign key. ErrForeignKeyTypeChange = errors.NewKind("unable to change type of column `%s` as it is used by foreign keys") // ErrForeignKeyDepthLimit is returned when the CASCADE depth limit has been reached. ErrForeignKeyDepthLimit = errors.NewKind("Foreign key cascade delete/update exceeds max depth of 15.") // ErrDuplicateEntry is returns when a duplicate entry is placed on an index such as a UNIQUE or a Primary Key. ErrDuplicateEntry = errors.NewKind("Duplicate entry for key '%s'") // ErrInvalidArgument is returned when an argument to a function is invalid. ErrInvalidArgument = errors.NewKind("Invalid argument to %s") // ErrInvalidArgumentDetails is returned when the argument is invalid with details of a specific function ErrInvalidArgumentDetails = errors.NewKind("Invalid argument to %s: %s") // ErrSavepointDoesNotExist is returned when a RELEASE SAVEPOINT or ROLLBACK TO SAVEPOINT statement references a // non-existent savepoint identifier ErrSavepointDoesNotExist = errors.NewKind("SAVEPOINT %s does not exist") // ErrTemporaryTableNotSupported is thrown when an integrator attempts to create a temporary tables without temporary table // support. ErrTemporaryTableNotSupported = errors.NewKind("database does not support temporary tables") // ErrInvalidSyntax is returned for syntax errors that aren't picked up by the parser, e.g. the wrong type of // expression used in part of statement. ErrInvalidSyntax = errors.NewKind("Invalid syntax: %s") // ErrTableCopyingNotSupported is returned when a table invokes the TableCopierDatabase interface's // CopyTableData method without supporting the interface ErrTableCopyingNotSupported = errors.NewKind("error: Table copying not supported") // ErrMultiplePrimaryKeysDefined is returned when a table invokes CreatePrimaryKey with a primary key already // defined. ErrMultiplePrimaryKeysDefined = errors.NewKind("error: Multiple primary keys defined") // ErrWrongAutoKey is returned when a table invokes DropPrimaryKey without first removing the auto increment property // (if it exists) on it. ErrWrongAutoKey = errors.NewKind("error: incorrect table definition: there can be only one auto column and it must be defined as a key") // ErrKeyColumnDoesNotExist is returned when a table invoked CreatePrimaryKey with a non-existent column. ErrKeyColumnDoesNotExist = errors.NewKind("error: key column '%s' doesn't exist in table") // ErrCantDropFieldOrKey is returned when a table invokes DropPrimaryKey on a keyless table. ErrCantDropFieldOrKey = errors.NewKind("error: can't drop '%s'; check that column/key exists") // ErrCantDropIndex is return when a table can't drop an index due to a foreign key relationship. ErrCantDropIndex = errors.NewKind("error: can't drop index '%s': needed in a foreign key constraint") // ErrImmutableDatabaseProvider is returned when attempting to edit an immutable database databaseProvider. ErrImmutableDatabaseProvider = errors.NewKind("error: can't modify database databaseProvider") // ErrInvalidValue is returned when a given value does not match what is expected. ErrInvalidValue = errors.NewKind(`error: '%v' is not a valid value for '%v'`) // ErrInvalidValueType is returned when a given value's type does not match what is expected. ErrInvalidValueType = errors.NewKind(`error: '%T' is not a valid value type for '%v'`) // ErrFunctionNotFound is thrown when a function is not found ErrFunctionNotFound = errors.NewKind("function: '%s' not found") // ErrConflictingExternalQuery is thrown when a scope's parent has a conflicting sort or limit node ErrConflictingExternalQuery = errors.NewKind("found external scope with conflicting ORDER BY/LIMIT") // ErrTableFunctionNotFound is thrown when a table function is not found ErrTableFunctionNotFound = errors.NewKind("table function: '%s' not found") // ErrNonAggregatedColumnWithoutGroupBy is thrown when an aggregate function is used with the implicit, all-rows // grouping and another projected expression contains a non-aggregated column. // MySQL error code: 1140, SQL state: 42000 ErrNonAggregatedColumnWithoutGroupBy = errors.NewKind("in aggregated query without GROUP BY, expression #%d of SELECT list contains nonaggregated column '%s'; " + "this is incompatible with sql_mode=only_full_group_by") // ErrInvalidArgumentNumber is returned when the number of arguments to call a // function is different from the function arity. ErrInvalidArgumentNumber = errors.NewKind("function '%s' expected %v arguments, %v received") // ErrDatabaseNotFound is thrown when a database is not found ErrDatabaseNotFound = errors.NewKind("database not found: %s") // ErrNoDatabaseSelected is thrown when a database is not selected and the query requires one ErrNoDatabaseSelected = errors.NewKind("no database selected") // ErrAsOfNotSupported is thrown when an AS OF query is run on a database that can't support it ErrAsOfNotSupported = errors.NewKind("AS OF not supported for database %s") // ErrIncompatibleAsOf is thrown when an AS OF clause is used in an incompatible manner, such as when using an AS OF // expression with a view when the view definition has its own AS OF expressions. ErrIncompatibleAsOf = errors.NewKind("incompatible use of AS OF: %s") // ErrPidAlreadyUsed is returned when the pid is already registered. ErrPidAlreadyUsed = errors.NewKind("pid %d is already in use") // ErrInvalidOperandColumns is returned when the columns in the left // operand and the elements of the right operand don't match. Also // returned for invalid number of columns in projections, filters, // joins, etc. ErrInvalidOperandColumns = errors.NewKind("operand should have %d columns, but has %d") // ErrReadOnlyTransaction is returned when a write query is executed in a READ ONLY transaction. ErrReadOnlyTransaction = errors.NewKind("cannot execute statement in a READ ONLY transaction") // ErrLockDeadlock is the go-mysql-server equivalent of ER_LOCK_DEADLOCK. Transactions throwing this error // are automatically rolled back. Clients receiving this error must retry the transaction. ErrLockDeadlock = errors.NewKind("serialization failure: %s, try restarting transaction.") // ErrExistingView is returned when a CREATE VIEW statement uses a name that already exists ErrExistingView = errors.NewKind("the view %s.%s already exists") // ErrViewDoesNotExist is returned when a DROP VIEW statement drops a view that does not exist ErrViewDoesNotExist = errors.NewKind("the view %s.%s does not exist") // ErrSessionDoesNotSupportPersistence is thrown when a feature is not already supported ErrSessionDoesNotSupportPersistence = errors.NewKind("session does not support persistence") // ErrInvalidGISData is thrown when a "ST_<spatial_type>FromText" function receives a malformed string ErrInvalidGISData = errors.NewKind("invalid GIS data provided to function %s") // ErrIllegalGISValue is thrown when a spatial type constructor receives a non-geometric when one should be provided ErrIllegalGISValue = errors.NewKind("illegal non geometric '%v' value found during parsing") // ErrUnsupportedGISType is thrown when attempting to convert an unsupported geospatial value to a geometry struct ErrUnsupportedGISType = errors.NewKind("unsupported geospatial type: %s from value: 0x%s") // ErrUnsupportedSyntax is returned when syntax that parses correctly is not supported ErrUnsupportedSyntax = errors.NewKind("unsupported syntax: %s") // ErrInvalidSQLValType is returned when a SQL value is of the incorrect type during parsing ErrInvalidSQLValType = errors.NewKind("invalid SQLVal of type: %d") // ErrUnknownIndexColumn is returned when a column in an index is not in the table ErrUnknownIndexColumn = errors.NewKind("unknown column: '%s' in index '%s'") // ErrInvalidAutoIncCols is returned when an auto_increment column cannot be applied ErrInvalidAutoIncCols = errors.NewKind("there can be only one auto_increment column and it must be defined as a key") // ErrUnknownConstraintDefinition is returned when an unknown constraint type is used ErrUnknownConstraintDefinition = errors.NewKind("unknown constraint definition: %s, %T") // ErrInvalidCheckConstraint is returned when a check constraint is defined incorrectly ErrInvalidCheckConstraint = errors.NewKind("invalid constraint definition: %s") // ErrUserCreationFailure is returned when attempting to create a user and it fails for any reason. ErrUserCreationFailure = errors.NewKind("Operation CREATE USER failed for %s") // ErrRoleCreationFailure is returned when attempting to create a role and it fails for any reason. ErrRoleCreationFailure = errors.NewKind("Operation CREATE ROLE failed for %s") // ErrUserDeletionFailure is returned when attempting to create a user and it fails for any reason. ErrUserDeletionFailure = errors.NewKind("Operation DROP USER failed for %s") // ErrRoleDeletionFailure is returned when attempting to create a role and it fails for any reason. ErrRoleDeletionFailure = errors.NewKind("Operation DROP ROLE failed for %s") // ErrDatabaseAccessDeniedForUser is returned when attempting to access a database that the user does not have // permission for, regardless of whether that database actually exists. ErrDatabaseAccessDeniedForUser = errors.NewKind("Access denied for user %s to database '%s'") // ErrTableAccessDeniedForUser is returned when attempting to access a table that the user does not have permission // for, regardless of whether that table actually exists. ErrTableAccessDeniedForUser = errors.NewKind("Access denied for user %s to table '%s'") // ErrPrivilegeCheckFailed is returned when a user does not have the correct privileges to perform an operation. ErrPrivilegeCheckFailed = errors.NewKind("command denied to user %s") // ErrGrantUserDoesNotExist is returned when a user does not exist when attempting to grant them privileges. ErrGrantUserDoesNotExist = errors.NewKind("You are not allowed to create a user with GRANT") // ErrRevokeUserDoesNotExist is returned when a user does not exist when attempting to revoke privileges from them. ErrRevokeUserDoesNotExist = errors.NewKind("There is no such grant defined for user '%s' on host '%s'") // ErrGrantRevokeRoleDoesNotExist is returned when a user or role does not exist when attempting to grant or revoke roles. ErrGrantRevokeRoleDoesNotExist = errors.NewKind("Unknown authorization ID %s") // ErrShowGrantsUserDoesNotExist is returned when a user does not exist when attempting to show their grants. ErrShowGrantsUserDoesNotExist = errors.NewKind("There is no such grant defined for user '%s' on host '%s'") // ErrInvalidRecursiveCteUnion is returned when a recursive CTE is not a UNION or UNION ALL node. ErrInvalidRecursiveCteUnion = errors.NewKind("recursive cte top-level query must be a union; found: %v") // ErrInvalidRecursiveCteInitialQuery is returned when the recursive CTE base clause is not supported. ErrInvalidRecursiveCteInitialQuery = errors.NewKind("recursive cte initial query must be non-recursive projection; found: %v") // ErrInvalidRecursiveCteRecursiveQuery is returned when the recursive CTE recursion clause is not supported. ErrInvalidRecursiveCteRecursiveQuery = errors.NewKind("recursive cte recursive query must be a recursive projection; found: %v") // ErrCteRecursionLimitExceeded is returned when a recursive CTE's execution stack depth exceeds the static limit. ErrCteRecursionLimitExceeded = errors.NewKind("WITH RECURSIVE iteration limit exceeded") // ErrGrantRevokeIllegalPrivilege is returned when a GRANT or REVOKE statement is malformed, or attempts to use privilege incorrectly. ErrGrantRevokeIllegalPrivilege = errors.NewKind("Illegal GRANT/REVOKE command") // ErrInvalidWindowInheritance is returned when a window and its dependency contains conflicting partitioning, ordering, or framing clauses ErrInvalidWindowInheritance = errors.NewKind("window '%s' cannot inherit '%s' since %s") // ErrCircularWindowInheritance is returned when a WINDOW clause has a circular dependency ErrCircularWindowInheritance = errors.NewKind("there is a circularity in the window dependency graph") // ErrCannotCopyWindowFrame is returned when we inherit a window frame with a frame clause (replacement without parenthesis is OK) ErrCannotCopyWindowFrame = errors.NewKind("cannot copy window '%s' because it has a frame clause") // ErrUnknownWindowName is returned when an over by clause references an unknown window definition ErrUnknownWindowName = errors.NewKind("named window not found: '%s'") // ErrUnexpectedNilRow is returned when an invalid operation is applied to an empty row ErrUnexpectedNilRow = errors.NewKind("unexpected nil row") // ErrMoreThanOneRow is returned when the result consists of multiple rows, when only one row is expected ErrMoreThanOneRow = errors.NewKind("Result consisted of more than one row") // ErrColumnNumberDoesNotMatch is returned when the number of columns in result does not match expected number of variables ErrColumnNumberDoesNotMatch = errors.NewKind("The used SELECT statements have a different number of columns") // ErrUnsupportedJoinFactorCount is returned for a query with more commutable join tables than we support ErrUnsupportedJoinFactorCount = errors.NewKind("unsupported join factor count: expected fewer than %d tables, found %d") // ErrNotMatchingSRID is returned for SRID values not matching ErrNotMatchingSRID = errors.NewKind("The SRID of the geometry is %v, but the SRID of the column is %v. Consider changing the SRID of the geometry or the SRID property of the column.") // ErrNotMatchingSRIDWithColName is returned for error of SRID values not matching with column name detail ErrNotMatchingSRIDWithColName = errors.NewKind("The SRID of the geometry does not match the SRID of the column '%s'. %v") // ErrSpatialTypeConversion is returned when one spatial type cannot be converted to the other spatial type ErrSpatialTypeConversion = errors.NewKind("Cannot get geometry object from data you sent to the GEOMETRY field") // ErrUnsupportedIndexPrefix is returned for an index on a string column with a prefix ErrUnsupportedIndexPrefix = errors.NewKind("prefix index on string column '%s' unsupported") // ErrInvalidIndexPrefix is returned for an index prefix on a non-string column, or the prefix is longer than string itself, or just unsupported ErrInvalidIndexPrefix = errors.NewKind("incorrect prefix key '%s'; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys") // ErrInvalidBlobTextKey is returned for an index on a blob or text column with no key length specified ErrInvalidBlobTextKey = errors.NewKind("blob/text column '%s' used in key specification without a key length") // ErrKeyTooLong is returned for an index on a blob or text column that is longer than 3072 bytes ErrKeyTooLong = errors.NewKind("specified key was too long; max key length is 3072 bytes") // ErrKeyZero is returned for an index on a blob or text column that is 0 in length ErrKeyZero = errors.NewKind("key part '%s' length cannot be 0") // ErrDatabaseWriteLocked is returned when a database is locked in read-only mode to avoid // conflicts with an active server ErrDatabaseWriteLocked = errors.NewKind("database is locked to writes") // ErrCollationMalformedString is returned when a malformed string is encountered during a collation-related operation. ErrCollationMalformedString = errors.NewKind("malformed string encountered while %s") // ErrCollatedExprWrongType is returned when the wrong type is given to a CollatedExpression. ErrCollatedExprWrongType = errors.NewKind("wrong type in collated expression") // ErrCollationInvalidForCharSet is returned when the wrong collation is given for the character set when parsing. ErrCollationInvalidForCharSet = errors.NewKind("COLLATION '%s' is not valid for CHARACTER SET '%s'") // ErrCollationUnknown is returned when the collation is not a recognized MySQL collation. ErrCollationUnknown = errors.NewKind("Unknown collation: %v") // ErrCollationNotYetImplementedTemp is returned when the collation is valid but has not yet been implemented. // This error is temporary, and will be removed once all collations have been added. ErrCollationNotYetImplementedTemp = errors.NewKind("The collation `%s` has not yet been implemented, " + "please create an issue at https://github.com/noahkln/go-mysql-server/issues/new and the DoltHub developers will implement it") // ErrCollationIllegalMix is returned when two different collations are used in a scenario where they are not compatible. ErrCollationIllegalMix = errors.NewKind("Illegal mix of collations (%v) and (%v)") // ErrCharSetIntroducer is returned when a character set introducer is not attached to a string ErrCharSetIntroducer = errors.NewKind("CHARACTER SET introducer must be attached to a string") // ErrCharSetInvalidString is returned when an invalid string is given for a character set. ErrCharSetInvalidString = errors.NewKind("invalid string for character set `%s`: \"%s\"") // ErrCharSetFailedToEncode is returned when a character set fails encoding ErrCharSetFailedToEncode = errors.NewKind("failed to encode `%s`") // ErrCharSetUnknown is returned when the character set is not a recognized MySQL character set ErrCharSetUnknown = errors.NewKind("Unknown character set: %v") // ErrCharSetNotYetImplementedTemp is returned when the character set is valid but has not yet been implemented. // This error is temporary, and will be removed once all character sets have been added. ErrCharSetNotYetImplementedTemp = errors.NewKind("The character set `%s` has not yet been implemented, " + "please create an issue at https://github.com/noahkln/go-mysql-server/issues/new and the DoltHub developers will implement it") // ErrNoTablesUsed is returned when there is no table provided or dual table is defined with column access. ErrNoTablesUsed = errors.NewKind("No tables used") ErrInvalidJson = errors.NewKind("Invalid JSON text: %s") )
var ( ErrInvalidColExpr = errors.NewKind("the expression `%s` could not be found from the index `%s`") ErrRangeSimplification = errors.NewKind("attempting to simplify ranges has removed all ranges") ErrInvalidRangeType = errors.NewKind("encountered the RangeType_Invalid") )
var ( // ErrIndexIDAlreadyRegistered is the error returned when there is already // an index with the same ID. ErrIndexIDAlreadyRegistered = errors.NewKind("an index with id %q has already been registered") // ErrIndexExpressionAlreadyRegistered is the error returned when there is // already an index with the same expression. ErrIndexExpressionAlreadyRegistered = errors.NewKind("there is already an index registered for the expressions: %s") // ErrIndexNotFound is returned when the index could not be found. ErrIndexNotFound = errors.NewKind("index %q was not found") // ErrIndexDeleteInvalidStatus is returned when the index trying to delete // does not have a ready or outdated state. ErrIndexDeleteInvalidStatus = errors.NewKind("can't delete index %q because it's not ready for removal") )
var ( ErrOutOfRange = errors.NewKind("%v out of range for %v") // 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 ( ErrConvertingToSet = errors.NewKind("value %v is not valid for this set") ErrDuplicateEntrySet = errors.NewKind("duplicate entry: %v") ErrInvalidSetValue = errors.NewKind("value %v was not found in the set") ErrTooLargeForSet = errors.NewKind(`value "%v" is too large for this set`) )
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 ( // ErrNodeNotWritten is returned when the children are printed before the node. ErrNodeNotWritten = errors.New("treeprinter: a child was written before the node") // ErrNodeAlreadyWritten is returned when the node has already been written. ErrNodeAlreadyWritten = errors.New("treeprinter: node already written") // ErrChildrenAlreadyWritten is returned when the children have already been written. ErrChildrenAlreadyWritten = errors.New("treeprinter: children already written") )
var ( // ErrNotTuple is returned when the value is not a tuple. ErrNotTuple = errors.NewKind("value of type %T is not a tuple") // ErrInvalidColumnNumber is returned when a tuple has an invalid number of // arguments. ErrInvalidColumnNumber = errors.NewKind("tuple should contain %d column(s), but has %d") ErrInvalidBaseType = errors.NewKind("%v is not a valid %v base type") // ErrNotArray is returned when the value is not an array. ErrNotArray = errors.NewKind("value of type %T is not an array") // ErrConvertToSQL is returned when Convert failed. // It makes an error less verbose comparing to what spf13/cast returns. ErrConvertToSQL = errors.NewKind("incompatible conversion to SQL type: %s") )
var ErrCannotAddToClosedBackgroundThreads = errors.New("cannot add to a close background threads instance")
var ErrKeyNotFound = errors.NewKind("memory: key %d not found in cache")
ErrKeyNotFound is returned when the key could not be found in the cache.
var ErrLockDoesNotExist = errors.NewKind("Lock '%s' does not exist.")
ErrLockDoesNotExist is the kind of error returned when a named lock does not exist and the operation does not created it
var ErrLockNotOwned = errors.NewKind("Operation '%s' failed as the lock '%s' has a different owner.")
ErrLockNotOwned is the kind of error returned when attempting an operation against a lock that the given context does not own.
var ErrLockTimeout = errors.NewKind("Timeout acquiring lock '%s'.")
ErrLockTimeout is the kind of error returned when acquiring a lock takes longer than the user specified timeout
var ErrNoAutoIncrementCol = fmt.Errorf("this table has no AUTO_INCREMENT columns")
var ErrNoMemoryAvailable = errors.NewKind("no memory available")
ErrNoMemoryAvailable is returned when there is no more available memory.
var ErrNotGenerator = errors.NewKind("cannot convert value of type %T to a generator")
ErrNotGenerator is returned when the value cannot be converted to a generator.
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 (
ErrNotLineString = errors.NewKind("value of type %T is not a linestring")
)
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 (
ErrNotPoint = errors.NewKind("value of type %T is not a point")
)
var (
ErrNotPolygon = errors.NewKind("value of type %T is not a polygon")
)
var ErrUnableSort = errors.NewKind("unable to sort")
ErrUnableSort is thrown when something happens on sorting
var (
// ErrUnexpectedType is thrown when a received type is not the expected
ErrUnexpectedType = errors.NewKind("value at %d has unexpected type: %s")
)
var (
MaxJsonFieldByteLength = int64(1024) * int64(1024) * int64(1024)
)
var NoopTracer = trace.NewNoopTracerProvider().Tracer("github.com/noahkln/go-mysql-server/sql")
var OkResultColumnType = Int64
OkResultColumnType should be used as the schema column type for Nodes that return an OkResult
var OkResultSchema = Schema{ { Name: OkResultColumnName, Type: OkResultColumnType, }, }
OkResultSchema should be used as the schema of Nodes that return an OkResult
var SupportedCharsets = []CharacterSetID{ CharacterSet_utf8mb4, }
SupportedCharsets contains all non-binary character sets that are currently supported.
var SupportedEngines = []Engine{ {Name: "InnoDB", /* contains filtered or unexported fields */}, }
var SystemVariables = &globalSystemVariables{&sync.RWMutex{}, make(map[string]interface{})}
SystemVariables is the collection of system variables for this process.
Functions ¶
func AreComparable ¶
AreComparable returns whether the given types are either the same or similar enough that values can meaningfully be compared across all permutations. Int8 and Int64 are comparable types, where as VarChar and Int64 are not. In the case of the latter example, not all possible values of a VarChar are comparable to an Int64, while this is true for the former example.
func CastSQLError ¶
CastSQLError returns a *mysql.SQLError with the error code and in some cases, also a SQL state, populated for the specified error object. Using this method enables Vitess to return an error code, instead of just "unknown error". Many tools (e.g. ORMs, SQL workbenches) rely on this error metadata to work correctly. If the specified error is nil, nil will be returned. If the error is already of type *mysql.SQLError, the error will be returned as is.
func ConvertToBool ¶
func ConvertToString ¶
func ConvertToString(v interface{}, t StringType) (string, error)
func ConvertToTime ¶
func DBTableIter ¶
DBTableIter iterates over all tables returned by db.GetTableNames() calling cb for each one until all tables have been processed, or an error is returned from the callback, or the cont flag is false when returned from the callback.
func DebugString ¶
func DebugString(nodeOrExpression interface{}) string
DebugString returns a debug string for the Node or Expression given.
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 EvaluateCondition ¶
func EvaluateCondition(ctx *Context, cond Expression, row Row) (interface{}, error)
EvaluateCondition evaluates a condition, which is an expression whose value will be nil or coerced boolean.
func GetRangeCutKey ¶
func GetRangeCutKey(c RangeCut) interface{}
GetRangeCutKey returns the inner value from the given RangeCut.
func GetTableNameInsensitive ¶
GetTableNameInsensitive implements a case insensitive search of a slice of table names. It looks for exact matches first. If no exact matches are found then any table matching the name case insensitively should be returned. If there is more than one table that matches a case insensitive comparison the resolution strategy is not defined.
func GetTmpdirSessionVar ¶
func GetTmpdirSessionVar() string
cc: https://dev.mysql.com/doc/refman/8.0/en/temporary-files.html
func HasAvailableMemory ¶
HasAvailableMemory reports whether more memory is available to the program if it hasn't reached the max memory limit.
func HasDefaultValue ¶
HasDefaultValue checks if session variable value is the default one.
func InitSystemVariables ¶
func InitSystemVariables()
InitSystemVariables resets the systemVars singleton
func Inspect ¶
func Inspect(expr Expression, f func(expr Expression) bool)
Inspect traverses the plan in depth-first order: It starts by calling f(expr); expr must not be nil. If f returns true, Inspect invokes f recursively for each of the children of expr, followed by a call of f(nil).
func IsBinaryType ¶
IsBinaryType checks if t is BINARY, VARBINARY, or BLOB
func IsDeferredType ¶
func IsFalse ¶
func IsFalse(val interface{}) bool
IsFalse coerces EvaluateCondition interface{} response to boolean
func IsGeometry ¶
IsGeometry returns true if the specified type is a Geometry type.
func IsNull ¶
func IsNull(ex 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 IsTextOnly ¶
IsTextOnly checks if t is CHAR, VARCHAR, or one of the TEXTs.
func IsTrue ¶
func IsTrue(val interface{}) bool
IsTrue coerces EvaluateCondition interface{} response to boolean
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 MustConvert ¶
func MustConvert(val interface{}, err error) interface{}
func NewMapCache ¶
func NewMapCache() mapCache
func NumColumns ¶
NumColumns returns the number of columns in a type. This is one for all types, except tuples.
func NumericUnaryValue ¶
func NumericUnaryValue(t Type) interface{}
func OrderedCuts ¶
OrderedCuts returns the given Cuts in order from lowest-touched values to highest-touched values.
func RangeCutIsBinding ¶
func TypesEqual ¶
TypesEqual compares two Types and returns whether they are equivalent.
func UnwrapError ¶
UnwrapError removes any wrapping errors (e.g. WrappedInsertError) around the specified error and returns the first non-wrapped error type.
func ValidateTime ¶
ValidateTime receives a time and returns either that time or nil if it's not a valid time.
func Walk ¶
func Walk(v Visitor, expr Expression)
Walk traverses the expression tree in depth-first order. It starts by calling v.Visit(expr); expr must not be nil. If the visitor returned by v.Visit(expr) is not nil, Walk is invoked recursively with the returned visitor for each children of the expr, followed by a call of v.Visit(nil) to the returned visitor.
func WalkWithNode ¶
func WalkWithNode(v NodeVisitor, n Node, expr Expression)
WalkWithNode traverses the expression tree in depth-first order. It starts by calling v.Visit(node, expr); expr must not be nil. If the visitor returned by v.Visit(node, expr) is not nil, Walk is invoked recursively with the returned visitor for each children of the expr, followed by a call of v.Visit(nil, nil) to the returned visitor.
func WriteEWKBHeader ¶
WriteEWKBHeader will write EWKB header to the given buffer
func WriteWKBHeader ¶
WriteWKBHeader will write WKB header to the given buffer
Types ¶
type Above ¶
type Above struct {
Key interface{}
}
Above represents the position immediately above the contained key.
func (Above) TypeAsLowerBound ¶
func (Above) TypeAsLowerBound() RangeBoundType
TypeAsLowerBound implements RangeCut.
func (Above) TypeAsUpperBound ¶
func (Above) TypeAsUpperBound() RangeBoundType
TypeAsUpperBound implements RangeCut.
type AboveAll ¶
type AboveAll struct{}
AboveAll represents the position beyond the maximum possible value.
func (AboveAll) TypeAsLowerBound ¶
func (AboveAll) TypeAsLowerBound() RangeBoundType
TypeAsLowerBound implements RangeCut.
func (AboveAll) TypeAsUpperBound ¶
func (AboveAll) TypeAsUpperBound() RangeBoundType
TypeAsUpperBound implements RangeCut.
type AboveNull ¶
type AboveNull struct{}
AboveNull represents the position just above NULL, lower than every possible value in the domain.
func (AboveNull) TypeAsLowerBound ¶
func (AboveNull) TypeAsLowerBound() RangeBoundType
TypeAsLowerBound implements RangeCut.
func (AboveNull) TypeAsUpperBound ¶
func (AboveNull) TypeAsUpperBound() RangeBoundType
TypeAsUpperBound implements RangeCut.
type Aggregation ¶
type Aggregation interface { WindowAdaptableExpression // NewBuffer creates a new aggregation buffer and returns it as a Row. NewBuffer() (AggregationBuffer, error) // WithWindow returns a version of this aggregation with the WindowDefinition given WithWindow(window *WindowDefinition) (Aggregation, error) // Window returns this expression's window Window() *WindowDefinition }
Aggregation implements an aggregation expression, where an aggregation buffer is created for each grouping (NewBuffer). Rows for the grouping should be fed to the buffer with |Update| and the buffer should be eval'd with |Eval|. Calling |Eval| directly on an Aggregation expression is typically an error.
type AggregationBuffer ¶
type AlterableTable ¶
type AlterableTable interface { Table UpdatableTable // AddColumn adds a column to this table as given. If non-nil, order specifies where in the schema to add the column. AddColumn(ctx *Context, column *Column, order *ColumnOrder) error // DropColumn drops the column with the name given. DropColumn(ctx *Context, columnName string) error // ModifyColumn modifies the column with the name given, replacing with the new column definition provided (which may // include a name change). If non-nil, order specifies where in the schema to move the column. ModifyColumn(ctx *Context, columnName string, column *Column, order *ColumnOrder) error }
AlterableTable should be implemented by tables that can receive ALTER TABLE statements to modify their schemas.
type AutoIncrementSetter ¶
type AutoIncrementSetter interface { // SetAutoIncrementValue sets a new AUTO_INCREMENT value. SetAutoIncrementValue(*Context, uint64) error // Close finalizes the set operation, persisting the result. Closer }
AutoIncrementSetter provides support for altering a table's AUTO_INCREMENT sequence, eg 'ALTER TABLE t AUTO_INCREMENT = 10;'
type AutoIncrementTable ¶
type AutoIncrementTable interface { Table // GetNextAutoIncrementValue gets the next AUTO_INCREMENT value. In the case that a table with an autoincrement // column is passed in a row with the autoinc column failed, the next auto increment value must // update its internal state accordingly and use the insert val at runtime. // Implementations are responsible for updating their state to provide the correct values. GetNextAutoIncrementValue(ctx *Context, insertVal interface{}) (uint64, error) // AutoIncrementSetter returns an AutoIncrementSetter. AutoIncrementSetter(*Context) AutoIncrementSetter }
AutoIncrementTable is a table that supports AUTO_INCREMENT. Getter and Setter methods access the table's AUTO_INCREMENT sequence. These methods should only be used for tables with and AUTO_INCREMENT column in their schema.
type BackgroundThreads ¶
type BackgroundThreads struct {
// contains filtered or unexported fields
}
func NewBackgroundThreads ¶
func NewBackgroundThreads() *BackgroundThreads
func (*BackgroundThreads) Add ¶
func (bt *BackgroundThreads) Add(name string, f func(ctx context.Context)) error
Add starts a background goroutine wrapped by a top-level sync.WaitGroup. [f] must return when its [ctx] argument is cancelled, otherwise Shutdown will hang.
func (*BackgroundThreads) Shutdown ¶
func (bt *BackgroundThreads) Shutdown() error
Shutdown cancels the parent context for every async thread, and waits for each goroutine to drain and return before exiting.
type BaseSession ¶
type BaseSession struct {
// contains filtered or unexported fields
}
BaseSession is the basic session type.
func NewBaseSession ¶
func NewBaseSession() *BaseSession
NewBaseSession creates a new empty session.
func NewBaseSessionWithClientServer ¶
func NewBaseSessionWithClientServer(server string, client Client, id uint32) *BaseSession
NewBaseSessionWithClientServer creates a new session with data.
func (*BaseSession) AddLock ¶
func (s *BaseSession) AddLock(lockName string) error
AddLock adds a lock to the set of locks owned by this user which will need to be released if this session terminates
func (*BaseSession) Address ¶
func (s *BaseSession) Address() string
Address returns the server address.
func (*BaseSession) ClearWarnings ¶
func (s *BaseSession) ClearWarnings()
ClearWarnings cleans up session warnings
func (*BaseSession) Client ¶
func (s *BaseSession) Client() Client
Client returns session's client information.
func (*BaseSession) CommitTransaction ¶
func (s *BaseSession) CommitTransaction(*Context, string, Transaction) error
CommitTransaction commits the current transaction for the current database.
func (*BaseSession) DelLock ¶
func (s *BaseSession) DelLock(lockName string) error
DelLock removes a lock from the set of locks owned by this user
func (*BaseSession) GetAllSessionVariables ¶
func (s *BaseSession) GetAllSessionVariables() map[string]interface{}
GetAllSessionVariables implements the Session interface.
func (*BaseSession) GetCharacterSet ¶
func (s *BaseSession) GetCharacterSet() CharacterSetID
GetCharacterSet returns the character set for this session (defined by the system variable `character_set_connection`).
func (*BaseSession) GetCharacterSetResults ¶
func (s *BaseSession) GetCharacterSetResults() CharacterSetID
GetCharacterSetResults returns the result character set for this session (defined by the system variable `character_set_results`).
func (*BaseSession) GetCollation ¶
func (s *BaseSession) GetCollation() CollationID
GetCollation returns the collation for this session (defined by the system variable `collation_connection`).
func (*BaseSession) GetCurrentDatabase ¶
func (s *BaseSession) GetCurrentDatabase() string
GetCurrentDatabase gets the current database for this session
func (*BaseSession) GetIgnoreAutoCommit ¶
func (s *BaseSession) GetIgnoreAutoCommit() bool
func (*BaseSession) GetIndexRegistry ¶
func (s *BaseSession) GetIndexRegistry() *IndexRegistry
func (*BaseSession) GetLastQueryInfo ¶
func (s *BaseSession) GetLastQueryInfo(key string) int64
func (*BaseSession) GetLogger ¶
func (s *BaseSession) GetLogger() *logrus.Entry
func (*BaseSession) GetPrivilegeSet ¶
func (s *BaseSession) GetPrivilegeSet() (PrivilegeSet, uint64)
func (*BaseSession) GetQueriedDatabase ¶
func (s *BaseSession) GetQueriedDatabase() string
GetQueriedDatabase implements the Session interface.
func (*BaseSession) GetSessionVariable ¶
func (s *BaseSession) GetSessionVariable(ctx *Context, sysVarName string) (interface{}, error)
GetSessionVariable implements the Session interface.
func (*BaseSession) GetTransaction ¶
func (s *BaseSession) GetTransaction() Transaction
func (*BaseSession) GetUserVariable ¶
func (s *BaseSession) GetUserVariable(ctx *Context, varName string) (Type, interface{}, error)
GetUserVariable implements the Session interface.
func (*BaseSession) GetViewRegistry ¶
func (s *BaseSession) GetViewRegistry() *ViewRegistry
func (*BaseSession) InitSessionVariable ¶
func (s *BaseSession) InitSessionVariable(ctx *Context, sysVarName string, value interface{}) error
InitSessionVariable implements the Session interface and is used to initialize variables (Including read-only variables)
func (*BaseSession) IterLocks ¶
func (s *BaseSession) IterLocks(cb func(name string) error) error
IterLocks iterates through all locks owned by this user
func (*BaseSession) SetClient ¶
func (s *BaseSession) SetClient(c Client)
SetClient implements the Session interface.
func (*BaseSession) SetConnectionId ¶
func (s *BaseSession) SetConnectionId(id uint32)
SetConnectionId sets the [id] for this session
func (*BaseSession) SetCurrentDatabase ¶
func (s *BaseSession) SetCurrentDatabase(dbName string)
SetCurrentDatabase sets the current database for this session
func (*BaseSession) SetIgnoreAutoCommit ¶
func (s *BaseSession) SetIgnoreAutoCommit(ignore bool)
func (*BaseSession) SetIndexRegistry ¶
func (s *BaseSession) SetIndexRegistry(reg *IndexRegistry)
func (*BaseSession) SetLastQueryInfo ¶
func (s *BaseSession) SetLastQueryInfo(key string, value int64)
func (*BaseSession) SetLogger ¶
func (s *BaseSession) SetLogger(logger *logrus.Entry)
func (*BaseSession) SetPrivilegeSet ¶
func (s *BaseSession) SetPrivilegeSet(newPs PrivilegeSet, counter uint64)
func (*BaseSession) SetQueriedDatabase ¶
func (s *BaseSession) SetQueriedDatabase(dbName string)
SetQueriedDatabase implements the Session interface.
func (*BaseSession) SetSessionVariable ¶
func (s *BaseSession) SetSessionVariable(ctx *Context, sysVarName string, value interface{}) error
SetSessionVariable implements the Session interface.
func (*BaseSession) SetTransaction ¶
func (s *BaseSession) SetTransaction(tx Transaction)
func (*BaseSession) SetUserVariable ¶
func (s *BaseSession) SetUserVariable(ctx *Context, varName string, value interface{}) error
SetUserVariable implements the Session interface.
func (*BaseSession) SetViewRegistry ¶
func (s *BaseSession) SetViewRegistry(reg *ViewRegistry)
func (*BaseSession) ValidateSession ¶
func (s *BaseSession) ValidateSession(ctx *Context, dbName string) error
ValidateSession provides integrators a chance to do any custom validation of this session before any query is executed in it.
func (*BaseSession) Warn ¶
func (s *BaseSession) Warn(warn *Warning)
Warn stores the warning in the session.
func (*BaseSession) WarningCount ¶
func (s *BaseSession) WarningCount() uint16
WarningCount returns a number of session warnings
func (*BaseSession) Warnings ¶
func (s *BaseSession) Warnings() []*Warning
Warnings returns a copy of session warnings (from the most recent - the last one) The function implements sql.Session interface
type Below ¶
type Below struct {
Key interface{}
}
Below represents the position immediately below the contained key.
func (Below) TypeAsLowerBound ¶
func (Below) TypeAsLowerBound() RangeBoundType
TypeAsLowerBound implements RangeCut.
func (Below) TypeAsUpperBound ¶
func (Below) TypeAsUpperBound() RangeBoundType
TypeAsUpperBound implements RangeCut.
type BelowNull ¶
type BelowNull struct{}
BelowNull represents the position below NULL, which sorts before |AboveNull| and every non-NULL value in the domain.
func (BelowNull) TypeAsLowerBound ¶
func (BelowNull) TypeAsLowerBound() RangeBoundType
TypeAsLowerBound implements RangeCut.
func (BelowNull) TypeAsUpperBound ¶
func (BelowNull) TypeAsUpperBound() RangeBoundType
TypeAsUpperBound implements RangeCut.
type BinaryNode ¶
BinaryNode has two children
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 Catalog ¶
type Catalog interface { // AllDatabases returns all databases known to this catalog AllDatabases(ctx *Context) []Database // HasDB returns whether a db with the name given exists, case-insensitive HasDB(ctx *Context, db string) bool // Database returns the database with the name given, case-insensitive, or an error if it doesn't exist Database(ctx *Context, db string) (Database, error) // CreateDatabase creates a new database, or returns an error if the operation isn't supported or fails. CreateDatabase(ctx *Context, dbName string, collation CollationID) error // RemoveDatabase removes the database named, or returns an error if the operation isn't supported or fails. RemoveDatabase(ctx *Context, dbName string) error // Table returns the table with the name given in the db with the name given Table(ctx *Context, dbName, tableName string) (Table, Database, error) // TableAsOf returns the table with the name given in the db with the name given, as of the given marker TableAsOf(ctx *Context, dbName, tableName string, asOf interface{}) (Table, Database, error) // Function returns the function with the name given, or sql.ErrFunctionNotFound if it doesn't exist Function(ctx *Context, name string) (Function, error) // RegisterFunction registers the functions given, adding them to the built-in functions. // Integrators with custom functions should typically use the FunctionProvider interface to register their functions. RegisterFunction(ctx *Context, fns ...Function) // LockTable locks the table named LockTable(ctx *Context, table string) // UnlockTables unlocks all tables locked by the session id given UnlockTables(ctx *Context, id uint32) error }
type CharacterSet ¶
type CharacterSet struct { ID CharacterSetID Name string DefaultCollation CollationID BinaryCollation CollationID Description string MaxLength uint8 Encoder encodings.Encoder }
CharacterSet represents the character set of a string.
type CharacterSetID ¶
type CharacterSetID uint16
CharacterSetID represents a character set. Unlike collations, this ID is not intended for storage and may change as new character sets are added. It is recommended to use the character set's name if persistence is desired.
const ( CharacterSet_armscii8 CharacterSetID = 1 CharacterSet_ascii CharacterSetID = 2 CharacterSet_big5 CharacterSetID = 3 CharacterSet_binary CharacterSetID = 4 CharacterSet_cp1250 CharacterSetID = 5 CharacterSet_cp1251 CharacterSetID = 6 CharacterSet_cp1256 CharacterSetID = 7 CharacterSet_cp1257 CharacterSetID = 8 CharacterSet_cp850 CharacterSetID = 9 CharacterSet_cp852 CharacterSetID = 10 CharacterSet_cp866 CharacterSetID = 11 CharacterSet_cp932 CharacterSetID = 12 CharacterSet_dec8 CharacterSetID = 13 CharacterSet_eucjpms CharacterSetID = 14 CharacterSet_euckr CharacterSetID = 15 CharacterSet_gb18030 CharacterSetID = 16 CharacterSet_gb2312 CharacterSetID = 17 CharacterSet_gbk CharacterSetID = 18 CharacterSet_geostd8 CharacterSetID = 19 CharacterSet_greek CharacterSetID = 20 CharacterSet_hebrew CharacterSetID = 21 CharacterSet_hp8 CharacterSetID = 22 CharacterSet_keybcs2 CharacterSetID = 23 CharacterSet_koi8r CharacterSetID = 24 CharacterSet_koi8u CharacterSetID = 25 CharacterSet_latin1 CharacterSetID = 26 CharacterSet_latin2 CharacterSetID = 27 CharacterSet_latin5 CharacterSetID = 28 CharacterSet_latin7 CharacterSetID = 29 CharacterSet_macce CharacterSetID = 30 CharacterSet_macroman CharacterSetID = 31 CharacterSet_sjis CharacterSetID = 32 CharacterSet_swe7 CharacterSetID = 33 CharacterSet_tis620 CharacterSetID = 34 CharacterSet_ucs2 CharacterSetID = 35 CharacterSet_ujis CharacterSetID = 36 CharacterSet_utf16 CharacterSetID = 37 CharacterSet_utf16le CharacterSetID = 38 CharacterSet_utf32 CharacterSetID = 39 CharacterSet_utf8mb3 CharacterSetID = 40 CharacterSet_utf8mb4 CharacterSetID = 41 CharacterSet_utf8 = CharacterSet_utf8mb3 // CharacterSet_Unspecified is used when a character set has not been specified, either explicitly or implicitly. // This is usually used as an intermediate character set to be later replaced by an analyzer pass or a plan, // although it is valid to use it directly. When used, behaves identically to the character set belonging to the // default collation, although it will NOT match the aforementioned character set. CharacterSet_Unspecified CharacterSetID = 0 )
func ParseCharacterSet ¶
func ParseCharacterSet(str string) (CharacterSetID, error)
ParseCharacterSet takes in a string representing a CharacterSet and returns the result if a match is found, or an error if not.
func (CharacterSetID) BinaryCollation ¶
func (cs CharacterSetID) BinaryCollation() CollationID
BinaryCollation returns the binary CollationID for this CharacterSet.
func (CharacterSetID) DefaultCollation ¶
func (cs CharacterSetID) DefaultCollation() CollationID
DefaultCollation returns the default CollationID for this CharacterSet.
func (CharacterSetID) Description ¶
func (cs CharacterSetID) Description() string
Description returns the plain-English description of the CharacterSet.
func (CharacterSetID) Encoder ¶
func (cs CharacterSetID) Encoder() encodings.Encoder
Encoder returns this CharacterSet's encoder. As character sets are a work-in-progress, it is recommended to check if it is nil before allowing the character set to be set within a table.
func (CharacterSetID) MaxLength ¶
func (cs CharacterSetID) MaxLength() int64
MaxLength returns the maximum size of a single character in the CharacterSet.
func (CharacterSetID) Name ¶
func (cs CharacterSetID) Name() string
Name returns the name of this CharacterSet.
func (CharacterSetID) String ¶
func (cs CharacterSetID) String() string
String returns the string representation of the CharacterSet.
type CharacterSetsIterator ¶
type CharacterSetsIterator struct {
// contains filtered or unexported fields
}
CharacterSetsIterator iterates over every character set available.
func NewCharacterSetsIterator ¶
func NewCharacterSetsIterator() *CharacterSetsIterator
NewCharacterSetsIterator returns a new CharacterSetsIterator.
func (*CharacterSetsIterator) Next ¶
func (csi *CharacterSetsIterator) Next() (CharacterSet, bool)
Next returns the next character set. If all character sets have been iterated over, returns false.
type CheckAlterableTable ¶
type CheckAlterableTable interface { Table // CreateCheck creates an check constraint for this table, using the provided parameters. // Returns an error if the constraint name already exists. CreateCheck(ctx *Context, check *CheckDefinition) error // DropCheck removes a check constraint from the database. DropCheck(ctx *Context, chName string) error }
CheckAlterableTable represents a table that supports check constraints.
type CheckConstraint ¶
type CheckConstraint struct { Name string Expr Expression Enforced bool }
CheckConstraint declares a boolean-eval constraint.
func (CheckConstraint) DebugString ¶
func (c CheckConstraint) DebugString() string
type CheckConstraints ¶
type CheckConstraints []*CheckConstraint
func (CheckConstraints) FromExpressions ¶
func (checks CheckConstraints) FromExpressions(exprs []Expression) (CheckConstraints, error)
FromExpressions takes a slice of sql.Expression in the same order as these constraints, and returns a new slice of constraints with the expressions given, holding names and other properties constant.
func (CheckConstraints) ToExpressions ¶
func (checks CheckConstraints) ToExpressions() []Expression
ToExpressions returns the check expressions in these constraints as a slice of sql.Expression
type CheckDefinition ¶
type CheckDefinition struct { Name string // The name of this check. Check names in a database are unique. CheckExpression string // String serialization of the check expression Enforced bool // Whether this constraint is enforced }
CheckDefinition defines a trigger. Integrators are not expected to parse or understand the trigger definitions, but must store and return them when asked.
type CheckTable ¶
type CheckTable interface { Table // GetChecks returns the check constraints on this table. GetChecks(ctx *Context) ([]CheckDefinition, error) }
CheckTable is a table that can declare its check constraints.
type Checksumable ¶
type Checksumable interface { // Checksum returns a checksum and an error if there was any problem // computing or obtaining the checksum. Checksum() (string, error) }
Checksumable provides the checksum of some data.
type Client ¶
type Client struct { // User of the session. User string // Address of the client. Address string // Capabilities of the client Capabilities uint32 }
Client holds session user information.
type CollatedDatabase ¶
type CollatedDatabase interface { Database // GetCollation returns this database's collation. GetCollation(ctx *Context) CollationID // SetCollation updates this database's collation. SetCollation(ctx *Context, collation CollationID) error }
CollatedDatabase is a Database that may store and update its collation.
type CollatedDatabaseProvider ¶
type CollatedDatabaseProvider interface { MutableDatabaseProvider // CreateCollatedDatabase creates a collated database and adds it to the provider's collection. CreateCollatedDatabase(ctx *Context, name string, collation CollationID) error }
type Collation ¶
type Collation struct { ID CollationID Name string CharacterSet CharacterSetID IsDefault bool IsCompiled bool SortLength uint8 PadAttribute string Sorter func(r rune) int32 }
Collation represents the collation of a string.
type CollationID ¶
type CollationID uint16
CollationID represents the collation's unique identifier. May be safely converted to and from an uint16 for storage.
const ( Collation_armscii8_bin CollationID = 64 Collation_armscii8_general_ci CollationID = 32 Collation_ascii_bin CollationID = 65 Collation_ascii_general_ci CollationID = 11 Collation_big5_bin CollationID = 84 Collation_big5_chinese_ci CollationID = 1 Collation_binary CollationID = 63 Collation_cp1250_bin CollationID = 66 Collation_cp1250_croatian_ci CollationID = 44 Collation_cp1250_czech_cs CollationID = 34 Collation_cp1250_general_ci CollationID = 26 Collation_cp1250_polish_ci CollationID = 99 Collation_cp1251_bin CollationID = 50 Collation_cp1251_bulgarian_ci CollationID = 14 Collation_cp1251_general_ci CollationID = 51 Collation_cp1251_general_cs CollationID = 52 Collation_cp1251_ukrainian_ci CollationID = 23 Collation_cp1256_bin CollationID = 67 Collation_cp1256_general_ci CollationID = 57 Collation_cp1257_bin CollationID = 58 Collation_cp1257_general_ci CollationID = 59 Collation_cp1257_lithuanian_ci CollationID = 29 Collation_cp850_bin CollationID = 80 Collation_cp850_general_ci CollationID = 4 Collation_cp852_bin CollationID = 81 Collation_cp852_general_ci CollationID = 40 Collation_cp866_bin CollationID = 68 Collation_cp866_general_ci CollationID = 36 Collation_cp932_bin CollationID = 96 Collation_cp932_japanese_ci CollationID = 95 Collation_dec8_bin CollationID = 69 Collation_dec8_swedish_ci CollationID = 3 Collation_eucjpms_bin CollationID = 98 Collation_eucjpms_japanese_ci CollationID = 97 Collation_euckr_bin CollationID = 85 Collation_euckr_korean_ci CollationID = 19 Collation_gb18030_bin CollationID = 249 Collation_gb18030_chinese_ci CollationID = 248 Collation_gb18030_unicode_520_ci CollationID = 250 Collation_gb2312_bin CollationID = 86 Collation_gb2312_chinese_ci CollationID = 24 Collation_gbk_bin CollationID = 87 Collation_gbk_chinese_ci CollationID = 28 Collation_geostd8_bin CollationID = 93 Collation_geostd8_general_ci CollationID = 92 Collation_greek_bin CollationID = 70 Collation_greek_general_ci CollationID = 25 Collation_hebrew_bin CollationID = 71 Collation_hebrew_general_ci CollationID = 16 Collation_hp8_bin CollationID = 72 Collation_hp8_english_ci CollationID = 6 Collation_keybcs2_bin CollationID = 73 Collation_keybcs2_general_ci CollationID = 37 Collation_koi8r_bin CollationID = 74 Collation_koi8r_general_ci CollationID = 7 Collation_koi8u_bin CollationID = 75 Collation_koi8u_general_ci CollationID = 22 Collation_latin1_bin CollationID = 47 Collation_latin1_danish_ci CollationID = 15 Collation_latin1_general_ci CollationID = 48 Collation_latin1_general_cs CollationID = 49 Collation_latin1_german1_ci CollationID = 5 Collation_latin1_german2_ci CollationID = 31 Collation_latin1_spanish_ci CollationID = 94 Collation_latin1_swedish_ci CollationID = 8 Collation_latin2_bin CollationID = 77 Collation_latin2_croatian_ci CollationID = 27 Collation_latin2_czech_cs CollationID = 2 Collation_latin2_general_ci CollationID = 9 Collation_latin2_hungarian_ci CollationID = 21 Collation_latin5_bin CollationID = 78 Collation_latin5_turkish_ci CollationID = 30 Collation_latin7_bin CollationID = 79 Collation_latin7_estonian_cs CollationID = 20 Collation_latin7_general_ci CollationID = 41 Collation_latin7_general_cs CollationID = 42 Collation_macce_bin CollationID = 43 Collation_macce_general_ci CollationID = 38 Collation_macroman_bin CollationID = 53 Collation_macroman_general_ci CollationID = 39 Collation_sjis_bin CollationID = 88 Collation_sjis_japanese_ci CollationID = 13 Collation_swe7_bin CollationID = 82 Collation_swe7_swedish_ci CollationID = 10 Collation_tis620_bin CollationID = 89 Collation_tis620_thai_ci CollationID = 18 Collation_ucs2_bin CollationID = 90 Collation_ucs2_croatian_ci CollationID = 149 Collation_ucs2_czech_ci CollationID = 138 Collation_ucs2_danish_ci CollationID = 139 Collation_ucs2_esperanto_ci CollationID = 145 Collation_ucs2_estonian_ci CollationID = 134 Collation_ucs2_general_ci CollationID = 35 Collation_ucs2_general_mysql500_ci CollationID = 159 Collation_ucs2_german2_ci CollationID = 148 Collation_ucs2_hungarian_ci CollationID = 146 Collation_ucs2_icelandic_ci CollationID = 129 Collation_ucs2_latvian_ci CollationID = 130 Collation_ucs2_lithuanian_ci CollationID = 140 Collation_ucs2_persian_ci CollationID = 144 Collation_ucs2_polish_ci CollationID = 133 Collation_ucs2_roman_ci CollationID = 143 Collation_ucs2_romanian_ci CollationID = 131 Collation_ucs2_sinhala_ci CollationID = 147 Collation_ucs2_slovak_ci CollationID = 141 Collation_ucs2_slovenian_ci CollationID = 132 Collation_ucs2_spanish2_ci CollationID = 142 Collation_ucs2_spanish_ci CollationID = 135 Collation_ucs2_swedish_ci CollationID = 136 Collation_ucs2_turkish_ci CollationID = 137 Collation_ucs2_unicode_520_ci CollationID = 150 Collation_ucs2_unicode_ci CollationID = 128 Collation_ucs2_vietnamese_ci CollationID = 151 Collation_ujis_bin CollationID = 91 Collation_ujis_japanese_ci CollationID = 12 Collation_utf16_bin CollationID = 55 Collation_utf16_croatian_ci CollationID = 122 Collation_utf16_czech_ci CollationID = 111 Collation_utf16_danish_ci CollationID = 112 Collation_utf16_esperanto_ci CollationID = 118 Collation_utf16_estonian_ci CollationID = 107 Collation_utf16_general_ci CollationID = 54 Collation_utf16_german2_ci CollationID = 121 Collation_utf16_hungarian_ci CollationID = 119 Collation_utf16_icelandic_ci CollationID = 102 Collation_utf16_latvian_ci CollationID = 103 Collation_utf16_lithuanian_ci CollationID = 113 Collation_utf16_persian_ci CollationID = 117 Collation_utf16_polish_ci CollationID = 106 Collation_utf16_roman_ci CollationID = 116 Collation_utf16_romanian_ci CollationID = 104 Collation_utf16_sinhala_ci CollationID = 120 Collation_utf16_slovak_ci CollationID = 114 Collation_utf16_slovenian_ci CollationID = 105 Collation_utf16_spanish2_ci CollationID = 115 Collation_utf16_spanish_ci CollationID = 108 Collation_utf16_swedish_ci CollationID = 109 Collation_utf16_turkish_ci CollationID = 110 Collation_utf16_unicode_520_ci CollationID = 123 Collation_utf16_unicode_ci CollationID = 101 Collation_utf16_vietnamese_ci CollationID = 124 Collation_utf16le_bin CollationID = 62 Collation_utf16le_general_ci CollationID = 56 Collation_utf32_bin CollationID = 61 Collation_utf32_croatian_ci CollationID = 181 Collation_utf32_czech_ci CollationID = 170 Collation_utf32_danish_ci CollationID = 171 Collation_utf32_esperanto_ci CollationID = 177 Collation_utf32_estonian_ci CollationID = 166 Collation_utf32_general_ci CollationID = 60 Collation_utf32_german2_ci CollationID = 180 Collation_utf32_hungarian_ci CollationID = 178 Collation_utf32_icelandic_ci CollationID = 161 Collation_utf32_latvian_ci CollationID = 162 Collation_utf32_lithuanian_ci CollationID = 172 Collation_utf32_persian_ci CollationID = 176 Collation_utf32_polish_ci CollationID = 165 Collation_utf32_roman_ci CollationID = 175 Collation_utf32_romanian_ci CollationID = 163 Collation_utf32_sinhala_ci CollationID = 179 Collation_utf32_slovak_ci CollationID = 173 Collation_utf32_slovenian_ci CollationID = 164 Collation_utf32_spanish2_ci CollationID = 174 Collation_utf32_spanish_ci CollationID = 167 Collation_utf32_swedish_ci CollationID = 168 Collation_utf32_turkish_ci CollationID = 169 Collation_utf32_unicode_520_ci CollationID = 182 Collation_utf32_unicode_ci CollationID = 160 Collation_utf32_vietnamese_ci CollationID = 183 Collation_utf8mb3_bin CollationID = 83 Collation_utf8mb3_croatian_ci CollationID = 213 Collation_utf8mb3_czech_ci CollationID = 202 Collation_utf8mb3_danish_ci CollationID = 203 Collation_utf8mb3_esperanto_ci CollationID = 209 Collation_utf8mb3_estonian_ci CollationID = 198 Collation_utf8mb3_general_ci CollationID = 33 Collation_utf8mb3_general_mysql500_ci CollationID = 223 Collation_utf8mb3_german2_ci CollationID = 212 Collation_utf8mb3_hungarian_ci CollationID = 210 Collation_utf8mb3_icelandic_ci CollationID = 193 Collation_utf8mb3_latvian_ci CollationID = 194 Collation_utf8mb3_lithuanian_ci CollationID = 204 Collation_utf8mb3_persian_ci CollationID = 208 Collation_utf8mb3_polish_ci CollationID = 197 Collation_utf8mb3_roman_ci CollationID = 207 Collation_utf8mb3_romanian_ci CollationID = 195 Collation_utf8mb3_sinhala_ci CollationID = 211 Collation_utf8mb3_slovak_ci CollationID = 205 Collation_utf8mb3_slovenian_ci CollationID = 196 Collation_utf8mb3_spanish2_ci CollationID = 206 Collation_utf8mb3_spanish_ci CollationID = 199 Collation_utf8mb3_swedish_ci CollationID = 200 Collation_utf8mb3_tolower_ci CollationID = 76 Collation_utf8mb3_turkish_ci CollationID = 201 Collation_utf8mb3_unicode_520_ci CollationID = 214 Collation_utf8mb3_unicode_ci CollationID = 192 Collation_utf8mb3_vietnamese_ci CollationID = 215 Collation_utf8mb4_0900_ai_ci CollationID = 255 Collation_utf8mb4_0900_as_ci CollationID = 305 Collation_utf8mb4_0900_as_cs CollationID = 278 Collation_utf8mb4_0900_bin CollationID = 309 Collation_utf8mb4_bin CollationID = 46 Collation_utf8mb4_croatian_ci CollationID = 245 Collation_utf8mb4_cs_0900_ai_ci CollationID = 266 Collation_utf8mb4_cs_0900_as_cs CollationID = 289 Collation_utf8mb4_czech_ci CollationID = 234 Collation_utf8mb4_da_0900_ai_ci CollationID = 267 Collation_utf8mb4_da_0900_as_cs CollationID = 290 Collation_utf8mb4_danish_ci CollationID = 235 Collation_utf8mb4_de_pb_0900_ai_ci CollationID = 256 Collation_utf8mb4_de_pb_0900_as_cs CollationID = 279 Collation_utf8mb4_eo_0900_ai_ci CollationID = 273 Collation_utf8mb4_eo_0900_as_cs CollationID = 296 Collation_utf8mb4_es_0900_ai_ci CollationID = 263 Collation_utf8mb4_es_0900_as_cs CollationID = 286 Collation_utf8mb4_es_trad_0900_ai_ci CollationID = 270 Collation_utf8mb4_es_trad_0900_as_cs CollationID = 293 Collation_utf8mb4_esperanto_ci CollationID = 241 Collation_utf8mb4_estonian_ci CollationID = 230 Collation_utf8mb4_et_0900_ai_ci CollationID = 262 Collation_utf8mb4_et_0900_as_cs CollationID = 285 Collation_utf8mb4_general_ci CollationID = 45 Collation_utf8mb4_german2_ci CollationID = 244 Collation_utf8mb4_hr_0900_ai_ci CollationID = 275 Collation_utf8mb4_hr_0900_as_cs CollationID = 298 Collation_utf8mb4_hu_0900_ai_ci CollationID = 274 Collation_utf8mb4_hu_0900_as_cs CollationID = 297 Collation_utf8mb4_hungarian_ci CollationID = 242 Collation_utf8mb4_icelandic_ci CollationID = 225 Collation_utf8mb4_is_0900_ai_ci CollationID = 257 Collation_utf8mb4_is_0900_as_cs CollationID = 280 Collation_utf8mb4_ja_0900_as_cs CollationID = 303 Collation_utf8mb4_ja_0900_as_cs_ks CollationID = 304 Collation_utf8mb4_la_0900_ai_ci CollationID = 271 Collation_utf8mb4_la_0900_as_cs CollationID = 294 Collation_utf8mb4_latvian_ci CollationID = 226 Collation_utf8mb4_lithuanian_ci CollationID = 236 Collation_utf8mb4_lt_0900_ai_ci CollationID = 268 Collation_utf8mb4_lt_0900_as_cs CollationID = 291 Collation_utf8mb4_lv_0900_ai_ci CollationID = 258 Collation_utf8mb4_lv_0900_as_cs CollationID = 281 Collation_utf8mb4_persian_ci CollationID = 240 Collation_utf8mb4_pl_0900_ai_ci CollationID = 261 Collation_utf8mb4_pl_0900_as_cs CollationID = 284 Collation_utf8mb4_polish_ci CollationID = 229 Collation_utf8mb4_ro_0900_ai_ci CollationID = 259 Collation_utf8mb4_ro_0900_as_cs CollationID = 282 Collation_utf8mb4_roman_ci CollationID = 239 Collation_utf8mb4_romanian_ci CollationID = 227 Collation_utf8mb4_ru_0900_ai_ci CollationID = 306 Collation_utf8mb4_ru_0900_as_cs CollationID = 307 Collation_utf8mb4_sinhala_ci CollationID = 243 Collation_utf8mb4_sk_0900_ai_ci CollationID = 269 Collation_utf8mb4_sk_0900_as_cs CollationID = 292 Collation_utf8mb4_sl_0900_ai_ci CollationID = 260 Collation_utf8mb4_sl_0900_as_cs CollationID = 283 Collation_utf8mb4_slovak_ci CollationID = 237 Collation_utf8mb4_slovenian_ci CollationID = 228 Collation_utf8mb4_spanish2_ci CollationID = 238 Collation_utf8mb4_spanish_ci CollationID = 231 Collation_utf8mb4_sv_0900_ai_ci CollationID = 264 Collation_utf8mb4_sv_0900_as_cs CollationID = 287 Collation_utf8mb4_swedish_ci CollationID = 232 Collation_utf8mb4_tr_0900_ai_ci CollationID = 265 Collation_utf8mb4_tr_0900_as_cs CollationID = 288 Collation_utf8mb4_turkish_ci CollationID = 233 Collation_utf8mb4_unicode_520_ci CollationID = 246 Collation_utf8mb4_unicode_ci CollationID = 224 Collation_utf8mb4_vi_0900_ai_ci CollationID = 277 Collation_utf8mb4_vi_0900_as_cs CollationID = 300 Collation_utf8mb4_vietnamese_ci CollationID = 247 Collation_utf8mb4_zh_0900_as_cs CollationID = 308 Collation_utf8_general_ci = Collation_utf8mb3_general_ci Collation_utf8_tolower_ci = Collation_utf8mb3_tolower_ci Collation_utf8_bin = Collation_utf8mb3_bin Collation_utf8_unicode_ci = Collation_utf8mb3_unicode_ci Collation_utf8_icelandic_ci = Collation_utf8mb3_icelandic_ci Collation_utf8_latvian_ci = Collation_utf8mb3_latvian_ci Collation_utf8_romanian_ci = Collation_utf8mb3_romanian_ci Collation_utf8_slovenian_ci = Collation_utf8mb3_slovenian_ci Collation_utf8_polish_ci = Collation_utf8mb3_polish_ci Collation_utf8_estonian_ci = Collation_utf8mb3_estonian_ci Collation_utf8_spanish_ci = Collation_utf8mb3_spanish_ci Collation_utf8_swedish_ci = Collation_utf8mb3_swedish_ci Collation_utf8_turkish_ci = Collation_utf8mb3_turkish_ci Collation_utf8_czech_ci = Collation_utf8mb3_czech_ci Collation_utf8_danish_ci = Collation_utf8mb3_danish_ci Collation_utf8_lithuanian_ci = Collation_utf8mb3_lithuanian_ci Collation_utf8_slovak_ci = Collation_utf8mb3_slovak_ci Collation_utf8_spanish2_ci = Collation_utf8mb3_spanish2_ci Collation_utf8_roman_ci = Collation_utf8mb3_roman_ci Collation_utf8_persian_ci = Collation_utf8mb3_persian_ci Collation_utf8_esperanto_ci = Collation_utf8mb3_esperanto_ci Collation_utf8_hungarian_ci = Collation_utf8mb3_hungarian_ci Collation_utf8_sinhala_ci = Collation_utf8mb3_sinhala_ci Collation_utf8_german2_ci = Collation_utf8mb3_german2_ci Collation_utf8_croatian_ci = Collation_utf8mb3_croatian_ci Collation_utf8_unicode_520_ci = Collation_utf8mb3_unicode_520_ci Collation_utf8_vietnamese_ci = Collation_utf8mb3_vietnamese_ci Collation_utf8_general_mysql500_ci = Collation_utf8mb3_general_mysql500_ci Collation_Default = Collation_utf8mb4_0900_bin // Collation_Unspecified is used when a collation has not been specified, either explicitly or implicitly. This is // usually used as an intermediate collation to be later replaced by an analyzer pass or a plan, although it is // valid to use it directly. When used, behaves identically to the default collation, although it will NOT match // the default collation. Collation_Unspecified CollationID = 0 )
func ConvertToCollatedString ¶
func ConvertToCollatedString(val interface{}, typ Type) (string, CollationID, error)
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 ParseCollation ¶
func ParseCollation(characterSetStr *string, collationStr *string, binaryAttribute bool) (CollationID, error)
ParseCollation takes in an optional character set and collation, along with the binary attribute if present, and returns a valid collation or error. A nil character set and collation will return the default collation.
func (CollationID) CharacterSet ¶
func (c CollationID) CharacterSet() CharacterSetID
CharacterSet returns the CharacterSetID belonging to this Collation.
func (CollationID) Collation ¶
func (c CollationID) Collation() Collation
Collation returns the Collation with this ID.
func (CollationID) Equals ¶
func (c CollationID) Equals(other CollationID) bool
Equals returns whether the given collation is the same as the calling collation.
func (CollationID) HashToBytes ¶
func (c CollationID) HashToBytes(str string) ([]byte, error)
HashToBytes returns a hash of the given decoded string based on the collation. Collations take each rune's weight into account, therefore two strings with technically different contents may hash to the same value, as the collation considers them the same string. This is equivalent to HashToUint, except that it converts the uint64 to a byte slice.
func (CollationID) HashToUint ¶
func (c CollationID) HashToUint(str string) (uint64, error)
HashToUint returns a hash of the given decoded string based on the collation. Collations take each rune's weight into account, therefore two strings with technically different contents may hash to the same value, as the collation considers them the same string.
func (CollationID) IsCompiled ¶
func (c CollationID) IsCompiled() string
IsCompiled returns a string indicating whether this collation is compiled.
func (CollationID) IsDefault ¶
func (c CollationID) IsDefault() string
IsDefault returns a string indicating whether this collation is the default for the character set.
func (CollationID) Name ¶
func (c CollationID) Name() string
Name returns the name of this collation.
func (CollationID) PadAttribute ¶
func (c CollationID) PadAttribute() string
PadAttribute returns a string representing the pad attribute of the collation.
func (CollationID) SortLength ¶
func (c CollationID) SortLength() int64
SortLength returns the sort length of the collation.
func (CollationID) Sorter ¶
func (c CollationID) Sorter() func(r rune) int32
Sorter returns this collation's sort function. As collations are a work-in-progress, it is recommended to avoid using any collations that return a nil sort function.
func (CollationID) String ¶
func (c CollationID) String() string
String returns the string representation of the Collation.
func (CollationID) WorksWithCharacterSet ¶
func (c CollationID) WorksWithCharacterSet(cs CharacterSetID) bool
WorksWithCharacterSet returns whether the Collation is valid for the given CharacterSet.
type CollationsIterator ¶
type CollationsIterator struct {
// contains filtered or unexported fields
}
CollationsIterator iterates over every collation available, ordered by their ID (ascending).
func NewCollationsIterator ¶
func NewCollationsIterator() *CollationsIterator
NewCollationsIterator returns a new CollationsIterator.
func (*CollationsIterator) Next ¶
func (ci *CollationsIterator) Next() (Collation, bool)
Next returns the next collation. If all collations have been iterated over, returns false.
type Column ¶
type Column struct { // Name is the name of the column. Name string // Type is the data type of the column. Type Type // Default contains the default value of the column or nil if it was not explicitly defined. A nil instance is valid, thus calls do not error. Default *ColumnDefaultValue // AutoIncrement is true if the column auto-increments. AutoIncrement bool // Nullable is true if the column can contain NULL values, or false // otherwise. Nullable bool // Source is the name of the table this column came from. Source string // DatabaseSource is the name of the database this column came from. DatabaseSource string // PrimaryKey is true if the column is part of the primary key for its table. PrimaryKey bool // Comment contains the string comment for this column. Comment string // Extra contains any additional information to put in the `extra` column under `information_schema.columns`. Extra string }
Column is the definition of a table column. As SQL:2016 puts it:
A column is a named component of a table. It has a data type, a default, and a nullability characteristic.
func (*Column) DebugString ¶
type ColumnDefaultValue ¶
type ColumnDefaultValue struct { // Expression is the expression representing this default value Expression // contains filtered or unexported fields }
ColumnDefaultValue is an expression representing the default value of a column. May represent both a default literal and a default expression. A nil pointer of this type represents an implicit default value and is thus valid, so all method calls will return without error.
func NewColumnDefaultValue ¶
func NewColumnDefaultValue(expr Expression, outType Type, representsLiteral bool, parenthesized bool, mayReturnNil bool) (*ColumnDefaultValue, error)
NewColumnDefaultValue returns a new ColumnDefaultValue expression.
func NewUnresolvedColumnDefaultValue ¶
func NewUnresolvedColumnDefaultValue(expr string) *ColumnDefaultValue
NewUnresolvedColumnDefaultValue returns a column default
func (*ColumnDefaultValue) CheckType ¶
func (e *ColumnDefaultValue) CheckType(ctx *Context) error
CheckType validates that the ColumnDefaultValue has the correct type.
func (*ColumnDefaultValue) Children ¶
func (e *ColumnDefaultValue) Children() []Expression
Children implements sql.Expression
func (*ColumnDefaultValue) DebugString ¶
func (e *ColumnDefaultValue) DebugString() string
func (*ColumnDefaultValue) Eval ¶
func (e *ColumnDefaultValue) Eval(ctx *Context, r Row) (interface{}, error)
Eval implements sql.Expression
func (*ColumnDefaultValue) IsLiteral ¶
func (e *ColumnDefaultValue) IsLiteral() bool
IsLiteral returns whether this expression represents a literal default value (otherwise it's an expression default value).
func (*ColumnDefaultValue) IsNullable ¶
func (e *ColumnDefaultValue) IsNullable() bool
IsNullable implements sql.Expression
func (*ColumnDefaultValue) IsParenthesized ¶
func (e *ColumnDefaultValue) IsParenthesized() bool
IsParenthesized returns whether this column default was specified in parentheses, using the expression default value form. It is almost always the opposite of IsLiteral, but there is one edge case where matching MySQL's behavior require that we can distinguish between a non-literal value in parens and a non-literal value not in parens. The edge case is using now/current_timestamp as a column default; now/current_timestamp can be specified without parens for datetime/timestamp fields, but it must be enclosed in parens to be used as the default for other types.
func (*ColumnDefaultValue) Resolved ¶
func (e *ColumnDefaultValue) Resolved() bool
Resolved implements sql.Expression
func (*ColumnDefaultValue) String ¶
func (e *ColumnDefaultValue) String() string
String implements sql.Expression
func (*ColumnDefaultValue) Type ¶
func (e *ColumnDefaultValue) Type() Type
Type implements sql.Expression
func (*ColumnDefaultValue) WithChildren ¶
func (e *ColumnDefaultValue) WithChildren(children ...Expression) (Expression, error)
WithChildren implements sql.Expression
type ColumnExpressionType ¶
ColumnExpressionType returns a column expression along with its Type.
type ColumnOrder ¶
type ColumnOrder struct { First bool // True if this column should come first AfterColumn string // Set to the name of the column after which this column should appear }
ColumnOrder is used in ALTER TABLE statements to change the order of inserted / modified columns.
type CommentedNode ¶
CommentedNode allows comments to be set and retrieved on it
type Context ¶
type Context struct { context.Context Session Memory *MemoryManager ProcessList ProcessList // contains filtered or unexported fields }
Context of the query execution.
func NewContext ¶
func NewContext( ctx context.Context, opts ...ContextOption, ) *Context
NewContext creates a new query context. Options can be passed to configure the context. If some aspect of the context is not configure, the default value will be used. By default, the context will have an empty base session, a noop tracer and a memory manager using the process reporter.
func NewEmptyContext ¶
func NewEmptyContext() *Context
NewEmptyContext returns a default context with default values.
func (*Context) ApplyOpts ¶
func (c *Context) ApplyOpts(opts ...ContextOption)
Applys the options given to the context. Mostly for tests, not safe for use after construction of the context.
func (*Context) KillConnection ¶
Terminate the connection associated with |connID|.
func (*Context) LoadInfile ¶
func (c *Context) LoadInfile(filename string) (io.ReadCloser, error)
Load the remote file |filename| from the client. Returns a |ReadCloser| for the file's contents. Returns an error if this functionality is not supported.
func (*Context) NewCtxWithClient ¶
NewCtxWithClient returns a new Context with the given [client]
func (*Context) NewSubContext ¶
func (c *Context) NewSubContext() (*Context, context.CancelFunc)
NewSubContext creates a new sub-context with the current context as parent. Returns the resulting context.CancelFunc as well as the new *sql.Context, which be used to cancel the new context before the parent is finished.
func (*Context) QueryTime ¶
QueryTime returns the time.Time when the context associated with this query was created
func (*Context) Span ¶
Span creates a new tracing span with the given context. It will return the span and a new context that should be passed to all children of this span.
func (*Context) WithContext ¶
WithContext returns a new context with the given underlying context.
func (*Context) WithCurrentDB ¶
type ContextOption ¶
type ContextOption func(*Context)
ContextOption is a function to configure the context.
func WithMemoryManager ¶
func WithMemoryManager(m *MemoryManager) ContextOption
WithMemoryManager adds the given memory manager to the context.
func WithProcessList ¶
func WithProcessList(p ProcessList) ContextOption
func WithQuery ¶
func WithQuery(q string) ContextOption
WithQuery adds the given query to the context.
func WithRootSpan ¶
func WithRootSpan(s trace.Span) ContextOption
WithRootSpan sets the root span of the context.
func WithServices ¶
func WithServices(services Services) ContextOption
WithServices sets the services for the Context
func WithSession ¶
func WithSession(s Session) ContextOption
WithSession adds the given session to the context.
func WithTracer ¶
func WithTracer(t trace.Tracer) ContextOption
WithTracer adds the given tracer to the context.
type CreateFunc0Args ¶
type CreateFunc0Args func() Expression
type CreateFunc1Args ¶
type CreateFunc1Args func(e1 Expression) Expression
type CreateFunc2Args ¶
type CreateFunc2Args func(e1, e2 Expression) Expression
type CreateFunc3Args ¶
type CreateFunc3Args func(e1, e2, e3 Expression) Expression
type CreateFunc4Args ¶
type CreateFunc4Args func(e1, e2, e3, e4 Expression) Expression
type CreateFunc5Args ¶
type CreateFunc5Args func(e1, e2, e3, e4, e5 Expression) Expression
type CreateFunc6Args ¶
type CreateFunc6Args func(e1, e2, e3, e4, e5, e6 Expression) Expression
type CreateFunc7Args ¶
type CreateFunc7Args func(e1, e2, e3, e4, e5, e6, e7 Expression) Expression
type CreateFuncNArgs ¶
type CreateFuncNArgs func(args ...Expression) (Expression, error)
type Database ¶
type Database interface { Nameable // GetTableInsensitive retrieves a table by its case insensitive name. Implementations should look for exact // (case-sensitive matches) first. If no exact matches are found then any table matching the name case insensitively // should be returned. If there is more than one table that matches a case insensitive comparison the resolution // strategy is not defined. GetTableInsensitive(ctx *Context, tblName string) (Table, bool, error) // GetTableNames returns the table names of every table in the database. It does not return the names of temporary // tables GetTableNames(ctx *Context) ([]string, error) }
Database represents the database.
type DatabaseProvider ¶
type DatabaseProvider interface { // Database gets a Database from the provider. Database(ctx *Context, name string) (Database, error) // HasDatabase checks if the Database exists in the provider. HasDatabase(ctx *Context, name string) bool // AllDatabases returns a slice of all Databases in the provider. AllDatabases(ctx *Context) []Database }
DatabaseProvider is a collection of Database.
func NewDatabaseProvider ¶
func NewDatabaseProvider(dbs ...Database) DatabaseProvider
type Databaseable ¶
type Databaseable interface {
Database() string
}
Databaseable is a node with a string reference to a database
type Databaser ¶
type Databaser interface { // Database the current database. Database() Database // WithDatabase returns a new node instance with the database replaced with // the one given as parameter. WithDatabase(Database) (Node, error) }
Databaser is a node that contains a reference to a database.
type DatetimeType ¶
type DatetimeType interface { Type ConvertWithoutRangeCheck(v interface{}) (time.Time, error) MaximumTime() time.Time MinimumTime() time.Time }
DatetimeType represents DATE, DATETIME, and TIMESTAMP. https://dev.mysql.com/doc/refman/8.0/en/datetime.html The type of the returned value is time.Time.
func CreateDatetimeType ¶
func CreateDatetimeType(baseType query.Type) (DatetimeType, error)
CreateDatetimeType creates a Type dealing with all temporal types that are not TIME nor YEAR.
func MustCreateDatetimeType ¶
func MustCreateDatetimeType(baseType query.Type) DatetimeType
MustCreateDatetimeType is the same as CreateDatetimeType except it panics on errors.
type DebugStringer ¶
type DebugStringer interface { // DebugString prints a debug string of the node in question. DebugString() string }
DebugStringer is shared by implementors of Node and Expression, and is used for debugging the analyzer. It allows a node or expression to be printed in greater detail than its default String() representation.
type DecimalType ¶
type DecimalType interface { Type // ConvertToNullDecimal converts the given value to a decimal.NullDecimal if it has a compatible type. It is worth // noting that Convert() returns a nil value for nil inputs, and also returns decimal.Decimal rather than // decimal.NullDecimal. ConvertToNullDecimal(v interface{}) (decimal.NullDecimal, error) //ConvertNoBoundsCheck normalizes an interface{} to a decimal type without performing expensive bound checks ConvertNoBoundsCheck(v interface{}) (decimal.Decimal, error) // BoundsCheck rounds and validates a decimal BoundsCheck(v decimal.Decimal) (decimal.Decimal, error) // ExclusiveUpperBound returns the exclusive upper bound for this Decimal. // For example, DECIMAL(5,2) would return 1000, as 999.99 is the max represented. ExclusiveUpperBound() decimal.Decimal // MaximumScale returns the maximum scale allowed for the current precision. MaximumScale() uint8 // Precision returns the base-10 precision of the type, which is the total number of digits. For example, a // precision of 3 means that 999, 99.9, 9.99, and .999 are all valid maximums (depending on the scale). Precision() uint8 // Scale returns the scale, or number of digits after the decimal, that may be held. // This will always be less than or equal to the precision. Scale() uint8 }
DecimalType represents the DECIMAL type. https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html The type of the returned value is decimal.Decimal.
var InternalDecimalType 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.
func CreateColumnDecimalType ¶
func CreateColumnDecimalType(precision uint8, scale uint8) (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 CreateDecimalType ¶
func CreateDecimalType(precision uint8, scale uint8) (DecimalType, error)
CreateDecimalType creates a DecimalType for NON-TABLE-COLUMN.
func MustCreateColumnDecimalType ¶
func MustCreateColumnDecimalType(precision uint8, scale uint8) DecimalType
MustCreateColumnDecimalType is the same as CreateDecimalType except it panics on errors and for VALID-TABLE-COLUMN.
func MustCreateDecimalType ¶
func MustCreateDecimalType(precision uint8, scale uint8) DecimalType
MustCreateDecimalType is the same as CreateDecimalType except it panics on errors and for NON-TABLE-COLUMN.
type DeferredType ¶
DeferredType is a placeholder for prepared statements that is replaced by the BindVar type on re-analysis.
type DeletableTable ¶
type DeletableTable interface { Table // Deleter returns a RowDeleter for this table. The RowDeleter will get one call to Delete for each row to be deleted, // and will end with a call to Close() to finalize the delete operation. Deleter(*Context) RowDeleter }
DeleteableTable is a table that can process the deletion of rows
type Disposable ¶
type Disposable interface {
// Dispose the contents.
Dispose()
}
Disposable objects can erase all their content when they're no longer in use. Expressions and Nodes that implement Disposable will have Dispose called on them as a final stage of query execution. This can be used to clean up cached memory that wouldn't get caught via the normal garbage collection process.
type DisposeFunc ¶
type DisposeFunc func()
DisposeFunc is a function to completely erase a cache and remove it from the manager.
type DriverIndex ¶
An indexed managed by a driver, as opposed to natively by a DB table.
type DriverIndexLookup ¶
type DriverIndexLookup interface { Lookup() IndexLookup // Values returns the values in the subset of the index. These are used to populate the index via the driver. Values(Partition) (IndexValueIter, error) // Indexes returns the IDs of all indexes involved in this lookup. Indexes() []string }
DriverIndexLookup is a subset of an index. More specific interfaces can be implemented to grant more capabilities to the index lookup.
type DriverIndexableTable ¶
type DriverIndexableTable interface { IndexAddressableTable WithDriverIndexLookup(DriverIndexLookup) Table // IndexKeyValues returns an iterator over partitions and ultimately the rows of the table to compute the value of an // index for every row in this table. Used when creating an index for access through an IndexDriver. IndexKeyValues(*Context, []string) (PartitionIndexKeyValueIter, error) }
DriverIndexableTable represents a table that supports being indexed and receiving indexes to be able to speed up its execution.
type EmptyProcessList ¶
type EmptyProcessList struct{}
EmptyProcessList is a no-op implementation of ProcessList suitable for use in tests or other installations that don't require a process list
func (EmptyProcessList) AddPartitionProgress ¶
func (e EmptyProcessList) AddPartitionProgress(pid uint64, tableName, partitionName string, total int64)
func (EmptyProcessList) AddProcess ¶
func (e EmptyProcessList) AddProcess(ctx *Context, query string) (*Context, error)
func (EmptyProcessList) AddTableProgress ¶
func (e EmptyProcessList) AddTableProgress(pid uint64, name string, total int64)
func (EmptyProcessList) Done ¶
func (e EmptyProcessList) Done(pid uint64)
func (EmptyProcessList) Kill ¶
func (e EmptyProcessList) Kill(connID uint32)
func (EmptyProcessList) Processes ¶
func (e EmptyProcessList) Processes() []Process
func (EmptyProcessList) RemovePartitionProgress ¶
func (e EmptyProcessList) RemovePartitionProgress(pid uint64, tableName, partitionName string)
func (EmptyProcessList) RemoveTableProgress ¶
func (e EmptyProcessList) RemoveTableProgress(pid uint64, name string)
func (EmptyProcessList) UpdatePartitionProgress ¶
func (e EmptyProcessList) UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64)
func (EmptyProcessList) UpdateTableProgress ¶
func (e EmptyProcessList) UpdateTableProgress(pid uint64, name string, delta int64)
type Engine ¶
type Engine struct { Name string // contains filtered or unexported fields }
Engine represents a sql engine.
func (Engine) Savepoints ¶
Savepoints returns whether the storage engine supports savepoints.
func (Engine) Transactions ¶
Transactions returns whether the storage engine supports transactions.
type EnumType ¶
type EnumType interface { Type // At returns the string at the given index, as well if the string was found. At(index int) (string, bool) CharacterSet() CharacterSetID Collation() CollationID // IndexOf returns the index of the given string. If the string was not found, then this returns -1. IndexOf(v string) int // NumberOfElements returns the number of enumerations. NumberOfElements() uint16 // Values returns the elements, in order, of every enumeration. Values() []string }
EnumType represents the ENUM type. https://dev.mysql.com/doc/refman/8.0/en/enum.html The type of the returned value is uint16.
func CreateEnumType ¶
func CreateEnumType(values []string, collation CollationID) (EnumType, error)
CreateEnumType creates a EnumType.
func MustCreateEnumType ¶
func MustCreateEnumType(values []string, collation CollationID) EnumType
MustCreateEnumType is the same as CreateEnumType except it panics on errors.
type Expression ¶
type Expression interface { Resolvable fmt.Stringer // Type returns the expression type. Type() Type // IsNullable returns whether the expression can be null. IsNullable() bool // Eval evaluates the given row and returns a result. Eval(ctx *Context, row Row) (interface{}, error) // Children returns the children expressions of this expression. Children() []Expression // WithChildren returns a copy of the expression with children replaced. // It will return an error if the number of children is different than // the current number of children. They must be given in the same order // as they are returned by Children. WithChildren(children ...Expression) (Expression, error) }
Expression is a combination of one or more SQL expressions.
func NillaryWithChildren ¶
func NillaryWithChildren(expr Expression, children ...Expression) (Expression, error)
NillaryWithChildren is a common implementation of expression.WithChildren for expressions with no children.
type Expression2 ¶
type Expressioner ¶
type Expressioner interface { // Expressions returns the list of expressions contained by the node. Expressions() []Expression // WithExpressions returns a copy of the node with expressions replaced. // It will return an error if the number of expressions is different than // the current number of expressions. They must be given in the same order // as they are returned by Expressions. WithExpressions(...Expression) (Node, error) }
Expressioner is a node that contains expressions.
type ExternalStoredProcedureDetails ¶
type ExternalStoredProcedureDetails struct { // Name is the name of the external stored procedure. If two external stored procedures share a name, then they're // considered overloaded. Standard stored procedures do not support overloading. Name string // Schema describes the row layout of the RowIter returned from Function. Schema Schema // Function is the implementation of the external stored procedure. All functions should have the following definition: // `func(*Context, <PARAMETERS>) (RowIter, error)`. The <PARAMETERS> may be any of the following types: `bool`, // `string`, `[]byte`, `int8`-`int64`, `uint8`-`uint64`, `float32`, `float64`, `time.Time`, or `Decimal` // (shopspring/decimal). The architecture-dependent types `int` and `uint` (without a number) are also supported. // It is valid to return a nil RowIter if there are no rows to be returned. // // Each parameter, by default, is an IN parameter. If the parameter type is a pointer, e.g. `*int32`, then it // becomes an INOUT parameter. There is no way to set a parameter as an OUT parameter. // // Values are converted to their nearest type before being passed in, following the conversion rules of their // related SQL types. The exceptions are `time.Time` (treated as a `DATETIME`), string (treated as a `LONGTEXT` with // the default collation) and Decimal (treated with a larger precision and scale). Take extra care when using decimal // for an INOUT parameter, to ensure that the returned value fits the original's precision and scale, else an error // will occur. // // As functions support overloading, each variant must have a completely unique function signature to prevent // ambiguity. Uniqueness is determined by the number of parameters. If two functions are returned that have the same // name and same number of parameters, then an error is thrown. If the last parameter is variadic, then the stored // procedure functions as though it has the integer-max number of parameters. When an exact match is not found for // overloaded functions, the largest function is used (which in this case will be the variadic function). Also, due // to the usage of the integer-max for the parameter count, only one variadic function is allowed per function name. // The type of the variadic parameter may not have a pointer type. Function interface{} }
ExternalStoredProcedureDetails are the details of an external stored procedure. Compared to standard stored procedures, external ones are considered "built-in", in that they're not created by the user, and may not be modified or deleted by a user. In addition, they're implemented as a function taking standard parameters, compared to stored procedures being implemented as expressions.
func (ExternalStoredProcedureDetails) FakeCreateProcedureStmt ¶
func (espd ExternalStoredProcedureDetails) FakeCreateProcedureStmt() string
FakeCreateProcedureStmt returns a parseable CREATE PROCEDURE statement for this external stored procedure, as some tools (such as Java's JDBC connector) require a valid statement in some situations.
type ExternalStoredProcedureProvider ¶
type ExternalStoredProcedureProvider interface { // ExternalStoredProcedure returns the external stored procedure details for the procedure with the specified name // that is able to accept the specified number of parameters. If no matching external stored procedure is found, // nil, nil is returned. If an unexpected error is encountered, it is returned as the error parameter. ExternalStoredProcedure(ctx *Context, name string, numOfParams int) (*ExternalStoredProcedureDetails, error) // ExternalStoredProcedures returns a slice of all external stored procedure details with the specified name. External // stored procedures can overload the same name with different arguments, so this method enables a caller to see all // available variants with the specified name. If no matching external stored procedures are found, an // empty slice is returned, with a nil error. If an unexpected error is encountered, it is returned as the // error parameter. ExternalStoredProcedures(ctx *Context, name string) ([]ExternalStoredProcedureDetails, error) }
ExternalStoredProcedureProvider provides access to built-in stored procedures. These procedures are implemented as functions, instead of as SQL statements. The returned stored procedures cannot be modified or deleted.
type ExternalStoredProcedureRegistry ¶
type ExternalStoredProcedureRegistry struct {
// contains filtered or unexported fields
}
ExternalStoredProcedureRegistry manages a collection of ExternalStoredProcedures and encapsulates the logic for looking up external stored procedures based on name and number of arguments.
func NewExternalStoredProcedureRegistry ¶
func NewExternalStoredProcedureRegistry() ExternalStoredProcedureRegistry
NewExternalStoredProcedureRegistry creates a new, empty instance of ExternalStoredProcedureRegistry.
func (*ExternalStoredProcedureRegistry) LookupByName ¶
func (epd *ExternalStoredProcedureRegistry) LookupByName(name string) ([]ExternalStoredProcedureDetails, error)
LookupByName returns all stored procedure variants registered with the specified name, no matter how many parameters they require. If no external stored procedures are registered with the specified name, nil is returned, with no error. If an unexpected error occurs, it is returned as the error parameter.
func (*ExternalStoredProcedureRegistry) LookupByNameAndParamCount ¶
func (epd *ExternalStoredProcedureRegistry) LookupByNameAndParamCount(name string, numOfParams int) (*ExternalStoredProcedureDetails, error)
LookupByNameAndParamCount returns the external stored procedure registered with the specified name and able to accept the specified number of parameters. If no external stored procedures are registered with the specified name and able to accept the specified number of parameters, nil is returned with no error. If an unexpected error occurs, it is returned as the error param.
func (*ExternalStoredProcedureRegistry) Register ¶
func (epd *ExternalStoredProcedureRegistry) Register(procedureDetails ExternalStoredProcedureDetails)
Register adds an external stored procedure to this registry.
type FastIntSet ¶
type FastIntSet struct {
// contains filtered or unexported fields
}
FastIntSet keeps track of a set of integers. It does not perform any allocations when the values are small. It is not thread-safe.
func NewFastIntSet ¶
func NewFastIntSet(vals ...int) FastIntSet
NewFastIntSet returns a set initialized with the given values.
func (*FastIntSet) Add ¶
func (s *FastIntSet) Add(i int)
Add adds a value to the set. No-op if the value is already in the set.
func (*FastIntSet) AddRange ¶
func (s *FastIntSet) AddRange(from, to int)
AddRange adds values 'from' up to 'to' (inclusively) to the set. E.g. AddRange(1,5) adds the values 1, 2, 3, 4, 5 to the set. 'to' must be >= 'from'. AddRange is always more efficient than individual Adds.
func (FastIntSet) Contains ¶
func (s FastIntSet) Contains(i int) bool
Contains returns true if the set contains the value.
func (FastIntSet) Copy ¶
func (s FastIntSet) Copy() FastIntSet
Copy returns a copy of s which can be modified independently.
func (*FastIntSet) CopyFrom ¶
func (s *FastIntSet) CopyFrom(c FastIntSet)
CopyFrom sets the receiver to a copy of c, which can then be modified independently.
func (FastIntSet) Difference ¶
func (s FastIntSet) Difference(rhs FastIntSet) FastIntSet
Difference returns the elements of s that are not in rhs as a new set.
func (*FastIntSet) DifferenceWith ¶
func (s *FastIntSet) DifferenceWith(rhs FastIntSet)
DifferenceWith removes any elements in rhs from this set.
func (FastIntSet) Equals ¶
func (s FastIntSet) Equals(rhs FastIntSet) bool
Equals returns true if the two sets are identical.
func (FastIntSet) ForEach ¶
func (s FastIntSet) ForEach(f func(i int))
ForEach calls a function for each value in the set (in increasing order).
func (FastIntSet) Intersection ¶
func (s FastIntSet) Intersection(rhs FastIntSet) FastIntSet
Intersection returns the intersection of s and rhs as a new set.
func (*FastIntSet) IntersectionWith ¶
func (s *FastIntSet) IntersectionWith(rhs FastIntSet)
IntersectionWith removes any elements not in rhs from this set.
func (FastIntSet) Intersects ¶
func (s FastIntSet) Intersects(rhs FastIntSet) bool
Intersects returns true if s has any elements in common with rhs.
func (FastIntSet) Len ¶
func (s FastIntSet) Len() int
Len returns the number of the elements in the set.
func (FastIntSet) Next ¶
func (s FastIntSet) Next(startVal int) (int, bool)
Next returns the first value in the set which is >= startVal. If there is no value, the second return value is false.
func (FastIntSet) Ordered ¶
func (s FastIntSet) Ordered() []int
Ordered returns a slice with all the integers in the set, in increasing order.
func (*FastIntSet) Remove ¶
func (s *FastIntSet) Remove(i int)
Remove removes a value from the set. No-op if the value is not in the set.
func (*FastIntSet) Shift ¶
func (s *FastIntSet) Shift(delta int) FastIntSet
Shift generates a new set which contains elements i+delta for elements i in the original set.
func (FastIntSet) String ¶
func (s FastIntSet) String() string
String returns a list representation of elements. Sequential runs of positive numbers are shown as ranges. For example, for the set {0, 1, 2, 5, 6, 10}, the output is "(0-2,5,6,10)".
func (FastIntSet) SubsetOf ¶
func (s FastIntSet) SubsetOf(rhs FastIntSet) bool
SubsetOf returns true if rhs contains all the elements in s.
func (FastIntSet) Union ¶
func (s FastIntSet) Union(rhs FastIntSet) FastIntSet
Union returns the union of s and rhs as a new set.
func (*FastIntSet) UnionWith ¶
func (s *FastIntSet) UnionWith(rhs FastIntSet)
UnionWith adds all the elements from rhs to this set.
type FilteredIndex ¶
type FilteredIndex interface { Index // HandledFilters returns a subset of |filters| that are satisfied // by index lookups to this index. HandledFilters(filters []Expression) (handled []Expression) }
FilteredIndex is an extension of |Index| that allows an index to declare certain filter predicates handled, allowing them to be removed from the overall plan for greater execution efficiency
type FilteredTable ¶
type FilteredTable interface { Table Filters() []Expression HandledFilters(filters []Expression) []Expression WithFilters(ctx *Context, filters []Expression) Table }
FilteredTable is a table that can produce a specific RowIter that's more optimized given the filters.
type ForeignKeyConstraint ¶
type ForeignKeyConstraint struct { Name string Database string Table string Columns []string ParentDatabase string ParentTable string ParentColumns []string OnUpdate ForeignKeyReferentialAction OnDelete ForeignKeyReferentialAction IsResolved bool }
ForeignKeyConstraint declares a constraint between the columns of two tables.
func (*ForeignKeyConstraint) DebugString ¶
func (f *ForeignKeyConstraint) DebugString() string
func (ForeignKeyConstraint) IsSelfReferential ¶
func (f ForeignKeyConstraint) IsSelfReferential() bool
IsSelfReferential returns whether this foreign key represents a self-referential foreign key.
type ForeignKeyReferentialAction ¶
type ForeignKeyReferentialAction string
ForeignKeyReferentialAction is the behavior for this foreign key with the relevant action is performed on the foreign table.
const ( ForeignKeyReferentialAction_DefaultAction ForeignKeyReferentialAction = "DEFAULT" // No explicit action was specified ForeignKeyReferentialAction_Restrict ForeignKeyReferentialAction = "RESTRICT" ForeignKeyReferentialAction_Cascade ForeignKeyReferentialAction = "CASCADE" ForeignKeyReferentialAction_NoAction ForeignKeyReferentialAction = "NO ACTION" ForeignKeyReferentialAction_SetNull ForeignKeyReferentialAction = "SET NULL" ForeignKeyReferentialAction_SetDefault ForeignKeyReferentialAction = "SET DEFAULT" )
type ForeignKeyTable ¶
type ForeignKeyTable interface { IndexAddressableTable // CreateIndexForForeignKey creates an index for this table, using the provided parameters. Indexes created through // this function are specifically ones generated for use with a foreign key. Returns an error if the index name // already exists, or an index on the same columns already exists. CreateIndexForForeignKey(ctx *Context, indexDef IndexDef) error // GetDeclaredForeignKeys returns the foreign key constraints that are declared by this table. GetDeclaredForeignKeys(ctx *Context) ([]ForeignKeyConstraint, error) // GetReferencedForeignKeys returns the foreign key constraints that are referenced by this table. GetReferencedForeignKeys(ctx *Context) ([]ForeignKeyConstraint, error) // AddForeignKey adds the given foreign key constraint to the table. Returns an error if the foreign key name // already exists on any other table within the database. AddForeignKey(ctx *Context, fk ForeignKeyConstraint) error // DropForeignKey removes a foreign key from the table. DropForeignKey(ctx *Context, fkName string) error // UpdateForeignKey updates the given foreign key constraint. May range from updated table names to setting the // IsResolved boolean. UpdateForeignKey(ctx *Context, fkName string, fk ForeignKeyConstraint) error // GetForeignKeyUpdater returns a ForeignKeyUpdater for this table. GetForeignKeyUpdater(ctx *Context) ForeignKeyUpdater }
ForeignKeyTable is a table that can declare its foreign key constraints, as well as be referenced.
type ForeignKeyUpdater ¶
type ForeignKeyUpdater interface { RowInserter RowUpdater RowDeleter IndexAddressable }
ForeignKeyUpdater is a TableEditor that is addressable via IndexLookup.
type Freeable ¶
type Freeable interface {
// Free the memory.
Free()
}
Freeable objects can free their memory.
type Function ¶
type Function interface { // NewInstance returns a new instance of the function to evaluate against rows NewInstance([]Expression) (Expression, error) // FunctionName returns the name of this function FunctionName() string // contains filtered or unexported methods }
Function is a function defined by the user that can be applied in a SQL query.
type Function0 ¶
type Function0 struct { Name string Fn CreateFunc0Args }
Function0 is a function with 0 arguments.
func NewFunction0 ¶
func NewFunction0(name string, fn func() Expression) Function0
func (Function0) FunctionName ¶
func (Function0) NewInstance ¶
func (fn Function0) NewInstance(args []Expression) (Expression, error)
type Function1 ¶
type Function1 struct { Name string Fn CreateFunc1Args }
Function1 is a function with 1 argument.
func (Function1) FunctionName ¶
func (Function1) NewInstance ¶
func (fn Function1) NewInstance(args []Expression) (Expression, error)
type Function2 ¶
type Function2 struct { Name string Fn CreateFunc2Args }
Function2 is a function with 2 arguments.
func (Function2) FunctionName ¶
func (Function2) NewInstance ¶
func (fn Function2) NewInstance(args []Expression) (Expression, error)
type Function3 ¶
type Function3 struct { Name string Fn CreateFunc3Args }
Function3 is a function with 3 arguments.
func (Function3) FunctionName ¶
func (Function3) NewInstance ¶
func (fn Function3) NewInstance(args []Expression) (Expression, error)
type Function4 ¶
type Function4 struct { Name string Fn CreateFunc4Args }
Function4 is a function with 4 arguments.
func (Function4) FunctionName ¶
func (Function4) NewInstance ¶
func (fn Function4) NewInstance(args []Expression) (Expression, error)
type Function5 ¶
type Function5 struct { Name string Fn CreateFunc5Args }
Function5 is a function with 5 arguments.
func (Function5) FunctionName ¶
func (Function5) NewInstance ¶
func (fn Function5) NewInstance(args []Expression) (Expression, error)
type Function6 ¶
type Function6 struct { Name string Fn CreateFunc6Args }
Function6 is a function with 6 arguments.
func (Function6) FunctionName ¶
func (Function6) NewInstance ¶
func (fn Function6) NewInstance(args []Expression) (Expression, error)
type Function7 ¶
type Function7 struct { Name string Fn CreateFunc7Args }
Function7 is a function with 7 arguments.
func (Function7) FunctionName ¶
func (Function7) NewInstance ¶
func (fn Function7) NewInstance(args []Expression) (Expression, error)
type FunctionExpression ¶
type FunctionExpression interface { Expression FunctionName() string Description() string }
FunctionExpression is an Expression that represents a function.
type FunctionN ¶
type FunctionN struct { Name string Fn CreateFuncNArgs }
FunctionN is a function with variable number of arguments. This function is expected to return ErrInvalidArgumentNumber if the arity does not match, since the check has to be done in the implementation.
func (FunctionN) FunctionName ¶
func (FunctionN) NewInstance ¶
func (fn FunctionN) NewInstance(args []Expression) (Expression, error)
type FunctionProvider ¶
type FunctionProvider interface { // Function returns the function with the name provided, case-insensitive Function(ctx *Context, name string) (Function, error) }
FunctionProvider is an extension of DatabaseProvider that allows custom functions to be provided
type Generator ¶
type Generator interface { // Next value in the generator. Next() (interface{}, error) // Close the generator and dispose resources. Close() error }
Generator will generate a set of values for a given row.
func NewArrayGenerator ¶
func NewArrayGenerator(array []interface{}) Generator
NewArrayGenerator creates a generator for a given array.
func ToGenerator ¶
ToGenerator converts a value to a generator if possible.
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 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() Type
Promote implements the Type interface.
func (GeomCollType) SetSRID ¶
func (t GeomCollType) SetSRID(v uint32) 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 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() Type
Promote implements the Type interface.
func (GeometryType) SetSRID ¶
func (t GeometryType) SetSRID(v uint32) 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 // 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 Histogram ¶
type Histogram struct { Buckets []*HistogramBucket Mean float64 Min float64 Max float64 Count uint64 NullCount uint64 DistinctCount uint64 }
Histogram is all statistics we care about for each column
type HistogramBucket ¶
type HistogramBucket struct { LowerBound float64 // inclusive UpperBound float64 // inclusive Frequency float64 }
HistogramBucket represents a bucket in a histogram inspiration pulled from MySQL and Cockroach DB
type HistogramMap ¶
HistogramMap is a map from column name to associated histogram
func NewHistogramMapFromTable ¶
func NewHistogramMapFromTable(ctx *Context, t Table) (HistogramMap, error)
NewHistogramMapFromTable will construct a HistogramMap given a Table TODO: have option for number of buckets (and logic to convert freqMap into those buckets) TODO: could iterate over Partitions asynchronously (after exchange is rewritten)
type IgnorableError ¶
type IgnorableError struct {
OffendingRow Row
}
IgnorableError is used propagate information about an error that needs to be ignored and does not interfere with any update accumulators
func NewIgnorableError ¶
func NewIgnorableError(row Row) IgnorableError
func (IgnorableError) Error ¶
func (e IgnorableError) Error() string
type Index ¶
type Index interface { // ID returns the identifier of the index. ID() string // Database returns the database name this index belongs to. Database() string // Table returns the table name this index belongs to. Table() string // Expressions returns the indexed expressions. If the result is more than // one expression, it means the index has multiple columns indexed. If it's // just one, it means it may be an expression or a column. Expressions() []string // IsUnique returns whether this index is unique IsUnique() bool // Comment returns the comment for this index Comment() string // IndexType returns the type of this index, e.g. BTREE IndexType() string // IsGenerated returns whether this index was generated. Generated indexes // are used for index access, but are not displayed (such as with SHOW INDEXES). IsGenerated() bool // ColumnExpressionTypes returns each expression and its associated Type. // Each expression string should exactly match the string returned from // Index.Expressions(). ColumnExpressionTypes() []ColumnExpressionType // CanSupport returns whether this index supports lookups on the given // range filters. CanSupport(...Range) bool // PrefixLengths returns the prefix lengths for each column in this index PrefixLengths() []uint16 }
Index is the representation of an index, and also creates an IndexLookup when given a collection of ranges.
type IndexAddressable ¶
type IndexAddressable interface { // IndexedAccess returns a table that can perform scans constrained to // an IndexLookup on the index given IndexedAccess(Index) IndexedTable // GetIndexes returns an array of this table's Indexes GetIndexes(ctx *Context) ([]Index, error) }
IndexAddressable is a table that can be scanned through a primary index
type IndexAddressableTable ¶
type IndexAddressableTable interface { Table IndexAddressable }
type IndexAlterableTable ¶
type IndexAlterableTable interface { Table // CreateIndex creates an index for this table, using the provided parameters. // Returns an error if the index name already exists, or an index with the same columns already exists. CreateIndex(ctx *Context, indexDef IndexDef) error // DropIndex removes an index from this table, if it exists. // Returns an error if the removal failed or the index does not exist. DropIndex(ctx *Context, indexName string) error // RenameIndex renames an existing index to another name that is not already taken by another index on this table. RenameIndex(ctx *Context, fromIndexName string, toIndexName string) error }
IndexAlterableTable represents a table that supports index modification operations.
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
IndexBuilder builds ranges based on the combination of calls made for the given index, and then relies on the Index to return an IndexLookup from the created ranges.
func NewIndexBuilder ¶
func NewIndexBuilder(idx Index) *IndexBuilder
NewIndexBuilder returns a new IndexBuilder. Used internally to construct a range that will later be passed to integrators through the Index function NewLookup.
func (*IndexBuilder) Build ¶
func (b *IndexBuilder) Build(ctx *Context) (IndexLookup, error)
Build constructs a new IndexLookup based on the ranges that have been built internally by this builder.
func (*IndexBuilder) Equals ¶
func (b *IndexBuilder) Equals(ctx *Context, colExpr string, keys ...interface{}) *IndexBuilder
Equals represents colExpr = key. For IN expressions, pass all of them in the same Equals call.
func (*IndexBuilder) GreaterOrEqual ¶
func (b *IndexBuilder) GreaterOrEqual(ctx *Context, colExpr string, key interface{}) *IndexBuilder
GreaterOrEqual represents colExpr >= key.
func (*IndexBuilder) GreaterThan ¶
func (b *IndexBuilder) GreaterThan(ctx *Context, colExpr string, key interface{}) *IndexBuilder
GreaterThan represents colExpr > key.
func (*IndexBuilder) IsNotNull ¶
func (b *IndexBuilder) IsNotNull(ctx *Context, colExpr string) *IndexBuilder
IsNotNull represents colExpr != nil
func (*IndexBuilder) IsNull ¶
func (b *IndexBuilder) IsNull(ctx *Context, colExpr string) *IndexBuilder
IsNull represents colExpr = nil
func (*IndexBuilder) LessOrEqual ¶
func (b *IndexBuilder) LessOrEqual(ctx *Context, colExpr string, key interface{}) *IndexBuilder
LessOrEqual represents colExpr <= key.
func (*IndexBuilder) LessThan ¶
func (b *IndexBuilder) LessThan(ctx *Context, colExpr string, key interface{}) *IndexBuilder
LessThan represents colExpr < key.
func (*IndexBuilder) NotEquals ¶
func (b *IndexBuilder) NotEquals(ctx *Context, colExpr string, key interface{}) *IndexBuilder
NotEquals represents colExpr <> key.
func (*IndexBuilder) Ranges ¶
func (b *IndexBuilder) Ranges(ctx *Context) RangeCollection
Ranges returns all ranges for this index builder. If the builder is in an error state then this returns nil.
type IndexColumn ¶
type IndexColumn struct { Name string // Length represents the index prefix length. If zero, then no length was specified. Length int64 }
IndexColumn is the column by which to add to an index.
type IndexConstraint ¶
type IndexConstraint byte
IndexConstraint represents any constraints that should be applied to the index.
const ( IndexConstraint_None IndexConstraint = iota IndexConstraint_Unique IndexConstraint_Fulltext IndexConstraint_Spatial IndexConstraint_Primary )
type IndexDef ¶
type IndexDef struct { Name string Columns []IndexColumn Constraint IndexConstraint Storage IndexUsing Comment string }
type IndexDriver ¶
type IndexDriver interface { // ID returns the unique name of the driver. ID() string // Create a new index. If exprs is more than one expression, it means the // index has multiple columns indexed. If it's just one, it means it may // be an expression or a column. Create(db, table, id string, expressions []Expression, config map[string]string) (DriverIndex, error) // LoadAll loads all indexes for given db and table. LoadAll(ctx *Context, db, table string) ([]DriverIndex, error) // Save the given index for all partitions. Save(*Context, DriverIndex, PartitionIndexKeyValueIter) error // Delete the given index for all partitions in the iterator. Delete(DriverIndex, PartitionIter) error }
IndexDriver manages the coordination between the indexes and their representation on disk.
type IndexKeyValueIter ¶
type IndexKeyValueIter interface { // Next returns the next tuple of index key values. The length of the // returned slice will be the same as the number of columns used to // create this iterator. The second returned parameter is a repo's location. Next(*Context) ([]interface{}, []byte, error) Closer }
IndexKeyValueIter is an iterator of index key values, that is, a tuple of the values that will be index keys.
type IndexLookup ¶
type IndexLookup struct { Index Index Ranges RangeCollection // IsPointLookup is true if the lookup will return one or zero // values; the range is null safe, the index is unique, every index // column has a range expression, and every range expression is an // exact equality. IsPointLookup bool IsEmptyRange bool }
IndexLookup is the implementation-specific definition of an index lookup. The IndexLookup must contain all necessary information to retrieve exactly the rows in the table as specified by the ranges given to their parent index. Implementors are responsible for all semantics of correctly returning rows that match an index lookup.
func (IndexLookup) DebugString ¶
func (il IndexLookup) DebugString() string
func (IndexLookup) IsEmpty ¶
func (il IndexLookup) IsEmpty() bool
func (IndexLookup) String ¶
func (il IndexLookup) String() string
type IndexOrder ¶
type IndexOrder byte
const ( IndexOrderNone IndexOrder = iota IndexOrderAsc IndexOrderDesc )
type IndexRegistry ¶
type IndexRegistry struct { // Root path where all the data of the indexes is stored on disk. Root string // contains filtered or unexported fields }
IndexRegistry keeps track of all driver-provided indexes in the engine.
func NewIndexRegistry ¶
func NewIndexRegistry() *IndexRegistry
NewIndexRegistry returns a new Index Registry.
func (*IndexRegistry) AddIndex ¶
func (r *IndexRegistry) AddIndex( idx DriverIndex, ) (created chan<- struct{}, ready <-chan struct{}, err error)
AddIndex adds the given index to the registry. The added index will be marked as creating, so nobody can register two indexes with the same expression or id while the other is still being created. When something is sent through the returned channel, it means the index has finished its creation and will be marked as ready. Another channel is returned to notify the user when the index is ready.
func (*IndexRegistry) CanRemoveIndex ¶
func (r *IndexRegistry) CanRemoveIndex(idx Index) bool
CanRemoveIndex returns whether the given index is ready to be removed.
func (*IndexRegistry) CanUseIndex ¶
func (r *IndexRegistry) CanUseIndex(idx Index) bool
CanUseIndex returns whether the given index is ready to use or not.
func (*IndexRegistry) DefaultIndexDriver ¶
func (r *IndexRegistry) DefaultIndexDriver() IndexDriver
DefaultIndexDriver returns the default index driver, which is the only driver when there is 1 driver in the registry. If there are more than 1 drivers in the registry, this will return the empty string, as there is no clear default driver.
func (*IndexRegistry) DeleteIndex ¶
func (r *IndexRegistry) DeleteIndex(db, id string, force bool) (<-chan struct{}, error)
DeleteIndex deletes an index from the registry by its id. First, it marks the index for deletion but does not remove it, so queries that are using it may still do so. The returned channel will send a message when the index can be deleted from disk. If force is true, it will delete the index even if it's not ready for usage. Only use that parameter if you know what you're doing.
func (*IndexRegistry) ExpressionsWithIndexes ¶
func (r *IndexRegistry) ExpressionsWithIndexes( db string, exprs ...Expression, ) [][]Expression
ExpressionsWithIndexes finds all the combinations of expressions with matching indexes. This only matches multi-column indexes.
func (*IndexRegistry) HasIndexes ¶
func (r *IndexRegistry) HasIndexes() bool
HasIndexes returns whether the index registry has any registered indexes. Not thread safe, so the answer is approximate in the face of drivers and indexes being added and removed.
func (*IndexRegistry) Index ¶
func (r *IndexRegistry) Index(db, id string) DriverIndex
Index returns the index with the given id. It may return nil if the index is not found.
func (*IndexRegistry) IndexDriver ¶
func (r *IndexRegistry) IndexDriver(id string) IndexDriver
IndexDriver returns the IndexDriver with the given ID.
func (*IndexRegistry) IndexesByTable ¶
func (r *IndexRegistry) IndexesByTable(db, table string) []DriverIndex
IndexesByTable returns a slice of all the indexes existing on the given table.
func (*IndexRegistry) LoadIndexes ¶
func (r *IndexRegistry) LoadIndexes(ctx *Context, dbs []Database) error
LoadIndexes creates load functions for all indexes for all dbs, tables and drivers. These functions are called as needed by the query
func (*IndexRegistry) MarkOutdated ¶
func (r *IndexRegistry) MarkOutdated(idx Index)
MarkOutdated sets the index status as outdated. This method is not thread safe and should not be used directly except for testing.
func (*IndexRegistry) MatchingIndex ¶
func (r *IndexRegistry) MatchingIndex(ctx *Context, db string, expr ...Expression) (index Index, prefixCount int, err error)
MatchingIndex returns the index that best fits the given expressions. See analyzer.MatchingIndexes for the rules regarding which index is considered the best. If no index matches then returns nil.
func (*IndexRegistry) RegisterIndexDriver ¶
func (r *IndexRegistry) RegisterIndexDriver(driver IndexDriver)
RegisterIndexDriver registers a new index driver.
func (*IndexRegistry) ReleaseIndex ¶
func (r *IndexRegistry) ReleaseIndex(idx Index)
ReleaseIndex releases an index after it's been used.
type IndexStatus ¶
type IndexStatus byte
IndexStatus represents the current status in which the index is.
const ( // IndexNotReady means the index is not ready to be used. IndexNotReady IndexStatus = iota // IndexReady means the index can be used. IndexReady // IndexOutdated means the index is loaded but will not be used because the // contents in it are outdated. IndexOutdated )
func (IndexStatus) IsUsable ¶
func (s IndexStatus) IsUsable() bool
IsUsable returns whether the index can be used or not based on the status.
func (IndexStatus) String ¶
func (s IndexStatus) String() string
type IndexUsing ¶
type IndexUsing byte
IndexUsing is the desired storage type.
const ( IndexUsing_Default IndexUsing = iota IndexUsing_BTree IndexUsing_Hash )
type IndexValueIter ¶
type IndexValueIter interface { // Next returns the next value (repo's location) - see IndexKeyValueIter. Next(*Context) ([]byte, error) Closer }
IndexValueIter is an iterator of index values.
type IndexedTable ¶
type IndexedTable interface { Table // LookupPartitions returns partitions scanned by the given IndexLookup LookupPartitions(*Context, IndexLookup) (PartitionIter, error) }
IndexedTable is a table with an index chosen for range scans
type IndexedTableCreator ¶
type IndexedTableCreator interface {
CreateIndexedTable(ctx *Context, name string, schema PrimaryKeySchema, idxDef IndexDef, collation CollationID) error
}
IndexedTableCreator should be implemented by databases that create new tables where they have a Primary Key that has columns that have prefix lengths.
type InsertableTable ¶
type InsertableTable interface { Table // Inserter returns an Inserter for this table. The Inserter will get one call to Insert() for each row to be // inserted, and will end with a call to Close() to finalize the insert operation. Inserter(*Context) RowInserter }
InsertableTable is a table that can process insertion of new rows.
type JSONDocument ¶
type JSONDocument struct {
Val interface{}
}
func MustJSON ¶
func MustJSON(s string) JSONDocument
func (JSONDocument) Compare ¶
func (doc JSONDocument) Compare(ctx *Context, v JSONValue) (int, error)
func (JSONDocument) Contains ¶
func (doc JSONDocument) Contains(ctx *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) Extract ¶
func (doc JSONDocument) Extract(ctx *Context, path string) (JSONValue, error)
func (JSONDocument) Keys ¶
func (doc JSONDocument) Keys(ctx *Context, path string) (val JSONValue, err error)
func (JSONDocument) Overlaps ¶
func (doc JSONDocument) Overlaps(ctx *Context, val SearchableJSONValue) (ok bool, err error)
func (JSONDocument) Unmarshall ¶
func (doc JSONDocument) Unmarshall(_ *Context) (JSONDocument, error)
type JSONValue ¶
type JSONValue interface { // Unmarshall converts a JSONValue to a JSONDocument Unmarshall(ctx *Context) (val JSONDocument, err error) // Compare compares two JSONValues. It maintains the same return value // semantics as Type.Compare() Compare(ctx *Context, v JSONValue) (cmp int, err error) // ToString marshalls a JSONValue to a valid JSON-encoded string. ToString(ctx *Context) (string, error) }
JSONValue is an integrator specific implementation of a JSON field value.
type JsonType ¶
type JsonType interface { Type }
JsonType represents the JSON type. https://dev.mysql.com/doc/refman/8.0/en/json.html The type of the returned value is JSONValue.
var JSON JsonType = jsonType{}
type KeyValueCache ¶
type KeyValueCache interface { // Put a new value in the cache. Put(uint64, interface{}) error // Get the value with the given key. An error is returned if the specified key does not exist. Get(uint64) (interface{}, error) // Size returns the number of elements in the cache. Size() int }
KeyValueCache is a cache of key value pairs.
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) 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 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() Type
Promote implements the Type interface.
func (LineStringType) SetSRID ¶
func (t LineStringType) SetSRID(v uint32) 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 LockSubsystem ¶
type LockSubsystem struct {
// contains filtered or unexported fields
}
LockSubsystem manages reentrant named locks
func NewLockSubsystem ¶
func NewLockSubsystem() *LockSubsystem
NewLockSubsystem creates a LockSubsystem object
func (*LockSubsystem) GetLockState ¶
func (ls *LockSubsystem) GetLockState(name string) (state LockState, owner uint32)
GetLockState returns the LockState and owner ID for a lock with a given name.
func (*LockSubsystem) Lock ¶
Lock attempts to acquire a lock with a given name for the Id associated with the given ctx.Session within the given timeout
func (*LockSubsystem) ReleaseAll ¶
func (ls *LockSubsystem) ReleaseAll(ctx *Context) (int, error)
ReleaseAll releases all locks the ID associated with the given ctx.Session, and returns the number of locks that were succeessfully released.
type Lockable ¶
type Lockable interface { Nameable // Lock locks the table either for reads or writes. Any session clients can // read while the table is locked for read, but not write. // When the table is locked for write, nobody can write except for the // session client that requested the lock. Lock(ctx *Context, write bool) error // Unlock releases the lock for the current session client. It blocks until // all reads or writes started during the lock are finished. // Context may be nil if the unlock it's because the connection was closed. // The id will always be provided, since in some cases context is not // available. Unlock(ctx *Context, id uint32) error }
Lockable should be implemented by tables that can be locked and unlocked.
type MemoryManager ¶
type MemoryManager struct {
// contains filtered or unexported fields
}
MemoryManager is in charge of keeping track and managing all the components that operate in memory. There should only be one instance of a memory manager running at the same time in each process.
func NewMemoryManager ¶
func NewMemoryManager(r Reporter) *MemoryManager
NewMemoryManager creates a new manager with the given memory reporter. If nil is given, then the Process reporter will be used by default.
func (*MemoryManager) HasAvailable ¶
func (m *MemoryManager) HasAvailable() bool
HasAvailable reports whether the memory manager has any available memory.
func (*MemoryManager) NewHistoryCache ¶
func (m *MemoryManager) NewHistoryCache() (KeyValueCache, DisposeFunc)
NewHistoryCache returns an empty history cache and a function to dispose it when it's no longer needed.
func (*MemoryManager) NewLRUCache ¶
func (m *MemoryManager) NewLRUCache(size uint) (KeyValueCache, DisposeFunc)
NewLRUCache returns an empty LRU cache and a function to dispose it when it's no longer needed.
func (*MemoryManager) NewRows2Cache ¶
func (m *MemoryManager) NewRows2Cache() (Rows2Cache, DisposeFunc)
NewRowsCache returns an empty rows cache and a function to dispose it when it's no longer needed.
func (*MemoryManager) NewRowsCache ¶
func (m *MemoryManager) NewRowsCache() (RowsCache, DisposeFunc)
NewRowsCache returns an empty rows cache and a function to dispose it when it's no longer needed.
func (*MemoryManager) NumCaches ¶
func (m *MemoryManager) NumCaches() int
type MultiDatabaser ¶
type MultiDatabaser interface { // DatabaseProvider returns the current DatabaseProvider. DatabaseProvider() DatabaseProvider // WithDatabaseProvider returns a new node instance with the database provider replaced with the one given as parameter. WithDatabaseProvider(DatabaseProvider) (Node, error) }
MultiDatabaser is a node that contains a reference to a database provider. This interface is intended for very specific nodes that must resolve databases during execution time rather than during analysis, such as block statements where the execution of a nested statement in the block may affect future statements within that same block.
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) 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 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() Type
Promote implements the Type interface.
func (MultiLineStringType) SetSRID ¶
func (t MultiLineStringType) SetSRID(v uint32) 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) 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 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() Type
Promote implements the Type interface.
func (MultiPointType) SetSRID ¶
func (t MultiPointType) SetSRID(v uint32) 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) 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 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() Type
Promote implements the Type interface.
func (MultiPolygonType) SetSRID ¶
func (t MultiPolygonType) SetSRID(v uint32) 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 MutableDatabaseProvider ¶
type Nameable ¶
type Nameable interface { // Name returns the name. Name() string }
Nameable is something that has a name.
type Node ¶
type Node interface { Resolvable fmt.Stringer // Schema of the node. Schema() Schema // Children nodes. Children() []Node // RowIter produces a row iterator from this node. The current row being evaluated is provided, as well the context // of the query. RowIter(ctx *Context, row Row) (RowIter, error) // WithChildren returns a copy of the node with children replaced. // It will return an error if the number of children is different than // the current number of children. They must be given in the same order // as they are returned by Children. WithChildren(children ...Node) (Node, error) // CheckPrivileges passes the operations representative of this Node to the PrivilegedOperationChecker to determine // whether a user (contained in the context, along with their active roles) has the necessary privileges to execute // this node (and its children). CheckPrivileges(ctx *Context, opChecker PrivilegedOperationChecker) bool }
Node is a node in the execution plan tree.
type NodeVisitor ¶
type NodeVisitor interface { // Visit method is invoked for each expr encountered by Walk. If the result Visitor is not nil, Walk visits each of // the children of the expr with that visitor, followed by a call of Visit(nil, nil) to the returned visitor. Visit(node Node, expression Expression) NodeVisitor }
NodeVisitor visits expressions in an expression tree. Like Visitor, but with the added context of the node in which an expression is embedded. See WalkExpressionsWithNode in the plan package.
type NonDeterministicExpression ¶
type NonDeterministicExpression interface { Expression // IsNonDeterministic returns whether this expression returns a non-deterministic result. An expression is // non-deterministic if it can return different results on subsequent evaluations. IsNonDeterministic() bool }
NonDeterministicExpression allows a way for expressions to declare that they are non-deterministic, which will signal the engine to not cache their results when this would otherwise appear to be safe.
type NullOrdering ¶
type NullOrdering byte
NullOrdering represents how to order based on null values.
const ( // NullsFirst puts the null values before any other values. NullsFirst NullOrdering = iota // NullsLast puts the null values after all other values. NullsLast NullOrdering = 2 )
type NullType ¶
type NullType interface { Type }
var ( Null NullType = nullType{} // ErrValueNotNil is thrown when a value that was expected to be nil, is not ErrValueNotNil = errors.NewKind("value not nil: %#v") )
type NumberType ¶
NumberType represents all integer and floating point types. https://dev.mysql.com/doc/refman/8.0/en/integer-types.html https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html The type of the returned value is one of the following: int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64.
func CreateNumberType ¶
func CreateNumberType(baseType query.Type) (NumberType, error)
CreateNumberType creates a NumberType.
func MustCreateNumberType ¶
func MustCreateNumberType(baseType query.Type) NumberType
MustCreateNumberType is the same as CreateNumberType except it panics on errors.
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 OpaqueNode ¶
type OpaqueNode interface { Node // Opaque reports whether the node is opaque or not. Opaque() bool }
OpaqueNode is a node that doesn't allow transformations to its children and acts as a black box.
type OrderedIndex ¶
type OrderedIndex interface { Index // Order returns the order of results for reads from this index Order() IndexOrder }
OrderedIndex is an extension of |Index| that allows indexes to declare their return order. The query engine can optimize certain queries if the order of an index is guaranteed, e.g. removing a sort operation.
type Partition ¶
type Partition interface {
Key() []byte
}
Partition represents a partition from a SQL table.
type PartitionCounter ¶
type PartitionCounter interface { // PartitionCount returns the number of partitions. PartitionCount(*Context) (int64, error) }
PartitionCounter can return the number of partitions.
type PartitionIndexKeyValueIter ¶
type PartitionIndexKeyValueIter interface { // Next returns the next partition and the IndexKeyValueIter for that // partition. Next(*Context) (Partition, IndexKeyValueIter, error) Closer }
PartitionIndexKeyValueIter is an iterator of partitions that will return the partition and the IndexKeyValueIter of that partition.
type PartitionIter ¶
PartitionIter is an iterator that retrieves partitions.
func PartitionsToPartitionIter ¶
func PartitionsToPartitionIter(partitions ...Partition) PartitionIter
PartitionsToPartitionIter creates a PartitionIter that iterates over the given partitions.
type PartitionProgress ¶
type PartitionProgress struct {
Progress
}
PartitionProgress keeps track of a partition progress
func (PartitionProgress) String ¶
func (p PartitionProgress) String() string
type PersistableSession ¶
type PersistableSession interface { Session // PersistGlobal writes to the persisted global system variables file PersistGlobal(sysVarName string, value interface{}) error // RemovePersistedGlobal deletes a variable from the persisted globals file RemovePersistedGlobal(sysVarName string) error // RemoveAllPersistedGlobals clears the contents of the persisted globals file RemoveAllPersistedGlobals() error // GetPersistedValue returns persisted value for a global system variable GetPersistedValue(k string) (interface{}, error) }
PersistableSession supports serializing/deserializing global system variables/
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 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() Type
Promote implements the Type interface.
func (PolygonType) SetSRID ¶
func (t PolygonType) SetSRID(v uint32) Type
SetSRID implements SpatialColumnType interface.
func (PolygonType) ValueType ¶
func (t PolygonType) ValueType() reflect.Type
ValueType implements Type interface.
type PrimaryKeyAlterableTable ¶
type PrimaryKeyAlterableTable interface { Table // CreatePrimaryKey creates a primary key for this table, using the provided parameters. // Returns an error if the new primary key set is not compatible with the current table data. CreatePrimaryKey(ctx *Context, columns []IndexColumn) error // DropPrimaryKey drops a primary key on a table. Returns an error if that table does not have a key. DropPrimaryKey(ctx *Context) error }
PrimaryKeyAlterableTable represents a table that supports primary key changes.
type PrimaryKeySchema ¶
PrimaryKeySchema defines table metadata for columns and primary key ordering
func NewPrimaryKeySchema ¶
func NewPrimaryKeySchema(s Schema, pkOrds ...int) PrimaryKeySchema
NewPrimaryKeySchema constructs a new PrimaryKeySchema. PK ordinals default to the in-order set read from the Schema.
func SchemaToPrimaryKeySchema ¶
func SchemaToPrimaryKeySchema(table Table, sch Schema) PrimaryKeySchema
SchemaToPrimaryKeySchema adapts the schema given to a PrimaryKey schema using the primary keys of the table given, if present. The resulting PrimaryKeySchema may have an empty key set if the table has no primary keys. Matching for ordinals is performed by column name.
type PrimaryKeySchemaTarget ¶
type PrimaryKeySchemaTarget interface { SchemaTarget WithPrimaryKeySchema(schema PrimaryKeySchema) (Node, error) }
PrimaryKeySchemaTarget is a node that has a primary key target schema that can be set
type PrimaryKeyTable ¶
type PrimaryKeyTable interface { // PrimaryKeySchema returns this table's PrimaryKeySchema PrimaryKeySchema() PrimaryKeySchema }
type PrivilegeSet ¶
type PrivilegeSet interface { // Has returns whether the given global privilege(s) exists. Has(privileges ...PrivilegeType) bool // HasPrivileges returns whether this PrivilegeSet has any privileges at any level. HasPrivileges() bool // Count returns the number of global privileges. Count() int // Database returns the set of privileges for the given database. Returns an empty set if the database does not exist. Database(dbName string) PrivilegeSetDatabase // GetDatabases returns all databases. GetDatabases() []PrivilegeSetDatabase // Equals returns whether the given set of privileges is equivalent to the calling set. Equals(otherPs PrivilegeSet) bool // ToSlice returns all of the global privileges contained as a sorted slice. ToSlice() []PrivilegeType }
PrivilegeSet is a set containing privileges. Integrators should not implement this interface.
type PrivilegeSetColumn ¶
type PrivilegeSetColumn interface { // Name returns the name of the column that this privilege set belongs to. Name() string // Has returns whether the given column privilege(s) exists. Has(privileges ...PrivilegeType) bool // Count returns the number of column privileges. Count() int // Equals returns whether the given set of privileges is equivalent to the calling set. Equals(otherPs PrivilegeSetColumn) bool // ToSlice returns all of the column privileges contained as a sorted slice. ToSlice() []PrivilegeType }
PrivilegeSetColumn is a set containing column privileges. Integrators should not implement this interface.
type PrivilegeSetDatabase ¶
type PrivilegeSetDatabase interface { // Name returns the name of the database that this privilege set belongs to. Name() string // Has returns whether the given database privilege(s) exists. Has(privileges ...PrivilegeType) bool // HasPrivileges returns whether this database has either database-level privileges, or privileges on a table or // column contained within this database. HasPrivileges() bool // Count returns the number of database privileges. Count() int // Table returns the set of privileges for the given table. Returns an empty set if the table does not exist. Table(tblName string) PrivilegeSetTable // GetTables returns all tables. GetTables() []PrivilegeSetTable // Equals returns whether the given set of privileges is equivalent to the calling set. Equals(otherPs PrivilegeSetDatabase) bool // ToSlice returns all of the database privileges contained as a sorted slice. ToSlice() []PrivilegeType }
PrivilegeSetDatabase is a set containing database-level privileges. Integrators should not implement this interface.
type PrivilegeSetTable ¶
type PrivilegeSetTable interface { // Name returns the name of the table that this privilege set belongs to. Name() string // Has returns whether the given table privilege(s) exists. Has(privileges ...PrivilegeType) bool // HasPrivileges returns whether this table has either table-level privileges, or privileges on a column contained // within this table. HasPrivileges() bool // Count returns the number of table privileges. Count() int // Column returns the set of privileges for the given column. Returns an empty set if the column does not exist. Column(colName string) PrivilegeSetColumn // GetColumns returns all columns. GetColumns() []PrivilegeSetColumn // Equals returns whether the given set of privileges is equivalent to the calling set. Equals(otherPs PrivilegeSetTable) bool // ToSlice returns all of the table privileges contained as a sorted slice. ToSlice() []PrivilegeType }
PrivilegeSetTable is a set containing table-level privileges. Integrators should not implement this interface.
type PrivilegeType ¶
type PrivilegeType int
PrivilegeType represents a privilege.
const ( PrivilegeType_Select PrivilegeType = iota PrivilegeType_Insert PrivilegeType_Update PrivilegeType_Delete PrivilegeType_Create PrivilegeType_Drop PrivilegeType_Reload PrivilegeType_Shutdown PrivilegeType_Process PrivilegeType_File PrivilegeType_Grant PrivilegeType_References PrivilegeType_Index PrivilegeType_Alter PrivilegeType_ShowDB PrivilegeType_Super PrivilegeType_CreateTempTable PrivilegeType_LockTables PrivilegeType_Execute PrivilegeType_ReplicationSlave PrivilegeType_ReplicationClient PrivilegeType_CreateView PrivilegeType_ShowView PrivilegeType_CreateRoutine PrivilegeType_AlterRoutine PrivilegeType_CreateUser PrivilegeType_Event PrivilegeType_Trigger PrivilegeType_CreateTablespace PrivilegeType_CreateRole PrivilegeType_DropRole )
func PrivilegeTypeFromString ¶
func PrivilegeTypeFromString(privilegeType string) (PrivilegeType, bool)
PrivilegeTypeFromString returns the matching PrivilegeType for the given string. If there is no match, returns false.
func (PrivilegeType) String ¶
func (pt PrivilegeType) String() string
String returns the sql.PrivilegeType as a string, for display in places such as "SHOW GRANTS".
type PrivilegedOperation ¶
type PrivilegedOperation struct { Database string Table string Column string Privileges []PrivilegeType }
PrivilegedOperation represents an operation that requires privileges to execute.
func NewPrivilegedOperation ¶
func NewPrivilegedOperation(dbName string, tblName string, colName string, privs ...PrivilegeType) PrivilegedOperation
NewPrivilegedOperation returns a new PrivilegedOperation with the given parameters.
type PrivilegedOperationChecker ¶
type PrivilegedOperationChecker interface { // UserHasPrivileges fetches the User, and returns whether they have the desired privileges necessary to perform the // privileged operation(s). This takes into account the active roles, which are set in the context, therefore both // the user and the active roles are pulled from the context. UserHasPrivileges(ctx *Context, operations ...PrivilegedOperation) bool }
PrivilegedOperationChecker contains the necessary data to check whether the operation should succeed based on the privileges contained by the user. The user is retrieved from the context, along with their active roles.
type Process ¶
type Process struct { Pid uint64 Connection uint32 User string Query string Progress map[string]TableProgress StartedAt time.Time Kill context.CancelFunc }
Process represents a process in the SQL server.
type ProcessList ¶
type ProcessList interface { // Processes returns the list of current running processes Processes() []Process // AddProcess adds a new process to the list and returns a new context that can be used to cancel it AddProcess(ctx *Context, query string) (*Context, error) // Kill terminates all queries for a given connection id Kill(connID uint32) // Done removes the finished process with the given pid from the process list Done(pid uint64) // UpdateTableProgress updates the progress of the table with the given name for the // process with the given pid. UpdateTableProgress(pid uint64, name string, delta int64) // UpdatePartitionProgress updates the progress of the table partition with the // given name for the process with the given pid. UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64) // AddTableProgress adds a new item to track progress from to the process with // the given pid. If the pid does not exist, it will do nothing. AddTableProgress(pid uint64, name string, total int64) // AddPartitionProgress adds a new item to track progress from to the process with // the given pid. If the pid or the table does not exist, it will do nothing. AddPartitionProgress(pid uint64, tableName, partitionName string, total int64) // RemoveTableProgress removes an existing item tracking progress from the // process with the given pid, if it exists. RemoveTableProgress(pid uint64, name string) // RemovePartitionProgress removes an existing partition tracking progress from the // process with the given pid, if it exists. RemovePartitionProgress(pid uint64, tableName, partitionName string) }
type ProjectedTable ¶
type ProjectedTable interface { Table WithProjections(colNames []string) Table Projections() []string }
ProjectedTable is a table that can produce a specific RowIter that's more optimized given the columns that are projected.
type Projector ¶
type Projector interface { // ProjectedExprs returns the list of expressions projected by this node. ProjectedExprs() []Expression // WithProjectedExprs returns a new Projector instance with the specified expressions set as its projected expressions. WithProjectedExprs(...Expression) (Projector, error) }
Projector is a node that projects expressions for parent nodes to consume (i.e. GroupBy, Window, Project).
type Range ¶
type Range []RangeColumnExpr
Range is a collection of RangeColumns that are ordered by the column expressions as returned by their parent index. A single range represents a set of values intended for iteration by an integrator's index.
func IntersectRanges ¶
IntersectRanges intersects each Range for each column expression. If a RangeColumnExpr ends up with no valid ranges then a nil is returned.
func SortRanges ¶
SortRanges sorts the given ranges, returning a new slice of ranges.
func (Range) AsEmpty ¶
AsEmpty returns a Range full of empty RangeColumns with the same types as the calling Range.
func (Range) Compare ¶
Compare returns an integer stating the relative position of the calling Range to the given Range.
func (Range) DebugString ¶
DebugString returns this Range as a string for debugging purposes.
func (Range) ExpressionByColumnName ¶
func (rang Range) ExpressionByColumnName(idx Index, colExpr string) (RangeColumnExpr, bool)
ExpressionByColumnName returns the RangeColumnExpr that belongs to the given column expression. If an index does not contain the column expression then false is returned.
func (Range) IsConnected ¶
IsConnected returns whether the calling Range and given Range have overlapping values, which would result in the same values being returned from some subset of both ranges.
func (Range) IsSubsetOf ¶
IsSubsetOf evaluates whether the calling Range is fully encompassed by the given Range.
func (Range) IsSupersetOf ¶
IsSupersetOf evaluates whether the calling Range fully encompasses the given Range.
func (Range) Overlaps ¶
Overlaps returns whether the calling Range and given Range have overlapping values, which would result in the same values being returned from some subset of both ranges.
func (Range) RemoveOverlap ¶
func (rang Range) RemoveOverlap(otherRange Range) (RangeCollection, bool, error)
RemoveOverlap removes any overlap that the given Range may have with the calling Range. If the two ranges do not overlap and are not mergeable then they're both returned. If one is a subset of the other or is mergeable then only one Range is returned. Otherwise, this returns a collection of ranges that do not overlap with each other, and covers the entirety of the original ranges (and nothing more). If the two ranges do not overlap and are not mergeable then false is returned, otherwise returns true.
type RangeBoundType ¶
type RangeBoundType int
RangeBoundType is the bound of the RangeCut.
const ( // Open bounds represent exclusion. Open RangeBoundType = iota // Closed bounds represent inclusion. Closed )
func (RangeBoundType) Inclusive ¶
func (bt RangeBoundType) Inclusive() bool
Inclusive returns whether the bound represents inclusion.
type RangeCollection ¶
type RangeCollection []Range
RangeCollection is a collection of ranges that represent different (non-overlapping) filter expressions.
func RemoveOverlappingRanges ¶
func RemoveOverlappingRanges(ranges ...Range) (RangeCollection, error)
RemoveOverlappingRanges removes all overlap between all ranges.
func (RangeCollection) DebugString ¶
func (ranges RangeCollection) DebugString() string
DebugString returns this RangeCollection as a string for debugging purposes.
func (RangeCollection) Equals ¶
func (ranges RangeCollection) Equals(otherCollection RangeCollection) (bool, error)
Equals returns whether the given RangeCollection matches the calling RangeCollection. The order of each Range is important, therefore it is recommended to sort two collections beforehand.
func (RangeCollection) Intersect ¶
func (ranges RangeCollection) Intersect(otherRanges RangeCollection) (RangeCollection, error)
Intersect attempts to intersect the given RangeCollection with the calling RangeCollection. This ensures that each Range belonging to the same collection is treated as a union with respect to that same collection, rather than attempting to intersect ranges that are a part of the same collection.
func (RangeCollection) String ¶
func (ranges RangeCollection) String() string
String returns this RangeCollection as a string for display purposes.
type RangeColumnExpr ¶
RangeColumnExpr represents the contiguous set of values on a specific column.
func AllRangeColumnExpr ¶
func AllRangeColumnExpr(typ Type) RangeColumnExpr
AllRangeColumnExpr returns a RangeColumnExpr representing all values.
func ClosedRangeColumnExpr ¶
func ClosedRangeColumnExpr(lower, upper interface{}, typ Type) RangeColumnExpr
ClosedRangeColumnExpr returns a RangeColumnExpr representing {l <= x <= u}.
func CustomRangeColumnExpr ¶
func CustomRangeColumnExpr(lower, upper interface{}, lowerBound, upperBound RangeBoundType, typ Type) RangeColumnExpr
CustomRangeColumnExpr returns a RangeColumnExpr defined by the bounds given.
func EmptyRangeColumnExpr ¶
func EmptyRangeColumnExpr(typ Type) RangeColumnExpr
EmptyRangeColumnExpr returns the empty RangeColumnExpr for the given type.
func GreaterOrEqualRangeColumnExpr ¶
func GreaterOrEqualRangeColumnExpr(lower interface{}, typ Type) RangeColumnExpr
GreaterOrEqualRangeColumnExpr returns a RangeColumnExpr representing {x >= l}.
func GreaterThanRangeColumnExpr ¶
func GreaterThanRangeColumnExpr(lower interface{}, typ Type) RangeColumnExpr
GreaterThanRangeColumnExpr returns a RangeColumnExpr representing {x > l}.
func LessOrEqualRangeColumnExpr ¶
func LessOrEqualRangeColumnExpr(upper interface{}, typ Type) RangeColumnExpr
LessOrEqualRangeColumnExpr returns a RangeColumnExpr representing {x <= u}.
func LessThanRangeColumnExpr ¶
func LessThanRangeColumnExpr(upper interface{}, typ Type) RangeColumnExpr
LessThanRangeColumnExpr returns a RangeColumnExpr representing {x < u}.
func NotNullRangeColumnExpr ¶
func NotNullRangeColumnExpr(typ Type) RangeColumnExpr
NotNullRangeColumnExpr returns the not null RangeColumnExpr for the given type.
func NullRangeColumnExpr ¶
func NullRangeColumnExpr(typ Type) RangeColumnExpr
NullRangeColumnExpr returns the null RangeColumnExpr for the given type.
func OpenRangeColumnExpr ¶
func OpenRangeColumnExpr(lower, upper interface{}, typ Type) RangeColumnExpr
OpenRangeColumnExpr returns a RangeColumnExpr representing {l < x < u}.
func SimplifyRangeColumn ¶
func SimplifyRangeColumn(rces ...RangeColumnExpr) ([]RangeColumnExpr, error)
SimplifyRangeColumn combines all RangeColumnExprs that are connected and returns a new slice.
func (RangeColumnExpr) DebugString ¶
func (r RangeColumnExpr) DebugString() string
DebugString returns this RangeColumnExpr as a string for debugging purposes.
func (RangeColumnExpr) Equals ¶
func (r RangeColumnExpr) Equals(other RangeColumnExpr) (bool, error)
Equals checks for equality with the given RangeColumnExpr.
func (RangeColumnExpr) HasLowerBound ¶
func (r RangeColumnExpr) HasLowerBound() bool
HasLowerBound returns whether this RangeColumnExpr has a value for the lower bound.
func (RangeColumnExpr) HasUpperBound ¶
func (r RangeColumnExpr) HasUpperBound() bool
HasUpperBound returns whether this RangeColumnExpr has a value for the upper bound.
func (RangeColumnExpr) IsConnected ¶
func (r RangeColumnExpr) IsConnected(other RangeColumnExpr) (bool, error)
IsConnected evaluates whether the given RangeColumnExpr overlaps or is adjacent to the calling RangeColumnExpr.
func (RangeColumnExpr) IsEmpty ¶
func (r RangeColumnExpr) IsEmpty() (bool, error)
IsEmpty returns whether this RangeColumnExpr is empty.
func (RangeColumnExpr) IsSubsetOf ¶
func (r RangeColumnExpr) IsSubsetOf(other RangeColumnExpr) (bool, error)
IsSubsetOf evaluates whether the calling RangeColumnExpr is fully encompassed by the given RangeColumnExpr.
func (RangeColumnExpr) IsSupersetOf ¶
func (r RangeColumnExpr) IsSupersetOf(other RangeColumnExpr) (bool, error)
IsSupersetOf evaluates whether the calling RangeColumnExpr fully encompasses the given RangeColumnExpr.
func (RangeColumnExpr) Overlaps ¶
func (r RangeColumnExpr) Overlaps(other RangeColumnExpr) (RangeColumnExpr, bool, error)
Overlaps evaluates whether the given RangeColumnExpr overlaps the calling RangeColumnExpr. If they do, returns the overlapping region as a RangeColumnExpr.
func (RangeColumnExpr) RepresentsEquals ¶
func (r RangeColumnExpr) RepresentsEquals() (bool, error)
RepresentsEquals returns whether this RangeColumnExpr represents an "equals". An "equals" is a special kind of RangeType_ClosedClosed that iterates over a single value (or the specific prefix of some value).
func (RangeColumnExpr) String ¶
func (r RangeColumnExpr) String() string
String returns this RangeColumnExpr as a string for display purposes.
func (RangeColumnExpr) Subtract ¶
func (r RangeColumnExpr) Subtract(other RangeColumnExpr) ([]RangeColumnExpr, error)
Subtract removes the given RangeColumnExpr from the calling RangeColumnExpr. In the event that the given RangeColumnExpr is a strict subset of the calling RangeColumnExpr, two RangeColumnExprs will be returned. If the given RangeColumnExpr does not overlap the calling RangeColumnExpr, then the calling RangeColumnExpr is returned. If the calling RangeColumnExpr is a strict subset (or equivalent) of the given RangeColumnExpr, then an empty slice is returned. In all other cases, a slice with a single RangeColumnExpr will be returned.
func (RangeColumnExpr) TryIntersect ¶
func (r RangeColumnExpr) TryIntersect(other RangeColumnExpr) (RangeColumnExpr, bool, error)
TryIntersect attempts to intersect the given RangeColumnExpr with the calling RangeColumnExpr. Returns true if the intersection result is not the empty RangeColumnExpr, however a valid RangeColumnExpr is always returned if the error is nil.
func (RangeColumnExpr) TryUnion ¶
func (r RangeColumnExpr) TryUnion(other RangeColumnExpr) (RangeColumnExpr, bool, error)
TryUnion attempts to combine the given RangeColumnExpr with the calling RangeColumnExpr. Returns true if the union was a success.
func (RangeColumnExpr) Type ¶
func (r RangeColumnExpr) Type() RangeType
Type returns this RangeColumnExpr's RangeType.
type RangeColumnExprTree ¶
type RangeColumnExprTree struct {
// contains filtered or unexported fields
}
RangeColumnExprTree represents a red-black tree over a range column expression. To represent an entire range, each node has both an upper bound and lower bound that represents a single column expression. If the Range has another dimension, then the node will have an inner tree representing the nested dimension ad infinitum. This implicitly means that all column expressions on the lower dimension share the same column expression in the higher dimensions. This way, a Range is deconstructed and sorted by its column expressions, but may easily be retrieved by walking down a tree and all of its inner trees.
func NewRangeColumnExprTree ¶
func NewRangeColumnExprTree(initialRange Range, columnExprTypes []Type) (*RangeColumnExprTree, error)
NewRangeColumnExprTree creates a new RangeColumnExprTree constructed from an initial range. As the initial Range may contain column expressions that have a NULL type, the expected non-NULL type for each column expression is given separately. If all column expressions for a specific column will be NULL, then it is valid to use the NULL type. Returns an error if the number of column expressions do not equal the number of types, or if the Range has a length of zero.
func (*RangeColumnExprTree) FindConnections ¶
func (tree *RangeColumnExprTree) FindConnections(rang Range, colExprIdx int) (RangeCollection, error)
FindConnections returns all connecting Ranges found in the tree. They may or may not be mergeable or overlap.
func (*RangeColumnExprTree) GetRangeCollection ¶
func (tree *RangeColumnExprTree) GetRangeCollection() (RangeCollection, error)
GetRangeCollection returns every Range that this tree contains.
func (*RangeColumnExprTree) Insert ¶
func (tree *RangeColumnExprTree) Insert(rang Range) error
Insert adds the given Range into the tree.
func (*RangeColumnExprTree) Iterator ¶
func (tree *RangeColumnExprTree) Iterator() *rangeTreeIter
Iterator returns an iterator over the calling tree. Does not handle any inner trees.
func (*RangeColumnExprTree) Remove ¶
func (tree *RangeColumnExprTree) Remove(rang Range) error
Remove removes the given Range from the tree (and subtrees if applicable).
func (*RangeColumnExprTree) String ¶
func (tree *RangeColumnExprTree) String() string
String returns the tree as a formatted string. Does not display the inner trees.
type RangeCut ¶
type RangeCut interface { // Compare returns an integer stating the relative position of the calling RangeCut to the given RangeCut. Compare(RangeCut, Type) (int, error) // String returns the RangeCut as a string for display purposes. String() string // TypeAsLowerBound returns the bound type if the calling RangeCut is the lower bound of a range. TypeAsLowerBound() RangeBoundType // TypeAsUpperBound returns the bound type if the calling RangeCut is the upper bound of a range. TypeAsUpperBound() RangeBoundType }
RangeCut represents a position on the line of all possible values.
func GetRangeCutMax ¶
GetRangeCutMax returns the RangeCut with the highest value.
type RangeType ¶
type RangeType int
RangeType returns what a RangeColumnExpr represents, such as a GreaterThan on some column, or a column set between two bounds.
const ( RangeType_Invalid RangeType = iota // This range is invalid, which should not be possible. Please create a GitHub issue if this is ever returned. RangeType_Empty // This range represents the empty set of values. RangeType_All // This range represents every possible value. RangeType_GreaterThan // This range is equivalent to checking for all values greater than the lowerbound. RangeType_GreaterOrEqual // This range is equivalent to checking for all values greater than or equal to the lowerbound. RangeType_LessThanOrNull // This range is equivalent to checking for all values less than the upperbound. RangeType_LessOrEqualOrNull // This range is equivalent to checking for all values less than or equal to the upperbound. RangeType_ClosedClosed // This range covers a finite set of values with the lower and upperbounds inclusive. RangeType_OpenOpen // This range covers a finite set of values with the lower and upperbounds exclusive. RangeType_OpenClosed // This range covers a finite set of values with the lowerbound exclusive and upperbound inclusive. RangeType_ClosedOpen // This range covers a finite set of values with the lowerbound inclusive and upperbound exclusive. RangeType_EqualNull // A range matching only NULL. )
type ReadOnlyDatabase ¶
type ReplaceableTable ¶
type ReplaceableTable interface { Table // Replacer returns a RowReplacer for this table. The RowReplacer will have Insert and optionally Delete called once // for each row, followed by a call to Close() when all rows have been processed. Replacer(ctx *Context) RowReplacer }
ReplaceableTable allows rows to be replaced through a Delete (if applicable) then Insert.
type Reporter ¶
type Reporter interface { // MaxMemory returns the maximum number of memory allowed in bytes. MaxMemory() uint64 // UsedMemory returns the memory in use in bytes. UsedMemory() uint64 }
Reporter is a component that gives information about the memory usage.
type Resolvable ¶
type Resolvable interface { // Resolved returns whether the node is resolved. Resolved() bool }
Resolvable is something that can be resolved or not.
type RewritableTable ¶
type RewritableTable interface { Table AlterableTable // ShouldRewriteTable returns whether this table should be rewritten because of a schema change. The old and new // versions of the schema and modified column are provided. For some operations, one or both of |oldColumn| or // |newColumn| may be nil. // The engine may decide to rewrite tables regardless in some cases, such as when a new non-nullable column is added. ShouldRewriteTable(ctx *Context, oldSchema, newSchema PrimaryKeySchema, oldColumn, newColumn *Column) bool // RewriteInserter returns a RowInserter for the new schema. Rows from the current table, with the old schema, will // be streamed from the table and passed to this RowInserter. Implementor tables must still return rows in the // current schema until the rewrite operation completes. |Close| will be called on RowInserter when all rows have // been inserted. RewriteInserter(ctx *Context, oldSchema, newSchema PrimaryKeySchema, oldColumn, newColumn *Column, idxCols []IndexColumn) (RowInserter, error) }
RewritableTable is an extension to Table that makes it simpler for integrators to adapt to schema changes that must rewrite every row of the table. In this case, rows are streamed from the existing table in the old schema, transformed / updated appropriately, and written with the new format.
type Row ¶
type Row []interface{}
Row is a tuple of values.
func NodeToRows ¶
NodeToRows converts a node to a slice of rows.
func RowIterToRows ¶
RowIterToRows converts a row iterator to a slice of rows.
type Row2 ¶
type Row2 []Value
Row2 is a slice of values
type RowDeleter ¶
type RowDeleter interface { TableEditor // Delete deletes the given row. Returns ErrDeleteRowNotFound if the row was not found. Delete will be called once for // each row to process for the delete operation, which may involve many rows. After all rows have been processed, // Close is called. Delete(*Context, Row) error // Close finalizes the delete operation, persisting the result. Closer }
RowDeleter is a delete cursor that can delete one or more rows from a table.
type RowFrame ¶
type RowFrame struct { Types []querypb.Type // Values are the values this row. Values []ValueBytes // contains filtered or unexported fields }
func NewRowFrame ¶
func (*RowFrame) AppendMany ¶
func (f *RowFrame) AppendMany(types []querypb.Type, vals []ValueBytes)
AppendMany appends the types and values given, as two parallel arrays, into this frame.
func (*RowFrame) Clear ¶
func (f *RowFrame) Clear()
Clear clears this row frame for reuse. The underlying byte arrays are not zeroed out or discarded, but will be overwritten by future calls to Append.
func (*RowFrame) Recycle ¶
func (f *RowFrame) Recycle()
Recycle returns this row frame to the shared pool. Further use will result in concurrency errors. All RowFrames should be recycled when they are no longer being used to prevent resource leaks.
type RowInserter ¶
type RowInserter interface { TableEditor // Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process // for the insert operation, which may involve many rows. After all rows in an operation have been processed, Close // is called. Insert(*Context, Row) error // Close finalizes the insert operation, persisting its result. Closer }
RowInserter is an insert cursor that can insert one or more values to a table.
type RowIter ¶
type RowIter interface { // Next retrieves the next row. It will return io.EOF if it's the last row. // After retrieving the last row, Close will be automatically closed. Next(ctx *Context) (Row, error) Closer }
RowIter is an iterator that produces rows. TODO: most row iters need to be Disposable for CachedResult safety
func NewSpanIter ¶
NewSpanIter creates a RowIter executed in the given span. Currently inactive, returns the iter returned unaltered.
func RowsToRowIter ¶
RowsToRowIter creates a RowIter that iterates over the given rows.
type RowIter2 ¶
type RowIter2 interface { RowIter // Next2 produces the next row, and stores it in the RowFrame provided. // It will return io.EOF if it's the last row. After retrieving the // last row, Close will be automatically called. Next2(ctx *Context, frame *RowFrame) error }
RowIter2 is an iterator that fills a row frame buffer with rows from its source
type RowIterTypeSelector ¶
RowIterTypeSelector is implemented by top-level type-switch nodes that return either a Node or Node2 implementation.
type RowReplacer ¶
type RowReplacer interface { TableEditor // Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process // for the replace operation, which may involve many rows. After all rows in an operation have been processed, Close // is called. Insert(*Context, Row) error // Delete deletes the given row. Returns ErrDeleteRowNotFound if the row was not found. Delete will be called once for // each row to process for the delete operation, which may involve many rows. After all rows have been processed, // Close is called. Delete(*Context, Row) error // Closer finalizes the replace operation, persisting the result. Closer }
RowReplacer is a combination of RowDeleter and RowInserter. TODO: We can't embed those interfaces because go 1.13 doesn't allow for overlapping interfaces (they both declare Close). Go 1.14 fixes this problem, but we aren't ready to drop support for 1.13 yet.
type RowUpdater ¶
type RowUpdater interface { TableEditor // Update the given row. Provides both the old and new rows. Update(ctx *Context, old Row, new Row) error // Closer finalizes the update operation, persisting the result. Closer }
RowUpdater is an update cursor that can update one or more rows in a table.
type Rows2Cache ¶
type Rows2Cache interface { RowsCache // Add2 a new row to the cache. If there is no memory available, it will try to // free some memory. If after that there is still no memory available, it // will return an error and erase all the content of the cache. Add2(Row2) error // Get2 gets all rows. Get2() []Row2 }
Rows2Cache is a cache of Row2s.
type RowsCache ¶
type RowsCache interface { // Add a new row to the cache. If there is no memory available, it will try to // free some memory. If after that there is still no memory available, it // will return an error and erase all the content of the cache. Add(Row) error // Get returns all rows. Get() []Row }
RowsCache is a cache of rows.
type Schema ¶
type Schema []*Column
Schema is the definition of a table.
func (Schema) HasAutoIncrement ¶
HasAutoIncrement returns true if the schema has an auto increment column.
func (Schema) IndexOf ¶
IndexOf returns the index of the given column in the schema or -1 if it's not present.
func (Schema) IndexOfColName ¶
IndexOfColName returns the index of the given column in the schema or -1 if it's not present. Only safe for schemas corresponding to a single table, where the source of the column is irrelevant.
type SchemaTarget ¶
type SchemaTarget interface { // WithTargetSchema returns a copy of this node with the target schema set WithTargetSchema(Schema) (Node, error) // TargetSchema returns the target schema for this node TargetSchema() Schema }
SchemaTarget is a node that has a target schema that can be set during analysis. This is necessary because some schema objects (things that involve expressions, column references, etc.) can only be reified during analysis. The target schema is the schema of a table under a DDL operation, not the schema of rows returned by this node.
type SearchableJSONValue ¶
type SearchableJSONValue interface { JSONValue // Contains is value-specific implementation of JSON_Contains() Contains(ctx *Context, candidate JSONValue) (val interface{}, err error) // Extract is value-specific implementation of JSON_Extract() Extract(ctx *Context, path string) (val JSONValue, err error) // Keys is value-specific implementation of JSON_Keys() Keys(ctx *Context, path string) (val JSONValue, err error) // Overlaps is value-specific implementation of JSON_Overlaps() Overlaps(ctx *Context, val SearchableJSONValue) (ok bool, err error) // Search is value-specific implementation of JSON_Search() Search(ctx *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 Services ¶
type Services struct { KillConnection func(connID uint32) error LoadInfile func(filename string) (io.ReadCloser, error) }
Services are handles to optional or plugin functionality that can be used by the SQL implementation in certain situations. An integrator can set methods on Services for a given *Context and different parts of go-mysql-server will inspect it in order to fulfill their implementations. Currently, the KillConnection service is available. Set these with |WithServices|; the implementation will access them through the corresponding methods on *Context, such as |KillConnection|.
type Session ¶
type Session interface { // Address of the server. Address() string // Client returns the user of the session. Client() Client // SetClient returns a new session with the given client. SetClient(Client) // SetSessionVariable sets the given system variable to the value given for this session. SetSessionVariable(ctx *Context, sysVarName string, value interface{}) error // InitSessionVariable sets the given system variable to the value given for this session and will allow for // initialization of readonly variables. InitSessionVariable(ctx *Context, sysVarName string, value interface{}) error // SetUserVariable sets the given user variable to the value given for this session, or creates it for this session. SetUserVariable(ctx *Context, varName string, value interface{}) error // GetSessionVariable returns this session's value of the system variable with the given name. GetSessionVariable(ctx *Context, sysVarName string) (interface{}, error) // GetUserVariable returns this session's value of the user variable with the given name, along with its most // appropriate type. GetUserVariable(ctx *Context, varName string) (Type, interface{}, error) // GetAllSessionVariables returns a copy of all session variable values. GetAllSessionVariables() map[string]interface{} // GetCurrentDatabase gets the current database for this session GetCurrentDatabase() string // SetCurrentDatabase sets the current database for this session SetCurrentDatabase(dbName string) // CommitTransaction commits the current transaction for this session for the current database CommitTransaction(ctx *Context, dbName string, transaction Transaction) error // ID returns the unique ID of the connection. ID() uint32 // Warn stores the warning in the session. Warn(warn *Warning) // Warnings returns a copy of session warnings (from the most recent). Warnings() []*Warning // ClearWarnings cleans up session warnings. ClearWarnings() // WarningCount returns a number of session warnings WarningCount() uint16 // AddLock adds a lock to the set of locks owned by this user which will need to be released if this session terminates AddLock(lockName string) error // DelLock removes a lock from the set of locks owned by this user DelLock(lockName string) error // IterLocks iterates through all locks owned by this user IterLocks(cb func(name string) error) error // SetLastQueryInfo sets session-level query info for the key given, applying to the query just executed. SetLastQueryInfo(key string, value int64) // GetLastQueryInfo returns the session-level query info for the key given, for the query most recently executed. GetLastQueryInfo(key string) int64 // GetTransaction returns the active transaction, if any GetTransaction() Transaction // SetTransaction sets the session's transaction SetTransaction(tx Transaction) // SetIgnoreAutoCommit instructs the session to ignore the value of the @@autocommit variable, or consider it again SetIgnoreAutoCommit(ignore bool) // GetIgnoreAutoCommit returns whether this session should ignore the @@autocommit variable GetIgnoreAutoCommit() bool // GetLogger returns the logger for this session, useful if clients want to log messages with the same format / output // as the running server. Clients should instantiate their own global logger with formatting options, and session // implementations should return the logger to be used for the running server. GetLogger() *logrus.Entry // SetLogger sets the logger to use for this session, which will always be an extension of the one returned by // GetLogger, extended with session information SetLogger(*logrus.Entry) // GetIndexRegistry returns the index registry for this session GetIndexRegistry() *IndexRegistry // GetViewRegistry returns the view registry for this session GetViewRegistry() *ViewRegistry // SetIndexRegistry sets the index registry for this session. Integrators should set an index registry in the event // they are using an index driver. SetIndexRegistry(*IndexRegistry) // SetViewRegistry sets the view registry for this session. Integrators should set a view registry if their database // doesn't implement ViewDatabase and they want views created to persist across sessions. SetViewRegistry(*ViewRegistry) // SetConnectionId sets this sessions unique ID SetConnectionId(connId uint32) // GetCharacterSet returns the character set for this session (defined by the system variable `character_set_connection`). GetCharacterSet() CharacterSetID // GetCharacterSetResults returns the result character set for this session (defined by the system variable `character_set_results`). GetCharacterSetResults() CharacterSetID // GetCollation returns the collation for this session (defined by the system variable `collation_connection`). GetCollation() CollationID // GetPrivilegeSet returns the cached privilege set associated with this session, along with its counter. The // PrivilegeSet is only valid when the counter is greater than zero. GetPrivilegeSet() (PrivilegeSet, uint64) // SetPrivilegeSet updates this session's cache with the given counter and privilege set. Setting the counter to a // value of zero will force the cache to reload. This is an internal function and is not intended to be used by // integrators. SetPrivilegeSet(newPs PrivilegeSet, counter uint64) // ValidateSession provides integrators a chance to do any custom validation of this session before any query is executed in it. For example, Dolt uses this hook to validate that the session's working set is valid. ValidateSession(ctx *Context, dbName string) error }
Session holds the session data.
type SetType ¶
type SetType interface { Type CharacterSet() CharacterSetID Collation() CollationID // NumberOfElements returns the number of elements in this set. NumberOfElements() uint16 // BitsToString takes a previously-converted value and returns it as a string. BitsToString(bits uint64) (string, error) // Values returns all of the set's values in ascending order according to their corresponding bit value. Values() []string }
SetType represents the SET type. https://dev.mysql.com/doc/refman/8.0/en/set.html The type of the returned value is uint64.
func CreateSetType ¶
func CreateSetType(values []string, collation CollationID) (SetType, error)
CreateSetType creates a SetType.
func MustCreateSetType ¶
func MustCreateSetType(values []string, collation CollationID) SetType
MustCreateSetType is the same as CreateSetType except it panics on errors.
type SortField ¶
type SortField struct { // Column to order by. Column Expression // Column Expression2 to order by. This is always the same value as Column, but avoids a type cast Column2 Expression2 // Order type. Order SortOrder // NullOrdering defining how nulls will be ordered. NullOrdering NullOrdering }
SortField is a field by which a query will be sorted.
func (SortField) DebugString ¶
type SortFields ¶
type SortFields []SortField
func (SortFields) FromExpressions ¶
func (sf SortFields) FromExpressions(exprs ...Expression) SortFields
func (SortFields) ToExpressions ¶
func (sf SortFields) ToExpressions() []Expression
type SortOrder ¶
type SortOrder byte
SortOrder represents the order of the sort (ascending or descending).
type SpatialColumnType ¶
type SpatialColumnType interface { // GetSpatialTypeSRID returns the SRID value for spatial types. GetSpatialTypeSRID() (uint32, bool) // SetSRID sets SRID value for spatial types. SetSRID(uint32) Type // MatchSRID returns nil if column type SRID matches given value SRID otherwise returns error. MatchSRID(interface{}) error }
SpatialColumnType is a node that contains a reference to all spatial types.
type StatisticsTable ¶
type StatisticsTable interface { Table // DataLength returns the length of the data file (varies by engine). DataLength(ctx *Context) (uint64, error) // AnalyzeTable is a hook to update any cached or persisted statistics for this table. // It may be triggered by an analyze table statement, or automatically when the engine decides it is necessary. // Integrators can ignore this hook and implement their own method of keeping statistics up to date, at the // cost of potentially stale statistics. AnalyzeTable(ctx *Context) error // Statistics returns the statistics for this table Statistics(ctx *Context) (TableStatistics, error) }
StatisticsTable is a table that can provide information about its number of rows and other facts to improve query planning performance.
type StoredProcedureDatabase ¶
type StoredProcedureDatabase interface { Database // GetStoredProcedures returns all StoredProcedureDetails for the database. GetStoredProcedures(ctx *Context) ([]StoredProcedureDetails, error) // SaveStoredProcedure stores the given StoredProcedureDetails to the database. The integrator should verify that // the name of the new stored procedure is unique amongst existing stored procedures. SaveStoredProcedure(ctx *Context, spd StoredProcedureDetails) error // DropStoredProcedure removes the StoredProcedureDetails with the matching name from the database. DropStoredProcedure(ctx *Context, name string) error }
StoredProcedureDatabase is a database that supports the creation and execution of stored procedures. The engine will handle all parsing and execution logic for stored procedures. Integrators only need to store and retrieve StoredProcedureDetails, while verifying that all stored procedures have a unique name without regard to case-sensitivity.
type StoredProcedureDetails ¶
type StoredProcedureDetails struct { Name string // The name of this stored procedure. Names must be unique within a database. CreateStatement string // The CREATE statement for this stored procedure. CreatedAt time.Time // The time that the stored procedure was created. ModifiedAt time.Time // The time of the last modification to the stored procedure. }
StoredProcedureDetails are the details of the stored procedure. Integrators only need to store and retrieve the given details for a stored procedure, as the engine handles all parsing and processing.
type StringType ¶
type StringType interface { Type CharacterSet() CharacterSetID Collation() CollationID // MaxCharacterLength returns the maximum number of chars that can safely be stored in this type, based on // the current character set. MaxCharacterLength() int64 // MaxByteLength returns the maximum number of bytes that may be consumed by a value stored in this type. MaxByteLength() int64 // Length returns the maximum length, in characters, allowed for this string type. Length() int64 }
StringType represents all string types, including VARCHAR and BLOB. https://dev.mysql.com/doc/refman/8.0/en/char.html https://dev.mysql.com/doc/refman/8.0/en/binary-varbinary.html https://dev.mysql.com/doc/refman/8.0/en/blob.html The type of the returned value is string.
func CreateBinary ¶
func CreateBinary(baseType query.Type, lengthHint int64) (StringType, error)
CreateBinary creates a StringType with a binary collation and character set of the given size.
func CreateLongText ¶
func CreateLongText(collation CollationID) StringType
CreateLongText creates a LONGTEXT with the given collation.
func CreateMediumText ¶
func CreateMediumText(collation CollationID) StringType
CreateMediumText creates a MEDIUMTEXT with the given collation.
func CreateString ¶
func CreateString(baseType query.Type, length int64, collation CollationID) (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 ¶
func CreateStringWithDefaults(baseType query.Type, length int64) (StringType, error)
CreateStringWithDefaults creates a StringType with the default character set and collation of the given size.
func CreateText ¶
func CreateText(collation CollationID) StringType
CreateText creates a TEXT with the given collation.
func CreateTinyText ¶
func CreateTinyText(collation CollationID) StringType
CreateTinyText creates a TINYTEXT with the given collation.
func MustCreateBinary ¶
func MustCreateBinary(baseType query.Type, lengthHint int64) StringType
MustCreateBinary is the same as CreateBinary except it panics on errors.
func MustCreateString ¶
func MustCreateString(baseType query.Type, length int64, collation CollationID) StringType
MustCreateString is the same as CreateString except it panics on errors.
func MustCreateStringWithDefaults ¶
func MustCreateStringWithDefaults(baseType query.Type, length int64) StringType
MustCreateStringWithDefaults creates a StringType with the default CharacterSet and Collation.
type SystemVariable ¶
type SystemVariable struct { // Name is the name of the system variable. Name string // Scope defines the scope of the system variable, which is either Global, Session, or Both. Scope SystemVariableScope // Dynamic defines whether the variable may be written to during runtime. Variables with this set to `false` will // return an error if a user attempts to set a value. Dynamic bool // SetVarHintApplies defines if the variable may be set for a single query using SET_VAR(). // https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-set-var SetVarHintApplies bool // Type defines the type of the system variable. This may be a special type not accessible to standard MySQL operations. Type Type // Default defines the default value of the system variable. Default interface{} }
SystemVariable represents a system variable.
type SystemVariableScope ¶
type SystemVariableScope byte
SystemVariableScope represents the scope of a system variable.
const ( // SystemVariableScope_Global is set when the system variable exists only in the global context. SystemVariableScope_Global SystemVariableScope = iota // SystemVariableScope_Session is set when the system variable exists only in the session context. SystemVariableScope_Session // SystemVariableScope_Both is set when the system variable exists in both the global and session contexts. SystemVariableScope_Both // SystemVariableScope_Persist is set when the system variable is global and persisted. SystemVariableScope_Persist // SystemVariableScope_PersistOnly is set when the system variable is persisted outside of server context. SystemVariableScope_PersistOnly // SystemVariableScope_ResetPersist is used to remove a persisted variable SystemVariableScope_ResetPersist )
func (SystemVariableScope) String ¶
func (s SystemVariableScope) String() string
String returns the scope as an uppercase string.
type SystemVariableType ¶
type SystemVariableType interface { Type // EncodeValue returns the given value as a string for storage. EncodeValue(interface{}) (string, error) // DecodeValue returns the original value given to EncodeValue from the given string. This is different from `Convert`, // as the encoded value may technically be an "illegal" value according to the type rules. DecodeValue(string) (interface{}, error) }
SystemVariableType represents a SQL type specifically (and only) used in system variables. Assigning any non-system variables a SystemVariableType will cause errors.
func NewSystemBoolType ¶
func NewSystemBoolType(varName string) SystemVariableType
NewSystemBoolType returns a new systemBoolType.
func NewSystemDoubleType ¶
func NewSystemDoubleType(varName string, lowerbound, upperbound float64) SystemVariableType
NewSystemDoubleType returns a new systemDoubleType.
func NewSystemEnumType ¶
func NewSystemEnumType(varName string, values ...string) SystemVariableType
NewSystemEnumType returns a new systemEnumType.
func NewSystemIntType ¶
func NewSystemIntType(varName string, lowerbound, upperbound int64, negativeOne bool) SystemVariableType
NewSystemIntType returns a new systemIntType.
func NewSystemSetType ¶
func NewSystemSetType(varName string, values ...string) SystemVariableType
NewSystemSetType returns a new systemSetType.
func NewSystemStringType ¶
func NewSystemStringType(varName string) SystemVariableType
NewSystemStringType returns a new systemStringType.
func NewSystemUintType ¶
func NewSystemUintType(varName string, lowerbound, upperbound uint64) SystemVariableType
NewSystemUintType returns a new systemUintType.
type Table ¶
type Table interface { Nameable String() string Schema() Schema Collation() CollationID Partitions(*Context) (PartitionIter, error) PartitionRows(*Context, Partition) (RowIter, error) }
Table represents the backend of a SQL table.
func GetTableInsensitive ¶
GetTableInsensitive implements a case insensitive map lookup for tables keyed off of the table name. Looks for exact matches first. If no exact matches are found then any table matching the name case insensitively should be returned. If there is more than one table that matches a case insensitive comparison the resolution strategy is not defined.
type TableCopierDatabase ¶
type TableCopierDatabase interface { // CopyTableData copies the sourceTable data to the destinationTable and returns the number of rows copied. CopyTableData(ctx *Context, sourceTable string, destinationTable string) (uint64, error) }
TableCopierDatabase is a database that can copy a source table's data (without preserving indexed, fks, etc.) into another destination table.
type TableCreator ¶
type TableCreator interface { // CreateTable creates the table with the given name and schema. If a table with that name already exists, must return // sql.ErrTableAlreadyExists. CreateTable(ctx *Context, name string, schema PrimaryKeySchema, collation CollationID) error }
TableCreator should be implemented by databases that can create new tables.
type TableDropper ¶
TableDropper should be implemented by databases that can drop tables.
type TableEditor ¶
type TableEditor interface { // StatementBegin is called before the first operation of a statement. Integrators should mark the state of the data // in some way that it may be returned to in the case of an error. StatementBegin(ctx *Context) // DiscardChanges is called if a statement encounters an error, and all current changes since the statement beginning // should be discarded. DiscardChanges(ctx *Context, errorEncountered error) error // StatementComplete is called after the last operation of the statement, indicating that it has successfully completed. // The mark set in StatementBegin may be removed, and a new one should be created on the next StatementBegin. StatementComplete(ctx *Context) error }
TableEditor is the base interface for sub interfaces that can update rows in a table during an INSERT, REPLACE, UPDATE, or DELETE statement.
type TableFunction ¶
type TableFunction interface { Node Expressioner Databaser Nameable // NewInstance returns a new instance of the table function NewInstance(ctx *Context, db Database, expressions []Expression) (Node, error) }
TableFunction is a node that is generated by a function
type TableFunctionProvider ¶
type TableFunctionProvider interface { // TableFunction returns the table function with the name provided, case-insensitive TableFunction(ctx *Context, name string) (TableFunction, error) }
TableFunctionProvider is an extension of DatabaseProvider that allows custom table functions to be provided
type TableProgress ¶
type TableProgress struct { Progress PartitionsProgress map[string]PartitionProgress }
TableProgress keeps track of a table progress, and for each of its partitions
func NewTableProgress ¶
func NewTableProgress(name string, total int64) TableProgress
func (TableProgress) String ¶
func (p TableProgress) String() string
type TableRenamer ¶
type TableRenamer interface { // RenameTable renames a table from oldName to newName as given. If a table with newName already exists, must return // sql.ErrTableAlreadyExists. RenameTable(ctx *Context, oldName, newName string) error }
TableRenamer should be implemented by databases that can rename tables.
type TableRowIter ¶
type TableRowIter struct {
// contains filtered or unexported fields
}
TableRowIter is an iterator over the partitions in a table.
func NewTableRowIter ¶
func NewTableRowIter(ctx *Context, table Table, partitions PartitionIter) *TableRowIter
NewTableRowIter returns a new iterator over the rows in the partitions of the table given.
func (*TableRowIter) Close ¶
func (i *TableRowIter) Close(ctx *Context) error
type TableStatistics ¶
type TableStatistics interface { // CreatedAt returns the time at which the current statistics for this table were generated. CreatedAt() time.Time // RowCount returns the number of rows in this table. RowCount() uint64 // Histogram returns the histogram for the column in this table Histogram(colName string) (*Histogram, error) // HistogramMap returns a map from all column names to their associated histograms. // A nil HistogramMap indicates that this table hasn't been analyzed. HistogramMap() HistogramMap }
TableStatistics provides access to statistical information about the values stored in a table
type TableWrapper ¶
type TableWrapper interface { // Underlying returns the underlying table. Underlying() Table }
TableWrapper is a node that wraps the real table. This is needed because wrappers cannot implement some methods the table may implement.
type Tableable ¶
type Tableable interface { // Table returns the table name. Table() string }
Tableable is something that has a table.
type TemporaryTable ¶
type TemporaryTable interface {
IsTemporary() bool
}
type TemporaryTableCreator ¶
type TemporaryTableCreator interface { Database // CreateTemporaryTable creates the table with the given name and schema. If a temporary table with that name already exists, must // return sql.ErrTableAlreadyExists CreateTemporaryTable(ctx *Context, name string, schema PrimaryKeySchema, collation CollationID) error }
TemporaryTableCreator is a database that can create temporary tables that persist only as long as the session. Note that temporary tables with the same name as persisted tables take precedence in most SQL operations.
type TemporaryTableDatabase ¶
TemporaryTableDatabase is a database that can query the session (which manages the temporary table state) to retrieve the name of all temporary tables.
type TimeType ¶
type TimeType interface { 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 Transaction ¶
Transaction is an opaque type implemented by an integrator to record necessary information at the start of a transaction. Active transactions will be recorded in the session.
type TransactionCharacteristic ¶
type TransactionCharacteristic int
const ( ReadWrite TransactionCharacteristic = iota ReadOnly )
type TransactionDatabase ¶
type TransactionDatabase interface { Database // StartTransaction starts a new transaction and returns it StartTransaction(ctx *Context, tCharacteristic TransactionCharacteristic) (Transaction, error) // CommitTransaction commits the transaction given CommitTransaction(ctx *Context, tx Transaction) error // Rollback restores the database to the state recorded in the transaction given Rollback(ctx *Context, transaction Transaction) error // CreateSavepoint records a savepoint for the transaction given with the name given. If the name is already in use // for this transaction, the new savepoint replaces the old one. CreateSavepoint(ctx *Context, transaction Transaction, name string) error // RollbackToSavepoint restores the database to the state named by the savepoint RollbackToSavepoint(ctx *Context, transaction Transaction, name string) error // ReleaseSavepoint removes the savepoint named from the transaction given ReleaseSavepoint(ctx *Context, transaction Transaction, name string) error }
TransactionDatabase is a Database that can BEGIN, ROLLBACK and COMMIT transactions, as well as create SAVEPOINTS and restore to them.
type TreePrinter ¶
type TreePrinter struct {
// contains filtered or unexported fields
}
TreePrinter is a printer for tree nodes.
func (*TreePrinter) String ¶
func (p *TreePrinter) String() string
String returns the output of the printed tree.
func (*TreePrinter) WriteChildren ¶
func (p *TreePrinter) WriteChildren(children ...string) error
WriteChildren writes a children of the tree.
func (*TreePrinter) WriteNode ¶
func (p *TreePrinter) WriteNode(format string, args ...interface{}) error
WriteNode writes the main node.
type TriggerDatabase ¶
type TriggerDatabase interface { Database // GetTriggers returns all trigger definitions for the database GetTriggers(ctx *Context) ([]TriggerDefinition, error) // CreateTrigger is called when an integrator is asked to create a trigger. The create trigger statement string is // provided to store, along with the name of the trigger. CreateTrigger(ctx *Context, definition TriggerDefinition) error // DropTrigger is called when a trigger should no longer be stored. The name has already been validated. // Returns ErrTriggerDoesNotExist if the trigger was not found. DropTrigger(ctx *Context, name string) error }
TriggerDatabase is a Database that supports the creation and execution of triggers. The engine handles all parsing and execution logic for triggers. Integrators are not expected to parse or understand the trigger definitions, but must store and return them when asked.
type TriggerDefinition ¶
type TriggerDefinition struct { Name string // The name of this trigger. Trigger names in a database are unique. CreateStatement string // The text of the statement to create this trigger. CreatedAt time.Time // The time that the trigger was created. }
TriggerDefinition defines a trigger. Integrators are not expected to parse or understand the trigger definitions, but must store and return them when asked.
type TruncateableTable ¶
type TruncateableTable interface { Table // Truncate removes all rows from the table. If the table also implements DeletableTable and it is determined that // truncate would be equivalent to a DELETE which spans the entire table, then this function will be called instead. // Returns the number of rows that were removed. Truncate(*Context) (int, error) }
TruncateableTable is a table that can process the deletion of all rows.
type TupleType ¶
type TupleType []Type
func (TupleType) MaxTextResponseByteLength ¶
MaxTextResponseByteLength implements the Type interface
func (TupleType) MustConvert ¶
func (t TupleType) MustConvert(v interface{}) interface{}
type Type ¶
type Type interface { // Compare returns an integer comparing two values. // The result will be 0 if a==b, -1 if a < b, and +1 if a > b. Compare(interface{}, interface{}) (int, error) // Convert a value of a compatible type to a most accurate type. Convert(interface{}) (interface{}, error) // Equals returns whether the given type is equivalent to the calling type. All parameters are included in the // comparison, so ENUM("a", "b") is not equivalent to ENUM("a", "b", "c"). Equals(otherType Type) bool // MaxTextResponseByteLength returns the maximum number of bytes needed to serialize an instance of this type as a string in a response over the wire for MySQL's text protocol – in other words, this is the maximum bytes needed to serialize any value of this type as human-readable text, NOT in a more compact, binary representation. MaxTextResponseByteLength() uint32 // Promote will promote the current type to the largest representing type of the same kind, such as Int8 to Int64. Promote() Type // SQL returns the sqltypes.Value for the given value. // Implementations can optionally use |dest| to append // serialized data, but should not mutate existing data. SQL(ctx *Context, dest []byte, v interface{}) (sqltypes.Value, error) // Type returns the query.Type for the given Type. Type() query.Type // ValueType returns the Go type of the value returned by Convert(). ValueType() reflect.Type // Zero returns the golang zero value for this type Zero() interface{} fmt.Stringer }
Type represents a SQL type.
func ApproximateTypeFromValue ¶
func ApproximateTypeFromValue(val interface{}) Type
ApproximateTypeFromValue returns the closest matching type to the given value. For example, an int16 will return SMALLINT.
func ColumnTypeToType ¶
func ColumnTypeToType(ct *sqlparser.ColumnType) (Type, error)
ColumnTypeToType gets the column type using the column definition.
func CreateTuple ¶
CreateTuple returns a new tuple type with the given element types.
func GetColExprTypes ¶
GetColExprTypes returns a list of RangeColumnExpr type fields, defaulting to Null types if all columns expressions are Null.
func NewDeferredType ¶
type Type2 ¶
type Type2 interface { Type // Compare2 returns an integer comparing two Values. Compare2(Value, Value) (int, error) // Convert2 converts a value of a compatible type. Convert2(Value) (Value, error) // Zero2 returns the zero Value for this type. Zero2() Value // SQL2 returns the sqltypes.Value for the given value SQL2(Value) (sqltypes.Value, error) }
type TypeWithCollation ¶
type TypeWithCollation interface { Collation() CollationID WithNewCollation(collation CollationID) (Type, error) }
TypeWithCollation is implemented on all types that may return a collation.
type TypedValue ¶
type TypedValue struct { Typ Type Value interface{} }
TypedValue is a value along with its type.
type UniqueKeyError ¶
func (UniqueKeyError) Error ¶
func (ue UniqueKeyError) Error() string
type UnresolvedColumnDefault ¶
type UnresolvedColumnDefault struct {
// contains filtered or unexported fields
}
func (UnresolvedColumnDefault) Children ¶
func (u UnresolvedColumnDefault) Children() []Expression
func (UnresolvedColumnDefault) Eval ¶
func (u UnresolvedColumnDefault) Eval(ctx *Context, row Row) (interface{}, error)
func (UnresolvedColumnDefault) IsNullable ¶
func (u UnresolvedColumnDefault) IsNullable() bool
func (UnresolvedColumnDefault) Resolved ¶
func (u UnresolvedColumnDefault) Resolved() bool
func (UnresolvedColumnDefault) String ¶
func (u UnresolvedColumnDefault) String() string
func (UnresolvedColumnDefault) Type ¶
func (u UnresolvedColumnDefault) Type() Type
func (UnresolvedColumnDefault) WithChildren ¶
func (u UnresolvedColumnDefault) WithChildren(children ...Expression) (Expression, error)
type UnresolvedDatabase ¶
type UnresolvedDatabase string
UnresolvedDatabase is a database which has not been resolved yet.
func (UnresolvedDatabase) GetTableInsensitive ¶
func (UnresolvedDatabase) GetTableNames ¶
func (UnresolvedDatabase) GetTableNames(ctx *Context) ([]string, error)
func (UnresolvedDatabase) Name ¶
func (d UnresolvedDatabase) Name() string
Name returns the database name.
func (UnresolvedDatabase) Tables ¶
func (UnresolvedDatabase) Tables() map[string]Table
Tables returns the tables in the database.
type UnresolvedTable ¶
type UnresolvedTable interface { Nameable // Database returns the database name Database() string // WithAsOf returns a copy of this versioned table with its AsOf // field set to the given value. Analogous to WithChildren. WithAsOf(asOf Expression) (Node, error) //AsOf returns this table's asof expression. AsOf() Expression }
UnresolvedTable is a Table that is either unresolved or deferred for until an asOf resolution
type UnsupportedFunctionStub ¶
type UnsupportedFunctionStub interface {
IsUnsupported() bool
}
UnsupportedFunctionStub is a marker interface for function stubs that are unsupported
type UpdatableTable ¶
type UpdatableTable interface { Table // Updater returns a RowUpdater for this table. The RowUpdater will have Update called once for each row to be // updated, followed by a call to Close() when all rows have been processed. Updater(ctx *Context) RowUpdater }
UpdatableTable is a table that can process updates of existing rows via update statements.
type Value ¶
type Value struct { Typ querypb.Type Val ValueBytes }
Value is a logical index into a Row2. For efficiency reasons, use sparingly.
func ConvertToValue ¶
ConvertToValue converts the interface to a sql value.
type ValueBytes ¶
type ValueBytes []byte
type VersionedDatabase ¶
type VersionedDatabase interface { Database // GetTableInsensitiveAsOf retrieves a table by its case-insensitive name with the same semantics as // Database.GetTableInsensitive, but at a particular revision of the database. Implementors must choose which types // of expressions to accept as revision names. GetTableInsensitiveAsOf(ctx *Context, tblName string, asOf interface{}) (Table, bool, error) // GetTableNamesAsOf returns the table names of every table in the database as of the revision given. Implementors // must choose which types of expressions to accept as revision names. GetTableNamesAsOf(ctx *Context, asOf interface{}) ([]string, error) }
VersionedDatabase is a Database that can return tables as they existed at different points in time. The engine supports queries on historical table data via the AS OF construct introduced in SQL 2011.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is the parsed version of ViewDefinition Not meant to be used externally
func (*View) Definition ¶
Definition returns the definition of the view.
func (*View) TextDefinition ¶
TextDefinition returns the text definition of the view as originally defined.
type ViewDatabase ¶
type ViewDatabase interface { // CreateView persists the definition a view with the name and select statement given. If a view with that name // already exists, should return ErrExistingView CreateView(ctx *Context, name string, selectStatement string) error // DropView deletes the view named from persistent storage. If the view doesn't exist, should return // ErrViewDoesNotExist DropView(ctx *Context, name string) error // GetView returns the textual definition of the view with the name given, or false if it doesn't exist. GetView(ctx *Context, viewName string) (string, bool, error) // AllViews returns the definitions of all views in the database AllViews(ctx *Context) ([]ViewDefinition, error) }
ViewDatabase is implemented by databases that persist view definitions
type ViewDefinition ¶
ViewDefinition is the named textual definition of a view
type ViewKey ¶
type ViewKey struct {
// contains filtered or unexported fields
}
ViewKey is the key used to store view definitions
func NewViewKey ¶
NewViewKey creates a ViewKey ensuring both names are lowercase.
type ViewRegistry ¶
type ViewRegistry struct {
// contains filtered or unexported fields
}
ViewRegistry stores session-local views for databases that don't implement view storage. Each session gets a new view registry by default. Integrators that want views to persist across sessions should either implement sql.ViewDatabase, or construct their sessions to reuse the same ViewRegistry for each session.
func NewViewRegistry ¶
func NewViewRegistry() *ViewRegistry
NewViewRegistry creates an empty ViewRegistry.
func (*ViewRegistry) Delete ¶
func (r *ViewRegistry) Delete(databaseName, viewName string) error
Delete deletes the view specified by the pair {databaseName, viewName}, returning an error if it does not exist.
func (*ViewRegistry) Exists ¶
func (r *ViewRegistry) Exists(databaseName, viewName string) bool
Exists returns whether the specified key is already registered
func (*ViewRegistry) Register ¶
func (r *ViewRegistry) Register(database string, view *View) error
Register adds the view specified by the pair {database, view.Name()}, returning an error if there is already an element with that key.
func (*ViewRegistry) View ¶
func (r *ViewRegistry) View(databaseName, viewName string) (*View, bool)
View returns a pointer to the view specified by the pair {databaseName, viewName}, returning an error if it does not exist.
func (*ViewRegistry) ViewsInDatabase ¶
func (r *ViewRegistry) ViewsInDatabase(databaseName string) (views []*View)
ViewsInDatabase returns an array of all the views registered under the specified database.
type Visitor ¶
type Visitor interface { // Visit method is invoked for each expr encountered by Walk. // If the result Visitor is not nil, Walk visits each of the children // of the expr with that visitor, followed by a call of Visit(nil) // to the returned visitor. Visit(expr Expression) Visitor }
Visitor visits expressions in an expression tree.
type WindowAdaptableExpression ¶
type WindowAdaptableExpression interface { Expression // NewEvalable constructs an executable aggregation WindowFunction NewWindowFunction() (WindowFunction, error) }
WindowAdaptableExpression is an Expression that can be executed as a window aggregation
type WindowAggregation ¶
type WindowAggregation interface { WindowAdaptableExpression // Window returns this expression's window Window() *WindowDefinition // WithWindow returns a version of this window aggregation with the window given WithWindow(window *WindowDefinition) (WindowAggregation, error) }
WindowAggregation implements a window aggregation expression. A WindowAggregation is similar to an Aggregation, except that it returns a result row for every input row, as opposed to as single for the entire result set. A WindowAggregation is expected to track its input rows in the order received, and to return the value for the row index given on demand.
type WindowBuffer ¶
type WindowBuffer []Row
WindowBuffer is a type alias for a window materialization
type WindowDefinition ¶
type WindowDefinition struct { PartitionBy []Expression OrderBy SortFields Frame WindowFrame Ref string Name string // contains filtered or unexported fields }
A WindowDefinition specifies the window parameters of a window function
func NewWindowDefinition ¶
func NewWindowDefinition(partitionBy []Expression, orderBy SortFields, frame WindowFrame, ref, name string) *WindowDefinition
func (*WindowDefinition) DebugString ¶
func (w *WindowDefinition) DebugString() string
func (*WindowDefinition) FromExpressions ¶
func (w *WindowDefinition) FromExpressions(children []Expression) (*WindowDefinition, error)
FromExpressions returns copy of this window with the given expressions taken to stand in for the partition and order by fields. An error is returned if the lengths or types of these expressions are incompatible with this window.
func (*WindowDefinition) PartitionId ¶
func (w *WindowDefinition) PartitionId() (uint64, error)
func (*WindowDefinition) String ¶
func (w *WindowDefinition) String() string
func (*WindowDefinition) ToExpressions ¶
func (w *WindowDefinition) ToExpressions() []Expression
ToExpressions converts the PartitionBy and OrderBy expressions to a single slice of expressions suitable for manipulation by analyzer rules.
type WindowFrame ¶
type WindowFrame interface { fmt.Stringer // NewFramer constructs an executable WindowFramer NewFramer(*WindowDefinition) (WindowFramer, error) // UnboundedFollowing returns whether a frame end is unbounded UnboundedFollowing() bool // UnboundedPreceding returns whether a frame start is unbounded UnboundedPreceding() bool // StartCurrentRow returns whether a frame start is CURRENT ROW StartCurrentRow() bool // EndCurrentRow returns whether a frame end is CURRENT ROW EndCurrentRow() bool // StartNFollowing returns a frame's start preceding Expression or nil StartNPreceding() Expression // StartNFollowing returns a frame's start following Expression or nil StartNFollowing() Expression // EndNPreceding returns whether a frame end preceding Expression or nil EndNPreceding() Expression // EndNPreceding returns whether a frame end following Expression or nil EndNFollowing() Expression }
WindowFrame describe input bounds for an aggregation function execution. A frame will only have two non-null fields for the start and end bounds. A WindowFrame plan node is associated with an exec WindowFramer.
type WindowFramer ¶
type WindowFramer interface { // NewFramer is a prototype constructor that create a new Framer with pass-through // parent arguments NewFramer(WindowInterval) (WindowFramer, error) // Next returns the next WindowInterval frame, or an io.EOF error after the last row Next(*Context, WindowBuffer) (WindowInterval, error) // FirstIdx returns the current frame start index FirstIdx() int // LastIdx returns the last valid index in the current frame LastIdx() int // Interval returns the current frame as a WindowInterval Interval() (WindowInterval, error) }
WindowFramer is responsible for tracking window frame indices for partition rows. WindowFramer is aware of the framing strategy (offsets, ranges, etc), and is responsible for returning a WindowInterval for each partition row.
type WindowFunction ¶
type WindowFunction interface { Disposable // WithWindow passes fields from the parent WindowDefinition, deferring partial construction of a WindowFunction WithWindow(w *WindowDefinition) (WindowFunction, error) // StartPartition discards any previous state and initializes the aggregation for a new partition StartPartition(*Context, WindowInterval, WindowBuffer) error // DefaultFramer returns a new instance of the default WindowFramer for a particular aggregation DefaultFramer() WindowFramer // NewSlidingFrameInterval is updates the function's internal aggregation state for the next // Compute call using three WindowInterval: added, dropped, and current. //TODO: implement sliding window interface in aggregation functions and windowBlockIter //NewSlidingFrameInterval(added, dropped WindowInterval) // Compute returns an aggregation result for a given interval and buffer Compute(*Context, WindowInterval, WindowBuffer) interface{} }
WindowFunction performs aggregations on buffer intervals, optionally maintaining internal state for performance optimizations
type WindowInterval ¶
type WindowInterval struct {
Start, End int
}
WindowInterval is a WindowBuffer index range, where [Start] is inclusive, and [End] is exclusive
type WrappedInsertError ¶
func NewWrappedInsertError ¶
func NewWrappedInsertError(r Row, err error) WrappedInsertError
func (WrappedInsertError) Error ¶
func (w WrappedInsertError) Error() string
type WrappedTypeConversionError ¶
func NewWrappedTypeConversionError ¶
func NewWrappedTypeConversionError(offendingVal interface{}, idx int, err error) WrappedTypeConversionError
func (WrappedTypeConversionError) Error ¶
func (w WrappedTypeConversionError) Error() string
type YearType ¶
type YearType interface { Type }
YearType represents the YEAR type. https://dev.mysql.com/doc/refman/8.0/en/year.html The type of the returned value is int16.
var ( Year YearType = yearType{} ErrConvertingToYear = errors.NewKind("value %v is not a valid Year") )
Source Files
¶
- background_threads.go
- bit.go
- cache.go
- catalog.go
- charactersets.go
- collations.go
- column.go
- columndefault.go
- constraints.go
- convert_value.go
- core.go
- datetimetype.go
- decimal.go
- deferredtype.go
- engines.go
- enumtype.go
- errors.go
- external_stored_procedure_registry.go
- fast_int_set.go
- functions.go
- generator.go
- geometry.go
- geometry_collection.go
- index.go
- index_builder.go
- index_driver.go
- index_registry.go
- json.go
- json_value.go
- linestring.go
- lock_subsystem.go
- log.go
- memory.go
- multilinestring.go
- multipoint.go
- multipolygon.go
- nulltype.go
- numbertype.go
- ok_result.go
- partition.go
- point.go
- polygon.go
- privileges.go
- processlist.go
- provider.go
- range.go
- range_column_expr.go
- range_cut.go
- range_tree.go
- row.go
- row_frame.go
- schema.go
- session.go
- settype.go
- sort_field.go
- statistics.go
- stringtype.go
- system_booltype.go
- system_doubletype.go
- system_enumtype.go
- system_inttype.go
- system_settype.go
- system_stringtype.go
- system_uinttype.go
- system_variables.go
- table_iter.go
- testutils.go
- timetype.go
- treeprinter.go
- tupletype.go
- type.go
- unresolved_database.go
- viewregistry.go
- walk.go
- window.go
- yeartype.go