package table
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/table"
Index ¶
- Variables
- func ErrNoProgress(attempts int) error
- type Client
- type Session
- type SessionBuilder
- type SessionProvider
- type SessionProviderFunc
- func (f SessionProviderFunc) CloseSession(ctx context.Context, s Session) error
- func (f SessionProviderFunc) Get(ctx context.Context) (Session, error)
- func (f SessionProviderFunc) Put(ctx context.Context, s Session) error
- type Statement
- func (s *Statement) Execute( ctx context.Context, tx *table.TransactionControl, params *table.QueryParameters, opts ...options.ExecuteDataQueryOption, ) ( txr table.Transaction, r result.Result, err error, )
- func (s *Statement) NumInput() int
- func (s *Statement) Text() string
- type Transaction
- func (tx *Transaction) CommitTx( ctx context.Context, opts ...options.CommitTransactionOption, ) (r result.Result, err error)
- func (tx *Transaction) Execute( ctx context.Context, query string, params *table.QueryParameters, opts ...options.ExecuteDataQueryOption, ) (r result.Result, err error)
- func (tx *Transaction) ExecuteStatement( ctx context.Context, stmt table.Statement, params *table.QueryParameters, opts ...options.ExecuteDataQueryOption, ) (r result.Result, err error)
- func (tx *Transaction) ID() string
- func (tx *Transaction) IsNil() bool
- func (tx *Transaction) Rollback(ctx context.Context) (err error)
Variables ¶
var ( // ErrSessionPoolClosed is returned by a client instance to indicate // that client is closed and not able to complete requested operation. ErrSessionPoolClosed = errors.New("ydb: table: session pool is closed") // ErrSessionPoolOverflow is returned by a client instance to indicate // that the client is full and requested operation is not able to complete. ErrSessionPoolOverflow = errors.New("ydb: table: session pool overflow") // ErrSessionUnknown is returned by a client instance to indicate that // requested session does not exist within the client. ErrSessionUnknown = errors.New("ydb: table: unknown session") )
Functions ¶
func ErrNoProgress ¶
ErrNoProgress is returned by a client instance to indicate that operation could not be completed.
Types ¶
type Client ¶
type Client interface { table.Client Get(ctx context.Context) (s Session, err error) Put(ctx context.Context, s Session) (err error) CloseSession(ctx context.Context, s Session) (err error) }
func New ¶
type Session ¶
type Session interface { table.ClosableSession IsClosed() bool Status() string OnClose(f func(ctx context.Context)) }
type SessionBuilder ¶
SessionBuilder is the interface that holds logic of creating sessions.
type SessionProvider ¶
type SessionProvider interface { // Get returns alive idle session or creates new one. Get(context.Context) (Session, error) // Put takes no longer needed session for reuse or deletion depending // on implementation. // Put must be fast, if necessary must be async Put(context.Context, Session) (err error) // CloseSession provides the most effective way of session closing // instead of plain session.Close(). // CloseSession must be fast. If necessary, can be async. CloseSession(ctx context.Context, s Session) error }
SessionProvider is the interface that holds session lifecycle logic.
func SingleSession ¶
func SingleSession(s Session) SessionProvider
SingleSession returns SessionProvider that uses only given session during retries.
type SessionProviderFunc ¶
type SessionProviderFunc struct { OnGet func(context.Context) (Session, error) OnPut func(context.Context, Session) error }
func (SessionProviderFunc) CloseSession ¶
func (f SessionProviderFunc) CloseSession(ctx context.Context, s Session) error
func (SessionProviderFunc) Get ¶
func (f SessionProviderFunc) Get(ctx context.Context) (Session, error)
func (SessionProviderFunc) Put ¶
func (f SessionProviderFunc) Put(ctx context.Context, s Session) error
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
Statement is a prepared statement. Like a single session, it is not safe for concurrent use by multiple goroutines.
func (*Statement) Execute ¶
func (s *Statement) Execute( ctx context.Context, tx *table.TransactionControl, params *table.QueryParameters, opts ...options.ExecuteDataQueryOption, ) ( txr table.Transaction, r result.Result, err error, )
Execute executes prepared data query.
func (*Statement) NumInput ¶
func (*Statement) Text ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is a database transaction. Hence session methods are not goroutine safe, Transaction is not goroutine safe either.
func (*Transaction) CommitTx ¶
func (tx *Transaction) CommitTx( ctx context.Context, opts ...options.CommitTransactionOption, ) (r result.Result, err error)
CommitTx commits specified active transaction.
func (*Transaction) Execute ¶
func (tx *Transaction) Execute( ctx context.Context, query string, params *table.QueryParameters, opts ...options.ExecuteDataQueryOption, ) (r result.Result, err error)
Execute executes query represented by text within transaction tx.
func (*Transaction) ExecuteStatement ¶
func (tx *Transaction) ExecuteStatement( ctx context.Context, stmt table.Statement, params *table.QueryParameters, opts ...options.ExecuteDataQueryOption, ) (r result.Result, err error)
ExecuteStatement executes prepared statement stmt within transaction tx.
func (*Transaction) ID ¶
func (tx *Transaction) ID() string
func (*Transaction) IsNil ¶
func (tx *Transaction) IsNil() bool
func (*Transaction) Rollback ¶
func (tx *Transaction) Rollback(ctx context.Context) (err error)
Rollback performs a rollback of the specified active transaction.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal/table/scanner |
- Version
- v3.7.2
- Published
- Jan 17, 2022
- Platform
- darwin/amd64
- Imports
- 29 packages
- Last checked
- now –
Tools for package owners.