executor

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PlanOutOfRange

func PlanOutOfRange(err error) bool

func Warning

func Warning(row Row) (warning error, err error)

Types

type CardinalityInfo

type CardinalityInfo struct {
	*ExplainAnalyzeInfo
	QError float64
}

func CollectEstAndActRows

func CollectEstAndActRows(ei *ExplainAnalyzeInfo) []*CardinalityInfo

type Comparable

type Comparable interface {
	fmt.Stringer
	Equal(other Comparable) bool
}

type Executor

type Executor interface {
	Dsn() string
	Query(query string) (Rows, error)
	QueryStream(query string) (RowStream, error)
	Exec(query string) (Result, error)
	GetHints(query string) (Hints, error)
	Explain(query string) (Rows, []error, error)
	ExplainAnalyze(query string) (Rows, []error, error)
}

type ExecutorImpl

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

func (*ExecutorImpl) Dsn added in v1.0.0

func (e *ExecutorImpl) Dsn() string

func (*ExecutorImpl) Exec

func (e *ExecutorImpl) Exec(query string) (result Result, err error)

func (*ExecutorImpl) Explain

func (e *ExecutorImpl) Explain(query string) (rows Rows, warnings []error, err error)

func (*ExecutorImpl) ExplainAnalyze

func (e *ExecutorImpl) ExplainAnalyze(query string) (rows Rows, warnings []error, err error)

func (*ExecutorImpl) GetHints

func (e *ExecutorImpl) GetHints(query string) (hints Hints, err error)

/ GetHints would query plan out of range warnings

func (*ExecutorImpl) Query

func (e *ExecutorImpl) Query(query string) (rows Rows, err error)

func (*ExecutorImpl) QueryStream

func (e *ExecutorImpl) QueryStream(query string) (stream RowStream, err error)

type ExplainAnalyzeInfo

type ExplainAnalyzeInfo struct {
	Op      string
	EstRows float64
	ActRows float64
	OpInfo  string
	Items   []*ExplainAnalyzeInfo
	// contains filtered or unexported fields
}

func NewExplainAnalyzeInfo

func NewExplainAnalyzeInfo(data Rows) *ExplainAnalyzeInfo

type Hints

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

func NewHints

func NewHints(raw string) Hints

func (Hints) Equal

func (h Hints) Equal(other Hints) bool

func (Hints) String

func (h Hints) String() string

type Pool

type Pool interface {
	Dsn() string
	Executor() Executor
	Transaction() (Transaction, error)
}

func NewPool

func NewPool(dsn string, options *PoolOptions) (pool Pool, err error)

type PoolImpl

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

func (*PoolImpl) Dsn added in v1.0.0

func (p *PoolImpl) Dsn() string

func (*PoolImpl) Executor

func (p *PoolImpl) Executor() Executor

func (*PoolImpl) Transaction

func (p *PoolImpl) Transaction() (Transaction, error)

type PoolOptions

type PoolOptions struct {
	MaxOpenConns   uint `json:"max_open_conns"`
	MaxIdleConns   uint `json:"max_idle_conns"`
	MaxLifeSeconds uint `json:"max_life_seconds"`
}

type QueryMode

type QueryMode uint8

type RawExecutor

type RawExecutor interface {
	Query(query string, args ...interface{}) (*sql.Rows, error)
	Exec(query string, args ...interface{}) (sql.Result, error)
}

type RawTransaction

type RawTransaction interface {
	RawExecutor
	Commit() error
	Rollback() error
}

type Result

type Result struct {
	LastInsertId, RowsAffected int64
}

func NewResult

func NewResult(result sql.Result) (ret Result, err error)

func (Result) Equal

func (r Result) Equal(other Comparable) bool

func (Result) String

func (r Result) String() string

type Row

type Row [][]byte

func (Row) Equal

func (r Row) Equal(other Row) bool

func (Row) ToTableRow

func (r Row) ToTableRow() table.Row

type RowStream

type RowStream struct {
	ColumnsMap map[string]int
	Columns    Row
	// contains filtered or unexported fields
}

func NewRowStream

func NewRowStream(rows *sql.Rows) (ret RowStream, err error)

func (*RowStream) Next

func (s *RowStream) Next() (row Row, err error)

func (*RowStream) NextBatch

func (s *RowStream) NextBatch(size uint) (rows []Row, err error)

type Rows

type Rows struct {
	ColumnMap map[string]int
	Columns   Row
	Data      []Row
}

func NewRows

func NewRows(rows *sql.Rows) (ret Rows, err error)

func (Rows) ColumnNums

func (r Rows) ColumnNums() int

func (Rows) Equal

func (r Rows) Equal(other Comparable) bool

func (Rows) RowCount

func (r Rows) RowCount() int

func (Rows) String

func (r Rows) String() string

type Transaction

type Transaction interface {
	Executor
	Commit() error
	Rollback() error
}

type TransactionImpl

type TransactionImpl struct {
	ExecutorImpl
	// contains filtered or unexported fields
}

func (*TransactionImpl) Commit

func (t *TransactionImpl) Commit() error

func (*TransactionImpl) Rollback

func (t *TransactionImpl) Rollback() error

Jump to

Keyboard shortcuts

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