Documentation ¶
Index ¶
- Variables
- type Pool
- type Session
- func (s *Session) Begin(ctx context.Context) error
- func (s *Session) Commit(ctx context.Context) error
- func (s *Session) Execute(ctx context.Context, query string, label string, args ...any) ([]chunk.Row, error)
- func (s *Session) Reset()
- func (s *Session) Rollback()
- func (s *Session) RunInTxn(f func(*Session) error) (err error)
- func (s *Session) Session() sessionctx.Context
- func (s *Session) Txn() (kv.Transaction, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MockDDLOnce is only used for test. MockDDLOnce = int64(0) // TestNotifyBeginTxnCh is used for if the txn is beginning in RunInTxn. TestNotifyBeginTxnCh = make(chan struct{}) )
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is used to new Session.
func NewSessionPool ¶
func NewSessionPool(resPool *pools.ResourcePool) *Pool
NewSessionPool creates a new Session pool.
func (*Pool) Get ¶
func (sg *Pool) Get() (sessionctx.Context, error)
Get gets sessionCtx from context resource pool. Please remember to call Put after you finished using sessionCtx.
func (*Pool) Put ¶
func (sg *Pool) Put(ctx sessionctx.Context)
Put returns sessionCtx to context resource pool.
type Session ¶
type Session struct {
sessionctx.Context
}
Session wraps sessionctx.Context for transaction usage.
func (*Session) Execute ¶
func (s *Session) Execute(ctx context.Context, query string, label string, args ...any) ([]chunk.Row, error)
Execute executes a query.
func (*Session) Session ¶
func (s *Session) Session() sessionctx.Context
Session returns the sessionctx.Context.
Click to show internal directories.
Click to hide internal directories.