Versions in this module Expand all Collapse all v0 v0.6.0 Oct 1, 2019 Changes in this version + const ChecksumKey + const ColumnStatisticsTableName + const ColumnsTableName + const DateLayout + const DatetimeLayout + const FilesTableName + const IndexBatchSize + const InformationSchemaDatabaseName + const QueryKey + const SchemataTableName + const TablesTableName + const TimestampLayout + var Blob blobT + var Boolean booleanT + var Date dateT + var Datetime datetimeT + var ErrCharTruncation = errors.NewKind("string value of %q is longer than destination capacity %d") + var ErrChildrenAlreadyWritten = errors.New("treeprinter: children already written") + var ErrConvertToSQL = errors.NewKind("incompatible conversion to SQL type: %s") + var ErrConvertingToTime = errors.NewKind("value %q can't be converted to time.Time") + var ErrDatabaseNotFound = errors.NewKind("database not found: %s") + var ErrDeleteRowNotFound = errors.NewKind("row was not found when attempting to delete").New() + var ErrFunctionAlreadyRegistered = errors.NewKind("function '%s' is already registered") + var ErrFunctionNotFound = errors.NewKind("function: '%s' not found") + var ErrIndexDeleteInvalidStatus = errors.NewKind("can't delete index %q because it's not ready for removal") + var ErrIndexExpressionAlreadyRegistered = errors.NewKind("there is already an index registered for the expressions: %s") + var ErrIndexIDAlreadyRegistered = errors.NewKind("an index with id %q has already been registered") + var ErrIndexNotFound = errors.NewKind("index %q was not found") + var ErrInvalidArgumentNumber = errors.NewKind("function '%s' expected %v arguments, %v received") + var ErrInvalidChildrenNumber = errors.NewKind("%T: invalid children number, got %d, expected %d") + var ErrInvalidColumnNumber = errors.NewKind("tuple should contain %d column(s), but has %d") + var ErrInvalidType = errors.NewKind("invalid type: %s") + var ErrKeyNotFound = errors.NewKind("memory: key %d not found in cache") + var ErrNoMemoryAvailable = errors.NewKind("no memory available") + var ErrNodeAlreadyWritten = errors.New("treeprinter: node already written") + var ErrNodeNotWritten = errors.New("treeprinter: a child was written before the node") + var ErrNotArray = errors.NewKind("value of type %T is not an array") + var ErrNotGenerator = errors.NewKind("cannot convert value of type %T to a generator") + var ErrNotTuple = errors.NewKind("value of type %T is not a tuple") + var ErrPidAlreadyUsed = errors.NewKind("pid %d is already in use") + var ErrTableAlreadyExists = errors.NewKind("table with name %s already exists") + var ErrTableNotFound = errors.NewKind("table not found: %s") + var ErrTypeNotSupported = errors.NewKind("Type not supported: %s") + var ErrUnexpectedRowLength = errors.NewKind("expected %d values, got %d") + var ErrUnexpectedType = errors.NewKind("value at %d has unexpected type: %s") + var ErrValueNotNil = errors.NewKind("value not nil: %#v") + var ErrVarCharTruncation = errors.NewKind("string value of %q is longer than destination capacity %d") + var Float32 = numberT + var Float64 = numberT + var Int16 = numberT + var Int32 = numberT + var Int64 = numberT + var Int8 = numberT + var JSON jsonT + var Null nullT + var Text textT + var Timestamp timestampT + var TimestampLayouts = []string + var Uint16 = numberT + var Uint32 = numberT + var Uint64 = numberT + var Uint8 = numberT + func CacheKey(v interface{}) uint64 + func DefaultSessionConfig() map[string]TypedValue + func EvaluateCondition(ctx *Context, cond Expression, row Row) (bool, error) + func HasAvailableMemory(r Reporter) bool + func HasDefaultValue(s Session, key string) (bool, interface{}) + func IsArray(t Type) bool + func IsChar(t Type) bool + func IsDecimal(t Type) bool + func IsInteger(t Type) bool + func IsNull(ex Expression) bool + func IsNumber(t Type) bool + func IsSigned(t Type) bool + func IsText(t Type) bool + func IsTime(t Type) bool + func IsTuple(t Type) bool + func IsUnsigned(t Type) bool + func IsVarChar(t Type) bool + func MySQLTypeName(t Type) string + func NumColumns(t Type) int + func ValidateTime(t time.Time) interface + type Aggregation interface + Merge func(ctx *Context, buffer, partial Row) error + NewBuffer func() Row + Update func(ctx *Context, buffer, row Row) error + type Alterable interface + Create func(name string, schema Schema) error + type AscendIndex interface + AscendGreaterOrEqual func(keys ...interface{}) (IndexLookup, error) + AscendLessThan func(keys ...interface{}) (IndexLookup, error) + AscendRange func(greaterOrEqual, lessThan []interface{}) (IndexLookup, error) + type BaseSession struct + func (s *BaseSession) Address() string + func (s *BaseSession) ClearWarnings() + func (s *BaseSession) Client() Client + func (s *BaseSession) Get(key string) (Type, interface{}) + func (s *BaseSession) GetAll() map[string]TypedValue + func (s *BaseSession) ID() uint32 + func (s *BaseSession) Set(key string, typ Type, value interface{}) + func (s *BaseSession) Warn(warn *Warning) + func (s *BaseSession) WarningCount() uint16 + func (s *BaseSession) Warnings() []*Warning + type Catalog struct + func NewCatalog() *Catalog + func (c *Catalog) AddDatabase(db Database) + func (c *Catalog) AllDatabases() Databases + func (c *Catalog) CurrentDatabase() string + func (c *Catalog) Database(db string) (Database, error) + func (c *Catalog) LockTable(id uint32, table string) + func (c *Catalog) SetCurrentDatabase(db string) + func (c *Catalog) Table(db, table string) (Table, error) + func (c *Catalog) UnlockTables(ctx *Context, id uint32) error + type Checksumable interface + Checksum func() (string, error) + type Client struct + Address string + User string + type Column struct + Default interface{} + Name string + Nullable bool + Source string + Type Type + func (c *Column) Check(v interface{}) bool + func (c *Column) Equals(c2 *Column) bool + type Context struct + Memory *MemoryManager + func NewContext(ctx context.Context, opts ...ContextOption) *Context + func NewEmptyContext() *Context + func (c *Context) Error(code int, msg string, args ...interface{}) + func (c *Context) Pid() uint64 + func (c *Context) Query() string + func (c *Context) Span(opName string, opts ...opentracing.StartSpanOption) (opentracing.Span, *Context) + func (c *Context) Warn(code int, msg string, args ...interface{}) + func (c *Context) WithContext(ctx context.Context) *Context + type ContextOption func(*Context) + func WithMemoryManager(m *MemoryManager) ContextOption + func WithPid(pid uint64) ContextOption + func WithQuery(q string) ContextOption + func WithSession(s Session) ContextOption + func WithTracer(t opentracing.Tracer) ContextOption + type Database interface + Tables func() map[string]Table + func NewInformationSchemaDatabase(cat *Catalog) Database + type Databaser interface + Database func() Database + WithDatabase func(Database) (Node, error) + type Databases []Database + func (d *Databases) Add(db Database) + func (d Databases) Database(name string) (Database, error) + func (d Databases) Table(dbName string, tableName string) (Table, error) + type Deleter interface + Delete func(*Context, Row) error + type DescendIndex interface + DescendGreater func(keys ...interface{}) (IndexLookup, error) + DescendLessOrEqual func(keys ...interface{}) (IndexLookup, error) + DescendRange func(lessOrEqual, greaterThan []interface{}) (IndexLookup, error) + type Disposable interface + Dispose func() + type DisposeFunc func() + type Expression interface + Children func() []Expression + Eval func(*Context, Row) (interface{}, error) + IsNullable func() bool + Type func() Type + WithChildren func(...Expression) (Expression, error) + type Expressioner interface + Expressions func() []Expression + WithExpressions func(...Expression) (Node, error) + type FilteredTable interface + Filters func() []Expression + HandledFilters func(filters []Expression) []Expression + WithFilters func(filters []Expression) Table + type Freeable interface + Free func() + type Function interface + Call func(...Expression) (Expression, error) + type Function0 struct + Fn func() Expression + Name string + func (fn Function0) Call(args ...Expression) (Expression, error) + type Function1 struct + Fn func(e Expression) Expression + Name string + func (fn Function1) Call(args ...Expression) (Expression, error) + type Function2 struct + Fn func(e1, e2 Expression) Expression + Name string + func (fn Function2) Call(args ...Expression) (Expression, error) + type Function3 struct + Fn func(e1, e2, e3 Expression) Expression + Name string + func (fn Function3) Call(args ...Expression) (Expression, error) + type Function4 struct + Fn func(e1, e2, e3, e4 Expression) Expression + Name string + func (fn Function4) Call(args ...Expression) (Expression, error) + type Function5 struct + Fn func(e1, e2, e3, e4, e5 Expression) Expression + Name string + func (fn Function5) Call(args ...Expression) (Expression, error) + type Function6 struct + Fn func(e1, e2, e3, e4, e5, e6 Expression) Expression + Name string + func (fn Function6) Call(args ...Expression) (Expression, error) + type Function7 struct + Fn func(e1, e2, e3, e4, e5, e6, e7 Expression) Expression + Name string + func (fn Function7) Call(args ...Expression) (Expression, error) + type FunctionN struct + Fn func(...Expression) (Expression, error) + Name string + func (fn FunctionN) Call(args ...Expression) (Expression, error) + type FunctionRegistry map[string]Function + func NewFunctionRegistry() FunctionRegistry + func (r FunctionRegistry) Function(name string) (Function, error) + func (r FunctionRegistry) MustRegister(fn ...Function) + func (r FunctionRegistry) Register(fn ...Function) error + type Generator interface + Close func() error + Next func() (interface{}, error) + func NewArrayGenerator(array []interface{}) Generator + func ToGenerator(v interface{}) (Generator, error) + type Index interface + Database func() string + Driver func() string + Expressions func() []string + Get func(key ...interface{}) (IndexLookup, error) + Has func(partition Partition, key ...interface{}) (bool, error) + ID func() string + Table func() string + type IndexDriver interface + Create func(db, table, id string, expressions []Expression, config map[string]string) (Index, error) + Delete func(Index, PartitionIter) error + ID func() string + LoadAll func(db, table string) ([]Index, error) + Save func(*Context, Index, PartitionIndexKeyValueIter) error + type IndexKeyValueIter interface + Next func() ([]interface{}, []byte, error) + type IndexLookup interface + Indexes func() []string + Values func(Partition) (IndexValueIter, error) + type IndexRegistry struct + Root string + func NewIndexRegistry() *IndexRegistry + func (r *IndexRegistry) AddIndex(idx Index) (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) Index(db, id string) Index + func (r *IndexRegistry) IndexByExpression(db string, expr ...Expression) Index + func (r *IndexRegistry) IndexDriver(id string) IndexDriver + func (r *IndexRegistry) IndexesByTable(db, table string) []Index + func (r *IndexRegistry) LoadIndexes(dbs Databases) error + func (r *IndexRegistry) MarkOutdated(idx Index) + func (r *IndexRegistry) RegisterIndexDriver(driver IndexDriver) + func (r *IndexRegistry) ReleaseIndex(idx Index) + type IndexStatus byte + const IndexNotReady + const IndexOutdated + const IndexReady + func (s IndexStatus) IsUsable() bool + func (s IndexStatus) String() string + type IndexValueIter interface + Next func() ([]byte, error) + type IndexableTable interface + IndexKeyValues func(*Context, []string) (PartitionIndexKeyValueIter, error) + IndexLookup func() IndexLookup + WithIndexLookup func(IndexLookup) Table + type Inserter interface + Insert func(*Context, Row) error + type KeyValueCache interface + Get func(uint64) (interface{}, error) + Put func(uint64, interface{}) error + type Lockable interface + Lock func(ctx *Context, write bool) error + Unlock func(ctx *Context, id uint32) error + type MemoryManager struct + func NewMemoryManager(r Reporter) *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) NewRowsCache() (RowsCache, DisposeFunc) + type Mergeable interface + IsMergeable func(IndexLookup) bool + type Nameable interface + Name func() string + type NegateIndex interface + Not func(keys ...interface{}) (IndexLookup, error) + type Node interface + Children func() []Node + RowIter func(*Context) (RowIter, error) + Schema func() Schema + WithChildren func(...Node) (Node, error) + type OpaqueNode interface + Opaque func() bool + type Partition interface + Key func() []byte + type PartitionCounter interface + PartitionCount func(*Context) (int64, error) + type PartitionIndexKeyValueIter interface + Next func() (Partition, IndexKeyValueIter, error) + type PartitionIter interface + Next func() (Partition, error) + type Process struct + Connection uint32 + Kill context.CancelFunc + Pid uint64 + Progress map[string]Progress + Query string + StartedAt time.Time + Type ProcessType + User string + func (p *Process) Done() + func (p *Process) Seconds() uint64 + type ProcessList struct + func NewProcessList() *ProcessList + func (pl *ProcessList) AddProcess(ctx *Context, typ ProcessType, query string) (*Context, error) + func (pl *ProcessList) AddProgressItem(pid uint64, name string, total int64) + func (pl *ProcessList) Done(pid uint64) + func (pl *ProcessList) Kill(connID uint32) + func (pl *ProcessList) KillOnlyQueries(connID uint32) + func (pl *ProcessList) Processes() []Process + func (pl *ProcessList) UpdateProgress(pid uint64, name string, delta int64) + type ProcessType byte + const CreateIndexProcess + const QueryProcess + func (p ProcessType) String() string + type Progress struct + Done int64 + Total int64 + func (p Progress) String() string + type ProjectedTable interface + Projection func() []string + WithProjection func(colNames []string) Table + type Replacer interface + type Reporter interface + MaxMemory func() uint64 + UsedMemory func() uint64 + var ProcessMemory Reporter = new(processReporter) + type Resolvable interface + Resolved func() bool + type Row []interface + func (r Row) Copy() Row + func (r Row) Equals(row Row, schema Schema) (bool, error) + func NewRow(values ...interface{}) Row + func NodeToRows(ctx *Context, n Node) ([]Row, error) + func RowIterToRows(i RowIter) ([]Row, error) + type RowIter interface + Close func() error + Next func() (Row, error) + func NewSpanIter(span opentracing.Span, iter RowIter) RowIter + func RowsToRowIter(rows ...Row) RowIter + type RowsCache interface + Add func(Row) error + Get func() []Row + type Schema []*Column + func (s Schema) CheckRow(row Row) error + func (s Schema) Contains(column string, source string) bool + func (s Schema) Equals(s2 Schema) bool + func (s Schema) IndexOf(column, source string) int + type Session interface + Address func() string + ClearWarnings func() + Client func() Client + Get func(key string) (Type, interface{}) + GetAll func() map[string]TypedValue + ID func() uint32 + Set func(key string, typ Type, value interface{}) + Warn func(warn *Warning) + WarningCount func() uint16 + Warnings func() []*Warning + func NewBaseSession() Session + func NewSession(server, client, user string, id uint32) Session + type SetOperations interface + Difference func(...IndexLookup) IndexLookup + Intersection func(...IndexLookup) IndexLookup + Union func(...IndexLookup) IndexLookup + type Table interface + PartitionRows func(*Context, Partition) (RowIter, error) + Partitions func(*Context) (PartitionIter, error) + Schema func() Schema + String func() string + type TableWrapper interface + Underlying func() Table + type Tableable interface + Table func() string + type TransformExprFunc func(Expression) (Expression, error) + type TransformNodeFunc func(Node) (Node, error) + type TreePrinter struct + func NewTreePrinter() *TreePrinter + func (p *TreePrinter) String() string + func (p *TreePrinter) WriteChildren(children ...string) error + func (p *TreePrinter) WriteNode(format string, args ...interface{}) error + type Type interface + Compare func(interface{}, interface{}) (int, error) + Convert func(interface{}) (interface{}, error) + SQL func(interface{}) (sqltypes.Value, error) + Type func() query.Type + func Array(underlying Type) Type + func Char(length int) Type + func MysqlTypeToType(sql query.Type) (Type, error) + func Tuple(types ...Type) Type + func UnderlyingType(t Type) Type + func VarChar(length int) Type + type TypedValue struct + Typ Type + Value interface{} + type UnresolvedDatabase string + func (UnresolvedDatabase) Tables() map[string]Table + func (d UnresolvedDatabase) Name() string + type Warning struct + Code int + Level string + Message string