Documentation
¶
Index ¶
- Constants
- Variables
- func IsAlive(status Status) bool
- func MaterializedResultSet(index int, columnNames []string, columnTypes []types.Type, rows []query.Row) *materializedResultSet
- func Open(ctx context.Context, client Ydb_Query_V1.QueryServiceClient, opts ...Option) (_ *sessionCore, finalErr error)
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) Config() *config.Config
- func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) (finalErr error)
- func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options.DoTxOption) (finalErr error)
- func (c *Client) Exec(ctx context.Context, q string, opts ...options.Execute) (finalErr error)
- func (c *Client) ExecuteScript(ctx context.Context, q string, ttl time.Duration, opts ...options.Execute) (op *options.ExecuteScriptOperation, err error)
- func (c *Client) FetchScriptResults(ctx context.Context, opID string, opts ...options.FetchScriptOption) (*options.FetchScriptResult, error)
- func (c *Client) Query(ctx context.Context, q string, opts ...options.Execute) (r query.Result, err error)
- func (c *Client) QueryResultSet(ctx context.Context, q string, opts ...options.Execute) (rs result.ClosableResultSet, finalErr error)
- func (c *Client) QueryRow(ctx context.Context, q string, opts ...options.Execute) (_ query.Row, finalErr error)
- type Core
- type Option
- type ResultCloser
- type Row
- type Session
- func (s *Session) Begin(ctx context.Context, txSettings query.TransactionSettings) (tx query.Transaction, finalErr error)
- func (s *Session) Exec(ctx context.Context, q string, opts ...options.Execute) (finalErr error)
- func (s *Session) Query(ctx context.Context, q string, opts ...options.Execute) (_ query.Result, finalErr error)
- func (s *Session) QueryArrow(ctx context.Context, q string, opts ...options.Execute) (_ arrow.Result, finalErr error)
- func (s *Session) QueryResultSet(ctx context.Context, q string, opts ...options.Execute) (rs result.ClosableResultSet, finalErr error)
- func (s *Session) QueryRow(ctx context.Context, q string, opts ...options.Execute) (_ query.Row, finalErr error)
- type Status
- type Transaction
- func (tx *Transaction) CommitTx(ctx context.Context) (finalErr error)
- func (tx *Transaction) Exec(ctx context.Context, q string, opts ...options.Execute) (finalErr error)
- func (tx *Transaction) NodeID() uint32
- func (tx *Transaction) OnBeforeCommit(f baseTx.OnTransactionBeforeCommit)
- func (tx *Transaction) OnCompleted(f baseTx.OnTransactionCompletedFunc)
- func (tx *Transaction) Query(ctx context.Context, q string, opts ...options.Execute) (_ query.Result, finalErr error)
- func (tx *Transaction) QueryResultSet(ctx context.Context, q string, opts ...options.Execute) (rs result.ClosableResultSet, finalErr error)
- func (tx *Transaction) QueryRow(ctx context.Context, q string, opts ...options.Execute) (row query.Row, finalErr error)
- func (tx *Transaction) Rollback(ctx context.Context) (finalErr error)
- func (tx *Transaction) SessionID() string
- func (tx *Transaction) UnLazy(ctx context.Context) error
Constants ¶
const ( StatusUnknown = Status(iota) StatusIdle StatusInUse StatusClosing StatusClosed StatusError )
Variables ¶
Functions ¶
func MaterializedResultSet ¶ added in v3.77.0
func Open ¶ added in v3.99.0
func Open( ctx context.Context, client Ydb_Query_V1.QueryServiceClient, opts ...Option, ) (_ *sessionCore, finalErr error)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DoTx ¶
func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options.DoTxOption) (finalErr error)
func (*Client) ExecuteScript ¶ added in v3.77.0
func (*Client) FetchScriptResults ¶ added in v3.77.0
func (c *Client) FetchScriptResults(ctx context.Context, opID string, opts ...options.FetchScriptOption, ) (*options.FetchScriptResult, error)
type Option ¶ added in v3.99.0
type Option func(*sessionCore)
func OnChangeStatus ¶ added in v3.99.0
func WithConn ¶ added in v3.99.0
func WithConn(cc grpc.ClientConnInterface) Option
func WithDeleteTimeout ¶ added in v3.99.0
type ResultCloser ¶ added in v3.115.6
type ResultCloser struct {
// contains filtered or unexported fields
}
ResultCloser provides a mechanism to close query results and handle cleanup operations. It tracks the reason for closing, provides a done channel for synchronization, and allows registering cleanup functions to be called on close.
func NewResultCloser ¶ added in v3.115.6
func NewResultCloser() *ResultCloser
NewResultCloser creates and returns a new ResultCloser instance.
func (*ResultCloser) Close ¶ added in v3.115.6
func (r *ResultCloser) Close(reason error)
Close closes the ResultCloser with the specified reason error. If the ResultCloser is already closed, this method does nothing. If reason is nil, it will be set to io.EOF. All registered onClose functions will be called in LIFO order. After calling Close, the done channel will be closed to signal completion.
func (*ResultCloser) CloseOnContextCancel ¶ added in v3.115.6
func (r *ResultCloser) CloseOnContextCancel(ctx context.Context) func() bool
CloseOnContextCancel registers a callback function that closes the ResultCloser when the provided context is cancelled. It returns a function that can be used to stop the callback.
func (*ResultCloser) Done ¶ added in v3.115.6
func (r *ResultCloser) Done() <-chan struct{}
Done returns a channel that will be closed when the ResultCloser is closed. This channel can be used to wait for the ResultCloser to be closed.
func (*ResultCloser) Err ¶ added in v3.115.6
func (r *ResultCloser) Err() error
Err returns the reason error that was passed to Close. If Close has not been called yet, it returns nil.
func (*ResultCloser) OnClose ¶ added in v3.115.6
func (r *ResultCloser) OnClose(f func())
OnClose registers a function to be called when the ResultCloser is closed. Multiple functions can be registered and they will be called in LIFO order when Close is called.
type Row ¶ added in v3.80.8
type Row struct {
// contains filtered or unexported fields
}
func (Row) ScanNamed ¶ added in v3.80.8
func (r Row) ScanNamed(dst ...scanner.NamedDestination) error
func (Row) ScanStruct ¶ added in v3.80.8
func (r Row) ScanStruct(dst interface{}, opts ...scanner.ScanStructOption) error
type Session ¶
type Session struct { Core // contains filtered or unexported fields }
func CreateSession ¶ added in v3.89.6
func CreateSession(ctx context.Context, client Ydb_Query_V1.QueryServiceClient, cfg *config.Config) (*Session, error)
func (*Session) Begin ¶
func (s *Session) Begin( ctx context.Context, txSettings query.TransactionSettings, ) ( tx query.Transaction, finalErr error, )
func (*Session) QueryArrow ¶ added in v3.116.0
func (s *Session) QueryArrow(ctx context.Context, q string, opts ...options.Execute) (_ arrow.Result, finalErr error)
QueryArrow like *Session.Query but returns results in Apache Arrow format. Each part of the result implements io.Reader and contains the data in Arrow IPC format.
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func (*Session) QueryResultSet ¶ added in v3.77.0
type Transaction ¶ added in v3.76.2
func (*Transaction) CommitTx ¶ added in v3.76.2
func (tx *Transaction) CommitTx(ctx context.Context) (finalErr error)
func (*Transaction) NodeID ¶ added in v3.116.1
func (tx *Transaction) NodeID() uint32
func (*Transaction) OnBeforeCommit ¶ added in v3.81.0
func (tx *Transaction) OnBeforeCommit(f baseTx.OnTransactionBeforeCommit)
func (*Transaction) OnCompleted ¶ added in v3.76.4
func (tx *Transaction) OnCompleted(f baseTx.OnTransactionCompletedFunc)
func (*Transaction) QueryResultSet ¶ added in v3.77.0
func (tx *Transaction) QueryResultSet( ctx context.Context, q string, opts ...options.Execute, ) (rs result.ClosableResultSet, finalErr error)
func (*Transaction) Rollback ¶ added in v3.76.2
func (tx *Transaction) Rollback(ctx context.Context) (finalErr error)
func (*Transaction) SessionID ¶ added in v3.76.4
func (tx *Transaction) SessionID() string