Documentation ¶
Index ¶
- Constants
- func BeginTx(opts ...TransactionOption) internal.ControlOption
- func CommitTx() internal.ControlOption
- func WithCallOptions(opts ...grpc.CallOption) options.Execute
- func WithCommit() options.Execute
- func WithExecMode(mode options.ExecMode) options.Execute
- func WithFetchToken(fetchToken string) options.FetchScriptOption
- func WithIdempotent() options.RetryOptionsOption
- func WithInconsistentReads() internal.OnlineReadOnlyOption
- func WithLabel(lbl string) options.RetryOptionsOption
- func WithParameters(parameters *params.Parameters) options.Execute
- func WithResultSetIndex(resultSetIndex int64) options.FetchScriptOption
- func WithRetryBudget(b budget.Budget) options.RetryOptionsOption
- func WithRowsLimit(rowsLimit int64) options.FetchScriptOption
- func WithStatsMode(mode options.StatsMode, callback func(Stats)) options.Execute
- func WithSyntax(syntax options.Syntax) options.Execute
- func WithTrace(t *trace.Query) options.TraceOption
- func WithTx(t tx.Identifier) internal.ControlOption
- func WithTxControl(txControl *tx.Control) options.Execute
- func WithTxID(txID string) internal.ControlOption
- func WithTxSettings(txSettings tx.Settings) options.DoTxOption
- type Client
- type ClosableSession
- type DoOption
- type DoTxOption
- type Executor
- type NamedDestination
- type Operation
- type Result
- type ResultSet
- type Row
- type ScanStructOption
- type Session
- type SessionInfo
- type Stats
- 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 WithCallOptions ¶
func WithCallOptions(opts ...grpc.CallOption) options.Execute
func WithCommit ¶
func WithFetchToken ¶ added in v3.77.0
func WithFetchToken(fetchToken string) options.FetchScriptOption
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.Execute
func WithResultSetIndex ¶ added in v3.77.0
func WithResultSetIndex(resultSetIndex int64) options.FetchScriptOption
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 WithRowsLimit ¶ added in v3.77.0
func WithRowsLimit(rowsLimit int64) options.FetchScriptOption
func WithStatsMode ¶
func WithTx ¶
func WithTx(t tx.Identifier) internal.ControlOption
func WithTxID ¶
func WithTxID(txID string) internal.ControlOption
func WithTxSettings ¶
func WithTxSettings(txSettings tx.Settings) options.DoTxOption
Types ¶
type Client ¶
type Client interface { Executor // 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 // QueryResultSet 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 QueryResultSet(ctx context.Context, query string, opts ...options.Execute) (ResultSet, error) // QueryRow 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 QueryRow(ctx context.Context, query string, opts ...options.Execute) (Row, error) // ExecuteScript starts long executing script with polling results later // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental ExecuteScript( ctx context.Context, query string, ttl time.Duration, ops ...options.Execute, ) (*options.ExecuteScriptOperation, error) // FetchScriptResults fetching the script results // // Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental FetchScriptResults( ctx context.Context, opID string, opts ...options.FetchScriptOption, ) (*options.FetchScriptResult, error) }
Client defines API of query client
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
type ClosableSession ¶
type DoTxOption ¶
type DoTxOption = options.DoTxOption
type Executor ¶ added in v3.77.0
type Executor interface { // Exec execute query without result // // Exec used by default: // - DefaultTxControl Exec(ctx context.Context, query string, opts ...options.Execute) error // Query execute query with result // // Exec used by default: // - DefaultTxControl Query(ctx context.Context, query string, opts ...options.Execute) (r Result, err error) // QueryResultSet execute query and take the exactly single materialized result set from result // // Exec used by default: // - DefaultTxControl QueryResultSet(ctx context.Context, query string, opts ...options.Execute) (rs ResultSet, err error) // QueryRow execute query and take the exactly single row from exactly single result set from result // // Exec used by default: // - DefaultTxControl QueryRow(ctx context.Context, query string, opts ...options.Execute) (row Row, err error) }
Executor is an interface for execute queries
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
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 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 Executor Begin(ctx context.Context, txSettings TransactionSettings) (Transaction, error) }
type SessionInfo ¶
type Stats ¶ added in v3.59.0
type Stats = stats.QueryStats
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 Executor }
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