engine

package
v0.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const TimeBucketName = "time_bucket"

Variables

View Source
var (

	// ErrRowTimeout will be returned if the wait for the row is longer than the connection timeout
	ErrRowTimeout = errors.NewKind("row read wait bigger than connection timeout")

	// ErrConnectionWasClosed will be returned if we try to use a previously closed connection
	ErrConnectionWasClosed = errors.NewKind("connection was closed")
)
View Source
var Columns, Indexed = func() (o []storev1.Column, idx map[string]bool) {
	idx = make(map[string]bool)
	for i := storev1.Column_bounce; i <= storev1.Column_utm_term; i++ {
		if i > storev1.Column_timestamp {
			idx[i.String()] = true
		}
		o = append(o, i)
	}
	return
}()

Functions

func NewTimeBucket added in v0.0.40

func NewTimeBucket(args ...sql.Expression) (sql.Expression, error)

Types

type Auth

type Auth struct {
	DB         db.Provider
	PrivateKey ed25519.PrivateKey
}

func (*Auth) AuthMethod

func (a *Auth) AuthMethod(user, addr string) (string, error)

func (*Auth) Negotiate

func (a *Auth) Negotiate(c *mysql.Conn, user string, remoteAddr net.Addr) (mysql.Getter, error)

func (*Auth) Salt

func (a *Auth) Salt() ([]byte, error)

func (*Auth) ValidateHash

func (a *Auth) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (mysql.Getter, error)

type Context added in v0.0.29

type Context struct {
	DB      db.Provider
	Reader  b3.Reader
	Metrics *metrics.Metrics
}

type DB added in v0.0.28

type DB struct {
	Context
}

func (*DB) GetTableInsensitive added in v0.0.28

func (db *DB) GetTableInsensitive(ctx *sql.Context, tblName string) (table sql.Table, ok bool, err error)

func (*DB) GetTableNames added in v0.0.28

func (db *DB) GetTableNames(ctx *sql.Context) (names []string, err error)

func (DB) IsReadOnly added in v0.0.28

func (DB) IsReadOnly() bool

func (DB) Name added in v0.0.28

func (DB) Name() string

type Engine

type Engine struct {
	Context
	*sqle.Engine
}

func Get

func Get(ctx context.Context) *Engine

func New

func New(ctx Context) *Engine

func Open

func Open(ctx context.Context) (context.Context, *Engine)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is a connection handler for a SQLe engine, implementing the Vitess mysql.Handler interface.

func (*Handler) ComInitDB

func (h *Handler) ComInitDB(c *mysql.Conn, schemaName string) error

func (*Handler) ComMultiQuery

func (h *Handler) ComMultiQuery(
	c *mysql.Conn,
	query string,
	callback func(*sqltypes.Result, bool) error,
) (string, error)

func (*Handler) ComPrepare

func (h *Handler) ComPrepare(c *mysql.Conn, query string) ([]*query.Field, error)

ComPrepare parses, partially analyzes, and caches a prepared statement's plan with the given [c.ConnectionID].

func (*Handler) ComQuery

func (h *Handler) ComQuery(
	c *mysql.Conn,
	query string,
	callback func(*sqltypes.Result, bool) error,
) error

ComQuery executes a SQL query on the SQLe engine.

func (*Handler) ComResetConnection

func (h *Handler) ComResetConnection(c *mysql.Conn)

func (*Handler) ComStmtExecute

func (h *Handler) ComStmtExecute(c *mysql.Conn, prepare *mysql.PrepareData, callback func(*sqltypes.Result) error) error

func (*Handler) ConnectionClosed

func (h *Handler) ConnectionClosed(c *mysql.Conn)

ConnectionClosed reports that a connection has been closed.

func (*Handler) NewConnection

func (h *Handler) NewConnection(c *mysql.Conn)

NewConnection reports that a new connection has been established.

func (*Handler) ParserOptionsForConnection

func (h *Handler) ParserOptionsForConnection(c *mysql.Conn) (sqlparser.ParserOptions, error)

func (*Handler) WarningCount

func (h *Handler) WarningCount(c *mysql.Conn) uint16

WarningCount is called at the end of each query to obtain the value to be returned to the client in the EOF packet. Note that this will be called either in the context of the ComQuery callback if the result does not contain any fields, or after the last ComQuery call completes.

type Index added in v0.0.38

type Index struct {
	DB        string // required for engine tests with driver
	Tbl       *Table // required for engine tests with driver
	TableName string
	Name      string
	Exprs     []sql.Expression

	PrefixLens []uint16
	// contains filtered or unexported fields
}

func (*Index) CanSupport added in v0.0.38

func (idx *Index) CanSupport(...sql.Range) bool

func (*Index) ColumnExpressionTypes added in v0.0.38

func (idx *Index) ColumnExpressionTypes() []sql.ColumnExpressionType

func (*Index) ColumnExpressions added in v0.0.38

func (idx *Index) ColumnExpressions() []sql.Expression

func (*Index) Comment added in v0.0.38

func (idx *Index) Comment() string

func (*Index) Database added in v0.0.38

func (idx *Index) Database() string

func (*Index) Expressions added in v0.0.38

func (idx *Index) Expressions() []string

func (*Index) ExtendedColumnExpressionTypes added in v0.0.38

func (idx *Index) ExtendedColumnExpressionTypes() []sql.ColumnExpressionType

func (*Index) ExtendedExpressions added in v0.0.38

func (idx *Index) ExtendedExpressions() []string

func (*Index) ID added in v0.0.38

func (idx *Index) ID() string

func (*Index) IndexType added in v0.0.38

func (idx *Index) IndexType() string

func (*Index) IsFullText added in v0.0.38

func (idx *Index) IsFullText() bool

func (*Index) IsGenerated added in v0.0.38

func (idx *Index) IsGenerated() bool

func (*Index) IsSpatial added in v0.0.38

func (idx *Index) IsSpatial() bool

func (*Index) IsUnique added in v0.0.38

func (idx *Index) IsUnique() bool

func (*Index) PrefixLengths added in v0.0.38

func (idx *Index) PrefixLengths() []uint16

func (*Index) Table added in v0.0.38

func (idx *Index) Table() string

type IndexedTable added in v0.0.38

type IndexedTable struct {
	*Table
	Lookup sql.IndexLookup
}

func (*IndexedTable) LookupPartitions added in v0.0.38

func (t *IndexedTable) LookupPartitions(ctx *sql.Context, lookup sql.IndexLookup) (sql.PartitionIter, error)

func (*IndexedTable) PartitionRows added in v0.0.38

func (t *IndexedTable) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)

PartitionRows implements the sql.PartitionRows interface.

type MultiStmtMode added in v0.0.38

type MultiStmtMode int
const (
	MultiStmtModeOff MultiStmtMode = 0
	MultiStmtModeOn  MultiStmtMode = 1
)

type Partition added in v0.0.28

type Partition struct {
	BlockID    []byte
	BlockIndex *blocksv1.BlockIndex
	RowGroups  []int
}

func (*Partition) Groups added in v0.0.40

func (p *Partition) Groups() []int

func (*Partition) Index added in v0.0.40

func (p *Partition) Index() *blocksv1.BlockIndex

func (*Partition) Key added in v0.0.28

func (p *Partition) Key() []byte

type Provider

type Provider struct {
	Context
}

func (*Provider) AllDatabases

func (p *Provider) AllDatabases(_ *sql.Context) []sql.Database

func (*Provider) Database

func (p *Provider) Database(_ *sql.Context, name string) (sql.Database, error)

func (*Provider) Function added in v0.0.40

func (p *Provider) Function(ctx *sql.Context, name string) (sql.Function, error)

func (*Provider) HasDatabase

func (p *Provider) HasDatabase(_ *sql.Context, name string) bool

type Server added in v0.0.24

type Server struct {
	*mysql.Listener
}

func Listen added in v0.0.24

func Listen(ctx context.Context) (*Server, error)

func (*Server) Close added in v0.0.24

func (s *Server) Close() error

func (*Server) Start added in v0.0.24

func (s *Server) Start() error

type StaticUserData

type StaticUserData string

func (StaticUserData) Get

Get returns the wrapped username and groups

type Table

type Table struct {
	Context
	// contains filtered or unexported fields
}

func (*Table) Collation added in v0.0.28

func (t *Table) Collation() sql.CollationID

func (*Table) GetIndexes added in v0.0.38

func (t *Table) GetIndexes(ctx *sql.Context) ([]sql.Index, error)

func (*Table) IndexedAccess added in v0.0.38

func (t *Table) IndexedAccess(i sql.IndexLookup) sql.IndexedTable

func (*Table) Name added in v0.0.28

func (t *Table) Name() string

func (*Table) PartitionRows added in v0.0.28

func (t *Table) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)

func (*Table) Partitions added in v0.0.28

func (t *Table) Partitions(*sql.Context) (sql.PartitionIter, error)

func (*Table) Projections added in v0.0.28

func (t *Table) Projections() (o []string)

func (*Table) Schema added in v0.0.28

func (t *Table) Schema() sql.Schema

func (*Table) String added in v0.0.28

func (t *Table) String() string

func (*Table) WithProjections added in v0.0.28

func (t *Table) WithProjections(colNames []string) sql.Table

type TimeBucket added in v0.0.40

type TimeBucket struct {
	// contains filtered or unexported fields
}

func (*TimeBucket) Children added in v0.0.40

func (t *TimeBucket) Children() []sql.Expression

Children implements the sql.Expression interface.

func (*TimeBucket) Description added in v0.0.40

func (t *TimeBucket) Description() string

Description implements sql.FunctionExpression

func (*TimeBucket) Eval added in v0.0.40

func (t *TimeBucket) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the sql.Expression interface.

func (*TimeBucket) FunctionName added in v0.0.40

func (t *TimeBucket) FunctionName() string

FunctionName implements sql.FunctionExpression

func (*TimeBucket) IsNullable added in v0.0.40

func (t *TimeBucket) IsNullable() bool

IsNullable implements the sql.Expression interface.

func (*TimeBucket) Resolved added in v0.0.40

func (t *TimeBucket) Resolved() bool

Resolved implements the sql.Expression interface.

func (*TimeBucket) String added in v0.0.40

func (t *TimeBucket) String() string

func (*TimeBucket) Type added in v0.0.40

func (t *TimeBucket) Type() sql.Type

Type implements the sql.Expression interface.

func (*TimeBucket) WithChildren added in v0.0.40

func (t *TimeBucket) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL