Documentation ¶
Index ¶
- Variables
- type ColumnWithRawDefault
- type Config
- type Engine
- func (e *Engine) AnalyzeQuery(ctx *sql.Context, query string) (sql.Node, error)
- func (e *Engine) BoundQueryPlan(ctx *sql.Context, query string, parsed sqlparser.Statement, ...) (sql.Node, error)
- func (e *Engine) Close() error
- func (e *Engine) CloseSession(connID uint32)
- func (e *Engine) EngineAnalyzer() *analyzer.Analyzer
- func (e *Engine) EnginePreparedDataCache() *PreparedDataCache
- func (e *Engine) InitializeEventScheduler(ctxGetterFunc func() (*sql.Context, func() error, error), ...) error
- func (e *Engine) IsReadOnly() bool
- func (e *Engine) PrepQueryPlanForExecution(ctx *sql.Context, query string, plan sql.Node) (sql.Schema, sql.RowIter, error)
- func (e *Engine) PrepareParsedQuery(ctx *sql.Context, statementKey, query string, stmt sqlparser.Statement) (sql.Node, error)
- func (e *Engine) PrepareQuery(ctx *sql.Context, query string) (sql.Node, error)
- func (e *Engine) Query(ctx *sql.Context, query string) (sql.Schema, sql.RowIter, error)
- func (e *Engine) QueryWithBindings(ctx *sql.Context, query string, parsed sqlparser.Statement, ...) (sql.Schema, sql.RowIter, error)
- func (e *Engine) WithBackgroundThreads(b *sql.BackgroundThreads) *Engine
- type PreparedDataCache
- func (p *PreparedDataCache) CacheStmt(sessId uint32, query string, stmt sqlparser.Statement)
- func (p *PreparedDataCache) CachedStatementsForSession(sessId uint32) map[string]sqlparser.Statement
- func (p *PreparedDataCache) DeleteSessionData(sessId uint32)
- func (p *PreparedDataCache) GetCachedStmt(sessId uint32, query string) (sqlparser.Statement, bool)
- func (p *PreparedDataCache) UncacheStmt(sessId uint32, query string)
- type ProcessList
- func (pl *ProcessList) AddConnection(id uint32, addr string)
- func (pl *ProcessList) AddPartitionProgress(pid uint64, tableName, partitionName string, total int64)
- func (pl *ProcessList) AddTableProgress(pid uint64, name string, total int64)
- func (pl *ProcessList) BeginQuery(ctx *sql.Context, query string) (*sql.Context, error)
- func (pl *ProcessList) ConnectionReady(sess sql.Session)
- func (pl *ProcessList) EndQuery(ctx *sql.Context)
- func (pl *ProcessList) Kill(connID uint32)
- func (pl *ProcessList) Processes() []sql.Process
- func (pl *ProcessList) RemoveConnection(connID uint32)
- func (pl *ProcessList) RemovePartitionProgress(pid uint64, tableName, partitionName string)
- func (pl *ProcessList) RemoveTableProgress(pid uint64, name string)
- func (pl *ProcessList) UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64)
- func (pl *ProcessList) UpdateTableProgress(pid uint64, name string, delta int64)
- type TemporaryUser
Constants ¶
This section is empty.
Variables ¶
var ExperimentalGMS bool
Functions ¶
This section is empty.
Types ¶
type ColumnWithRawDefault ¶
type Config ¶
type Config struct { // VersionPostfix to display with the `VERSION()` UDF. VersionPostfix string // IsReadOnly sets the engine to disallow modification queries. IsReadOnly bool IsServerLocked bool // IncludeRootAccount adds the root account (with no password) to the list of accounts, and also enables // authentication. IncludeRootAccount bool // TemporaryUsers adds any users that should be included when the engine is created. By default, authentication is // disabled, and including any users here will enable authentication. All users in this list will have full access. // This field is only temporary, and will be removed as development on users and authentication continues. TemporaryUsers []TemporaryUser }
Config for the Engine.
type Engine ¶
type Engine struct { Analyzer *analyzer.Analyzer LS *sql.LockSubsystem ProcessList sql.ProcessList MemoryManager *sql.MemoryManager BackgroundThreads *sql.BackgroundThreads ReadOnly atomic.Bool IsServerLocked bool PreparedDataCache *PreparedDataCache Version sql.AnalyzerVersion EventScheduler *eventscheduler.EventScheduler // contains filtered or unexported fields }
Engine is a SQL engine.
func New ¶
New creates a new Engine with custom configuration. To create an Engine with the default settings use `NewDefault`. Should call Engine.Close() to finalize dependency lifecycles.
func NewDefault ¶
func NewDefault(pro sql.DatabaseProvider) *Engine
NewDefault creates a new default Engine.
func (*Engine) AnalyzeQuery ¶
AnalyzeQuery analyzes a query and returns its sql.Node
func (*Engine) BoundQueryPlan ¶ added in v0.18.0
func (e *Engine) BoundQueryPlan(ctx *sql.Context, query string, parsed sqlparser.Statement, bindings map[string]*querypb.BindVariable) (sql.Node, error)
BoundQueryPlan returns query plan for the given statement with the given bindings applied
func (*Engine) CloseSession ¶ added in v0.12.0
CloseSession deletes session specific prepared statement data
func (*Engine) EngineAnalyzer ¶ added in v0.18.0
func (*Engine) EnginePreparedDataCache ¶ added in v0.18.0
func (e *Engine) EnginePreparedDataCache() *PreparedDataCache
func (*Engine) InitializeEventScheduler ¶ added in v0.18.0
func (e *Engine) InitializeEventScheduler(ctxGetterFunc func() (*sql.Context, func() error, error), status eventscheduler.SchedulerStatus, period int) error
InitializeEventScheduler initializes the EventScheduler for the engine with the given sql.Context getter function, |ctxGetterFunc, the EventScheduler |status|, and the |period| for the event scheduler to check for events to execute. If |period| is less than 1, then it is ignored and the default period (30s currently) is used. This function also initializes the EventScheduler of the analyzer of this engine.
func (*Engine) IsReadOnly ¶ added in v0.12.0
func (*Engine) PrepQueryPlanForExecution ¶ added in v0.18.0
func (e *Engine) PrepQueryPlanForExecution(ctx *sql.Context, query string, plan sql.Node) (sql.Schema, sql.RowIter, error)
PrepQueryPlanForExecution prepares a query plan for execution and returns the result schema with a row iterator to begin spooling results
func (*Engine) PrepareParsedQuery ¶ added in v0.18.0
func (e *Engine) PrepareParsedQuery( ctx *sql.Context, statementKey, query string, stmt sqlparser.Statement, ) (sql.Node, error)
PrepareParsedQuery returns a partially analyzed query for the parsed statement provided
func (*Engine) PrepareQuery ¶ added in v0.12.0
PrepareQuery returns a partially analyzed query
func (*Engine) QueryWithBindings ¶
func (e *Engine) QueryWithBindings(ctx *sql.Context, query string, parsed sqlparser.Statement, bindings map[string]*querypb.BindVariable) (sql.Schema, sql.RowIter, error)
QueryWithBindings executes the query given with the bindings provided. If parsed is non-nil, it will be used instead of parsing the query from text.
func (*Engine) WithBackgroundThreads ¶ added in v0.12.0
func (e *Engine) WithBackgroundThreads(b *sql.BackgroundThreads) *Engine
type PreparedDataCache ¶ added in v0.15.0
type PreparedDataCache struct {
// contains filtered or unexported fields
}
PreparedDataCache manages all the prepared data for every session for every query for an engine. There are two types of caching supported: 1. Prepared statements for MySQL, which are stored as sqlparser.Statements 2. Prepared statements for Postgres, which are stored as sql.Nodes TODO: move this into the session
func NewPreparedDataCache ¶ added in v0.15.0
func NewPreparedDataCache() *PreparedDataCache
func (*PreparedDataCache) CacheStmt ¶ added in v0.15.0
func (p *PreparedDataCache) CacheStmt(sessId uint32, query string, stmt sqlparser.Statement)
CacheStmt saves the parsed statement and associates a ctx.SessionId and query to it
func (*PreparedDataCache) CachedStatementsForSession ¶ added in v0.18.0
func (p *PreparedDataCache) CachedStatementsForSession(sessId uint32) map[string]sqlparser.Statement
CachedStatementsForSession returns all the prepared queries for a particular session
func (*PreparedDataCache) DeleteSessionData ¶ added in v0.15.0
func (p *PreparedDataCache) DeleteSessionData(sessId uint32)
DeleteSessionData clears a session along with all prepared queries for that session
func (*PreparedDataCache) GetCachedStmt ¶ added in v0.15.0
GetCachedStmt retrieves the prepared statement associated with the ctx.SessionId and query. Returns nil, false if the query does not exist
func (*PreparedDataCache) UncacheStmt ¶ added in v0.15.0
func (p *PreparedDataCache) UncacheStmt(sessId uint32, query string)
UncacheStmt removes the prepared node associated with a ctx.SessionId and query to it
type ProcessList ¶ added in v0.11.0
type ProcessList struct {
// contains filtered or unexported fields
}
ProcessList is a structure that keeps track of all the processes and their status.
func NewProcessList ¶ added in v0.11.0
func NewProcessList() *ProcessList
NewProcessList creates a new process list.
func (*ProcessList) AddConnection ¶ added in v0.15.0
func (pl *ProcessList) AddConnection(id uint32, addr string)
func (*ProcessList) AddPartitionProgress ¶ added in v0.11.0
func (pl *ProcessList) AddPartitionProgress(pid uint64, tableName, partitionName 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.
func (*ProcessList) AddTableProgress ¶ added in v0.11.0
func (pl *ProcessList) AddTableProgress(pid uint64, name string, total 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.
func (*ProcessList) BeginQuery ¶ added in v0.15.0
func (*ProcessList) ConnectionReady ¶ added in v0.15.0
func (pl *ProcessList) ConnectionReady(sess sql.Session)
func (*ProcessList) EndQuery ¶ added in v0.15.0
func (pl *ProcessList) EndQuery(ctx *sql.Context)
func (*ProcessList) Kill ¶ added in v0.11.0
func (pl *ProcessList) Kill(connID uint32)
Kill terminates all queries for a given connection id.
func (*ProcessList) Processes ¶ added in v0.11.0
func (pl *ProcessList) Processes() []sql.Process
Processes returns the list of current running processes.
func (*ProcessList) RemoveConnection ¶ added in v0.15.0
func (pl *ProcessList) RemoveConnection(connID uint32)
func (*ProcessList) RemovePartitionProgress ¶ added in v0.11.0
func (pl *ProcessList) RemovePartitionProgress(pid uint64, tableName, partitionName string)
RemovePartitionProgress removes an existing item tracking progress from the process with the given pid, if it exists.
func (*ProcessList) RemoveTableProgress ¶ added in v0.11.0
func (pl *ProcessList) RemoveTableProgress(pid uint64, name string)
RemoveTableProgress removes an existing item tracking progress from the process with the given pid, if it exists.
func (*ProcessList) UpdatePartitionProgress ¶ added in v0.11.0
func (pl *ProcessList) UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64)
UpdatePartitionProgress updates the progress of the table partition with the given name for the process with the given pid.
func (*ProcessList) UpdateTableProgress ¶ added in v0.11.0
func (pl *ProcessList) UpdateTableProgress(pid uint64, name string, delta int64)
UpdateTableProgress updates the progress of the table with the given name for the process with the given pid.
type TemporaryUser ¶ added in v0.12.0
TemporaryUser is a user that will be added to the engine. This is for temporary use while the remaining features are implemented. Replaces the old "auth.New..." functions for adding a user.
Directories ¶
Path | Synopsis |
---|---|
Package driver implements a driver for Go's database/sql support.
|
Package driver implements a driver for Go's database/sql support. |
internal
|
|
time
Package time contains low-level utility functions for working with time.Time values and timezones.
|
Package time contains low-level utility functions for working with time.Time values and timezones. |
optgen
|
|