Documentation ¶
Index ¶
- Constants
- func BeginTx(opts ...TransactionOption) internal.ControlOption
- func CommitTx() internal.ControlOption
- func Stats(client Client) (*pool.Stats, error)deprecated
- func WithCallOptions(opts ...grpc.CallOption) options.CallOptions
- func WithCommit() options.TxExecuteOption
- func WithExecMode(mode options.ExecMode) options.ExecModeOption
- func WithIdempotent() options.RetryOptionsOption
- func WithInconsistentReads() internal.OnlineReadOnlyOption
- func WithLabel(lbl string) options.RetryOptionsOption
- func WithParameters(parameters *params.Parameters) options.ParametersOption
- func WithRetryBudget(b budget.Budget) options.RetryOptionsOption
- func WithStatsMode(mode options.StatsMode) options.StatsModeOption
- func WithSyntax(syntax options.Syntax) options.SyntaxOption
- func WithTrace(t *trace.Query) options.TraceOption
- func WithTx(t tx.Identifier) internal.ControlOption
- func WithTxControl(txControl *tx.Control) options.TxControlOption
- func WithTxID(txID string) internal.ControlOption
- func WithTxSettings(txSettings tx.Settings) options.DoTxOption
- type Client
- type ClosableSession
- type DoOption
- type DoTxOption
- type NamedDestination
- type Operation
- type Result
- type ResultSet
- type Row
- type ScanStructOption
- type Session
- type SessionInfo
- type Transaction
- type TransactionControl
- func DefaultTxControl() *TransactionControl
- func NoTx() *TransactionControl
- func OnlineReadOnlyTxControl(opts ...internal.OnlineReadOnlyOption) *TransactionControl
- func SerializableReadWriteTxControl(opts ...internal.ControlOption) *TransactionControl
- func SnapshotReadOnlyTxControl() *TransactionControl
- func StaleReadOnlyTxControl() *TransactionControl
- func TxControl(opts ...internal.ControlOption) *TransactionControl
- type TransactionOption
- type TransactionSettings
- type TxActor
- type TxOperation
- type Type
Constants ¶
const ( SyntaxYQL = options.SyntaxYQL SyntaxPostgreSQL = options.SyntaxPostgreSQL )
const ( ExecModeParse = options.ExecModeParse ExecModeValidate = options.ExecModeValidate ExecModeExplain = options.ExecModeExplain ExecModeExecute = options.ExecModeExecute )
const ( StatsModeBasic = options.StatsModeBasic StatsModeNone = options.StatsModeNone StatsModeFull = options.StatsModeFull StatsModeProfile = options.StatsModeProfile )
Variables ¶
This section is empty.
Functions ¶
func BeginTx ¶
func BeginTx(opts ...TransactionOption) internal.ControlOption
BeginTx returns selector transaction control option
func CommitTx ¶
func CommitTx() internal.ControlOption
CommitTx returns commit transaction control option
func Stats
deprecated
added in
v3.59.0
Stats returns stats of query client pool
Deprecated: use client.Stats() method instead Will be removed after Jan 2025. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func WithCallOptions ¶
func WithCallOptions(opts ...grpc.CallOption) options.CallOptions
func WithCommit ¶
func WithCommit() options.TxExecuteOption
func WithExecMode ¶
func WithExecMode(mode options.ExecMode) options.ExecModeOption
func WithIdempotent ¶
func WithIdempotent() options.RetryOptionsOption
func WithInconsistentReads ¶
func WithInconsistentReads() internal.OnlineReadOnlyOption
func WithLabel ¶ added in v3.57.1
func WithLabel(lbl string) options.RetryOptionsOption
func WithParameters ¶
func WithParameters(parameters *params.Parameters) options.ParametersOption
func WithRetryBudget ¶ added in v3.66.0
func WithRetryBudget(b budget.Budget) options.RetryOptionsOption
WithRetryBudget creates option with external budget
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func WithStatsMode ¶
func WithStatsMode(mode options.StatsMode) options.StatsModeOption
func WithSyntax ¶
func WithSyntax(syntax options.Syntax) options.SyntaxOption
func WithTx ¶
func WithTx(t tx.Identifier) internal.ControlOption
func WithTxControl ¶
func WithTxControl(txControl *tx.Control) options.TxControlOption
func WithTxID ¶
func WithTxID(txID string) internal.ControlOption
func WithTxSettings ¶
func WithTxSettings(txSettings tx.Settings) options.DoTxOption
Types ¶
type Client ¶
type Client interface { // Do provide the best effort for execute operation. // // Do implements internal busy loop until one of the following conditions is met: // - deadline was canceled or deadlined // - retry operation returned nil as error // // Warning: if context without deadline or cancellation func than Do can run indefinitely. Do(ctx context.Context, op Operation, opts ...DoOption) error // DoTx provide the best effort for execute transaction. // // DoTx implements internal busy loop until one of the following conditions is met: // - deadline was canceled or deadlined // - retry operation returned nil as error // // DoTx makes auto selector (with TransactionSettings, by default - SerializableReadWrite), commit and // rollback (on error) of transaction. // // If op TxOperation returns nil - transaction will be committed // If op TxOperation return non nil - transaction will be rollback // Warning: if context without deadline or cancellation func than DoTx can run indefinitely DoTx(ctx context.Context, op TxOperation, opts ...DoTxOption) error // Execute is a simple executor with retries // // Execute returns materialized result // // Warning: large result can lead to "OOM Killed" problem // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental Execute(ctx context.Context, query string, opts ...options.ExecuteOption) (Result, error) // ReadResultSet is a helper which read all rows from first result set in result // // ReadRow returns error if result contains more than one result set // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ReadResultSet(ctx context.Context, query string, opts ...options.ExecuteOption) (ResultSet, error) // ReadRow is a helper which read only one row from first result set in result // // ReadRow returns error if result contains more than one result set or more than one row // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ReadRow(ctx context.Context, query string, opts ...options.ExecuteOption) (Row, error) // Stats returns stats of session pool // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental Stats() *poolStats.Stats }
type ClosableSession ¶
type DoTxOption ¶
type DoTxOption = options.DoTxOption
type NamedDestination ¶ added in v3.73.0
type NamedDestination = scanner.NamedDestination
func Named ¶
func Named(columnName string, destinationValueReference interface{}) (dst NamedDestination)
type Operation ¶
Operation is the interface that holds an operation for retry. if Operation returns not nil - operation will retry if Operation returns nil - retry loop will break
type Result ¶
type Result interface { closer.Closer // NextResultSet returns next result set NextResultSet(ctx context.Context) (ResultSet, error) // ResultSets is experimental API for range iterators available // with Go version 1.22+ and flag `GOEXPERIMENT=rangefunc`. ResultSets(ctx context.Context) xiter.Seq2[ResultSet, error] Stats() stats.QueryStats }
type Row ¶
type Row interface { Scan(dst ...interface{}) error ScanNamed(dst ...NamedDestination) error ScanStruct(dst interface{}, opts ...ScanStructOption) error }
type ScanStructOption ¶ added in v3.73.0
type ScanStructOption = scanner.ScanStructOption
func WithScanStructAllowMissingColumnsFromSelect ¶
func WithScanStructAllowMissingColumnsFromSelect() ScanStructOption
func WithScanStructAllowMissingFieldsInStruct ¶
func WithScanStructAllowMissingFieldsInStruct() ScanStructOption
func WithScanStructTagName ¶
func WithScanStructTagName(name string) ScanStructOption
type Session ¶
type Session interface { SessionInfo // Execute executes query. // // Execute used by default: // - DefaultTxControl (NoTx) // - flag WithKeepInCache(true) if params is not empty. Execute(ctx context.Context, query string, opts ...options.ExecuteOption) (tx Transaction, r Result, err error) Begin(ctx context.Context, txSettings TransactionSettings) (Transaction, error) // ReadRow is a helper which read only one row from first result set in result // // ReadRow returns error if result contains more than one result set or more than one row // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ReadRow(ctx context.Context, query string, opts ...options.ExecuteOption) (Row, error) // ReadResultSet is a helper which read all rows from first result set in result // // ReadRow returns error if result contains more than one result set // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ReadResultSet(ctx context.Context, query string, opts ...options.ExecuteOption) (ResultSet, error) }
type SessionInfo ¶
type Transaction ¶
type TransactionControl ¶
func DefaultTxControl ¶
func DefaultTxControl() *TransactionControl
DefaultTxControl returns default transaction control for use default tx control on server-side
func NoTx ¶
func NoTx() *TransactionControl
func OnlineReadOnlyTxControl ¶
func OnlineReadOnlyTxControl(opts ...internal.OnlineReadOnlyOption) *TransactionControl
OnlineReadOnlyTxControl returns online read-only transaction control
func SerializableReadWriteTxControl ¶
func SerializableReadWriteTxControl(opts ...internal.ControlOption) *TransactionControl
SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode
func SnapshotReadOnlyTxControl ¶
func SnapshotReadOnlyTxControl() *TransactionControl
SnapshotReadOnlyTxControl returns snapshot read-only transaction control
func StaleReadOnlyTxControl ¶
func StaleReadOnlyTxControl() *TransactionControl
StaleReadOnlyTxControl returns stale read-only transaction control
func TxControl ¶
func TxControl(opts ...internal.ControlOption) *TransactionControl
TxControl makes transaction control from given options
type TransactionOption ¶ added in v3.74.0
func WithDefaultTxMode ¶
func WithDefaultTxMode() TransactionOption
func WithOnlineReadOnly ¶
func WithOnlineReadOnly(opts ...internal.OnlineReadOnlyOption) TransactionOption
func WithSerializableReadWrite ¶
func WithSerializableReadWrite() TransactionOption
func WithSnapshotReadOnly ¶
func WithSnapshotReadOnly() TransactionOption
func WithStaleReadOnly ¶
func WithStaleReadOnly() TransactionOption
type TransactionSettings ¶
func TxSettings ¶
func TxSettings(opts ...internal.Option) TransactionSettings
TxSettings returns transaction settings
type TxActor ¶
type TxActor interface { tx.Identifier // Execute executes query. // // Execute used by default: // - DefaultTxControl // - flag WithKeepInCache(true) if params is not empty. Execute(ctx context.Context, query string, opts ...options.TxExecuteOption) (r Result, err error) // ReadRow is a helper which read only one row from first result set in result // // ReadRow returns error if result contains more than one result set or more than one row // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ReadRow(ctx context.Context, query string, opts ...options.TxExecuteOption) (Row, error) // ReadResultSet is a helper which read all rows from first result set in result // // ReadRow returns error if result contains more than one result set // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ReadResultSet(ctx context.Context, query string, opts ...options.TxExecuteOption) (ResultSet, error) }
type TxOperation ¶
TxOperation is the interface that holds an operation for retry. if TxOperation returns not nil - operation will retry if TxOperation returns nil - retry loop will break