Documentation
¶
Index ¶
- Constants
- type Client
- type ClosableSession
- type DataQuery
- type DataQueryExplanation
- type Event
- type Explanation
- type Operation
- type Option
- type Options
- type ParameterOption
- type QueryParameters
- type ScriptingYQLExplanation
- type Session
- type SessionInfo
- type Statement
- type Transaction
- type TransactionActor
- type TransactionControl
- type TransactionIdentifier
- type TransactionSettings
- type TxControlOption
- type TxOnlineReadOnlyOption
- type TxOperation
- type TxOption
Constants ¶
View Source
const ( // EventIntermediate declares intermediate event type // // Warning: This is an experimental feature and could change at any time EventIntermediate = Event(iota) // EventDone declares done event type // // Warning: This is an experimental feature and could change at any time EventDone )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
closer.Closer
// CreateSession returns session or error for manually control of session lifecycle
// CreateSession do not provide retry loop for failed create session requests.
// Best effort policy may be implements with outer retry loop includes CreateSession call
CreateSession(ctx context.Context, opts ...Option) (s ClosableSession, err error)
// 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 ...Option) 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 begin, commit and rollback 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 ...Option) error
}
type ClosableSession ¶ added in v3.5.0
type DataQueryExplanation ¶
type DataQueryExplanation struct {
Explanation
AST string
}
DataQueryExplanation is a result of ExplainDataQuery call.
type Event ¶
type Event uint8
Event declares event type
Warning: This is an experimental feature and could change at any time
type Explanation ¶ added in v3.7.0
type Explanation struct {
Plan string
}
Explanation is a result of Explain calls.
type Operation ¶ added in v3.2.1
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 Option ¶ added in v3.2.1
type Option func(o *Options)
func WithIdempotent ¶ added in v3.2.1
func WithIdempotent() Option
func WithTxCommitOptions ¶ added in v3.5.0
func WithTxCommitOptions(opts ...options.CommitTransactionOption) Option
func WithTxSettings ¶ added in v3.5.0
func WithTxSettings(tx *TransactionSettings) Option
type Options ¶ added in v3.2.1
type Options struct {
Idempotent bool
TxSettings *TransactionSettings
TxCommitOptions []options.CommitTransactionOption
FastBackoff retry.Backoff
SlowBackoff retry.Backoff
Trace trace.Table
// IsTraceError checks err before submit trace
//
// Warning: This is an experimental feature and could change at any time
IsTraceError func(event Event, err error) bool
}
type ParameterOption ¶
type ParameterOption func(queryParams)
func ValueParam ¶
func ValueParam(name string, v types.Value) ParameterOption
type QueryParameters ¶
type QueryParameters struct {
// contains filtered or unexported fields
}
func NewQueryParameters ¶
func NewQueryParameters(opts ...ParameterOption) *QueryParameters
func (*QueryParameters) Add ¶
func (q *QueryParameters) Add(opts ...ParameterOption)
func (*QueryParameters) Params ¶
func (q *QueryParameters) Params() queryParams
func (*QueryParameters) String ¶
func (q *QueryParameters) String() string
type ScriptingYQLExplanation ¶ added in v3.7.0
type ScriptingYQLExplanation struct {
Explanation
ParameterTypes map[string]types.Type
}
ScriptingYQLExplanation is a result of Explain calls.
type Session ¶
type Session interface {
SessionInfo
CreateTable(
ctx context.Context,
path string,
opts ...options.CreateTableOption,
) (err error)
DescribeTable(
ctx context.Context,
path string,
opts ...options.DescribeTableOption,
) (desc options.Description, err error)
DropTable(
ctx context.Context,
path string,
opts ...options.DropTableOption,
) (err error)
AlterTable(
ctx context.Context,
path string,
opts ...options.AlterTableOption,
) (err error)
CopyTable(
ctx context.Context,
dst, src string,
opts ...options.CopyTableOption,
) (err error)
Explain(
ctx context.Context,
query string,
) (exp DataQueryExplanation, err error)
Prepare(
ctx context.Context,
query string,
) (stmt Statement, err error)
Execute(
ctx context.Context,
tx *TransactionControl,
query string,
params *QueryParameters,
opts ...options.ExecuteDataQueryOption,
) (txr Transaction, r result.Result, err error)
ExecuteSchemeQuery(
ctx context.Context,
query string,
opts ...options.ExecuteSchemeQueryOption,
) (err error)
DescribeTableOptions(
ctx context.Context,
) (desc options.TableOptionsDescription, err error)
StreamReadTable(
ctx context.Context,
path string,
opts ...options.ReadTableOption,
) (r result.StreamResult, err error)
StreamExecuteScanQuery(
ctx context.Context,
query string,
params *QueryParameters,
opts ...options.ExecuteScanQueryOption,
) (_ result.StreamResult, err error)
BulkUpsert(
ctx context.Context,
table string,
rows types.Value,
) (err error)
BeginTransaction(
ctx context.Context,
tx *TransactionSettings,
) (x Transaction, err error)
KeepAlive(
ctx context.Context,
) error
}
type SessionInfo ¶
type SessionInfo interface {
ID() string
}
type Statement ¶
type Statement interface {
Execute(
ctx context.Context,
tx *TransactionControl,
params *QueryParameters,
opts ...options.ExecuteDataQueryOption,
) (txr Transaction, r result.Result, err error)
NumInput() int
Text() string
}
type Transaction ¶
type TransactionActor ¶ added in v3.5.2
type TransactionActor interface {
TransactionIdentifier
Execute(
ctx context.Context,
query string,
params *QueryParameters,
opts ...options.ExecuteDataQueryOption,
) (result.Result, error)
ExecuteStatement(
ctx context.Context,
stmt Statement,
params *QueryParameters,
opts ...options.ExecuteDataQueryOption,
) (result.Result, error)
}
type TransactionControl ¶
type TransactionControl struct {
// contains filtered or unexported fields
}
func TxControl ¶
func TxControl(opts ...TxControlOption) *TransactionControl
func (*TransactionControl) Desc ¶
func (t *TransactionControl) Desc() *Ydb_Table.TransactionControl
type TransactionIdentifier ¶ added in v3.5.2
type TransactionIdentifier interface {
ID() string
}
type TransactionSettings ¶
type TransactionSettings struct {
// contains filtered or unexported fields
}
func TxSettings ¶
func TxSettings(opts ...TxOption) *TransactionSettings
func (*TransactionSettings) Settings ¶
func (t *TransactionSettings) Settings() *Ydb_Table.TransactionSettings
type TxControlOption ¶
type TxControlOption func(*txControlDesc)
func BeginTx ¶
func BeginTx(opts ...TxOption) TxControlOption
func CommitTx ¶
func CommitTx() TxControlOption
func WithTx ¶
func WithTx(t Transaction) TxControlOption
type TxOnlineReadOnlyOption ¶
type TxOnlineReadOnlyOption func(*txOnlineReadOnly)
func WithInconsistentReads ¶
func WithInconsistentReads() TxOnlineReadOnlyOption
type TxOperation ¶ added in v3.5.0
type TxOperation func(ctx context.Context, tx TransactionActor) error
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
type TxOption ¶
type TxOption func(*txDesc)
Transaction control options
func WithOnlineReadOnly ¶
func WithOnlineReadOnly(opts ...TxOnlineReadOnlyOption) TxOption
func WithSerializableReadWrite ¶
func WithSerializableReadWrite() TxOption
func WithStaleReadOnly ¶
func WithStaleReadOnly() TxOption
Click to show internal directories.
Click to hide internal directories.