Documentation ¶
Index ¶
- func AppendBytesRows(m *MemResult, col int, values [][]byte) error
- func AppendFixedRows[T any](m *MemResult, col int, values []T) error
- func AppendStringRows(m *MemResult, col int, values []string) error
- func GetBytesRows(vec *vector.Vector) [][]byte
- func GetFixedRows[T any](vec *vector.Vector) []T
- func GetStringRows(vec *vector.Vector) []string
- type MemResult
- type Options
- func (opts Options) AccountID() uint32
- func (opts Options) Database() string
- func (opts Options) DisableIncrStatement() bool
- func (opts Options) ExistsTxn() bool
- func (opts Options) GetTimeZone() *time.Location
- func (opts Options) HasAccountID() bool
- func (opts Options) HasExistsTxn() bool
- func (opts Options) MinCommittedTS() timestamp.Timestamp
- func (opts Options) SetupNewTxn(txnOp client.TxnOperator) Options
- func (opts Options) Txn() client.TxnOperator
- func (opts Options) WaitCommittedLogApplied() bool
- func (opts Options) WithAccountID(accountID uint32) Options
- func (opts Options) WithDatabase(database string) Options
- func (opts Options) WithDisableIncrStatement() Options
- func (opts Options) WithMinCommittedTS(ts timestamp.Timestamp) Options
- func (opts Options) WithTimeZone(timeZone *time.Location) Options
- func (opts Options) WithTxn(txnOp client.TxnOperator) Options
- func (opts Options) WithWaitCommittedLogApplied() Options
- type Result
- type SQLExecutor
- type TxnExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBytesRows ¶
GetBytesRows get bytes rows, varchar, varbinary, text, json, etc.
func GetFixedRows ¶
GetFixedRows get fixed rows, int, float, etc.
func GetStringRows ¶
GetStringRows get bytes rows, varchar, varbinary, text, json, etc.
Types ¶
type MemResult ¶
type MemResult struct {
// contains filtered or unexported fields
}
MemResult used to test. Construct a Result from memory.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options execute options.
func (Options) DisableIncrStatement ¶ added in v1.0.0
DisableIncrStatement returns the txn operator need incr a new input statement
func (Options) ExistsTxn ¶
ExistsTxn return true if the txn is a exists txn which is not create by executor
func (Options) GetTimeZone ¶ added in v1.0.0
GetTimeZone return the time zone of original session
func (Options) HasAccountID ¶
HasAccountID returns true if account is set
func (Options) HasExistsTxn ¶
HasExistsTxn return true if a exists txn is set
func (Options) MinCommittedTS ¶
MinCommittedTS returns min committed ts
func (Options) SetupNewTxn ¶
func (opts Options) SetupNewTxn(txnOp client.TxnOperator) Options
SetupNewTxn setup new txn
func (Options) WaitCommittedLogApplied ¶
WaitCommittedLogApplied return true means need wait committed log applied in current cn.
func (Options) WithAccountID ¶
WithAccountID execute sql in account
func (Options) WithDatabase ¶
WithDatabase exec sql in database
func (Options) WithDisableIncrStatement ¶ added in v1.0.0
WithDisableIncrStatement disable incr statement
func (Options) WithMinCommittedTS ¶
WithMinCommittedTS use minCommittedTS to exec sql. It will set txn's snapshot to minCommittedTS+1, so the txn can see the data which committed at minCommittedTS. It's not work if txn operator is set.
func (Options) WithTimeZone ¶ added in v1.0.0
func (Options) WithTxn ¶
func (opts Options) WithTxn(txnOp client.TxnOperator) Options
WithTxn exec sql in a exists txn
func (Options) WithWaitCommittedLogApplied ¶
WithWaitCommittedLogApplied if set, the executor will wait all committed log applied for the txn.
type Result ¶
type Result struct { AffectedRows uint64 Batches []*batch.Batch // contains filtered or unexported fields }
Result exec sql result
type SQLExecutor ¶
type SQLExecutor interface { // Exec exec a sql in a exists txn. Exec(ctx context.Context, sql string, opts Options) (Result, error) // ExecTxn executor sql in a txn. execFunc can use TxnExecutor to exec multiple sql // in a transaction. ExecTxn(ctx context.Context, execFunc func(TxnExecutor) error, opts Options) error }
SQLExecutor is used to execute internal sql. All internal requirements for writing data should be done using the internal sql executor, otherwise pessimistic transactions may not work.
func NewMemExecutor ¶
func NewMemExecutor(mocker func(sql string) (Result, error)) SQLExecutor
NewMemExecutor used to testing
type TxnExecutor ¶
type TxnExecutor interface { Exec(sql string) (Result, error) Txn() client.TxnOperator }
TxnExecutor exec all sql in a transaction.