package table

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/table"

Index

Functions

func DescribeTable

func DescribeTable(
	ctx context.Context,
	sessionID string,
	client describeTableClient,
	path string,
	opts ...options.DescribeTableOption,
) (desc options.Description, err error)

DescribeTable describes table at given path.

func NewTimeToLiveSettings

func NewTimeToLiveSettings(settings *Ydb_Table.TtlSettings) *options.TimeToLiveSettings

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a set of session instances that may be reused. A Client is safe for use by multiple goroutines simultaneously.

func New

func (*Client) BulkUpsert

func (c *Client) BulkUpsert(
	ctx context.Context,
	tableName string,
	data table.BulkUpsertData,
	opts ...table.Option,
) (finalErr error)

func (*Client) Close

func (c *Client) Close(ctx context.Context) (err error)

Close deletes all stored sessions inside Client. It also stops all underlying timers and goroutines. It returns first error occurred during stale sessions' deletion. Note that even on error it calls Close() on each session.

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, opts ...table.Option) (_ table.ClosableSession, err error)

func (*Client) Do

func (c *Client) Do(ctx context.Context, op table.Operation, opts ...table.Option) (finalErr 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 deadline without deadline or cancellation func Retry will be worked infinite

func (*Client) DoTx

func (c *Client) DoTx(ctx context.Context, op table.TxOperation, opts ...table.Option) (finalErr error)

type Query

type Query interface {
	String() string
	ID() string
	YQL() string
	// contains filtered or unexported methods
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session represents a single table API session.

session methods are not goroutine safe. Simultaneous execution of requests are forbidden within a single session.

Note that after session is no longer needed it should be destroyed by Close() call.

func (*Session) AlterTable

func (s *Session) AlterTable(
	ctx context.Context,
	path string,
	opts ...options.AlterTableOption,
) (err error)

AlterTable modifies schema of table at given path with given options.

func (*Session) BeginTransaction

func (s *Session) BeginTransaction(
	ctx context.Context,
	txSettings *table.TransactionSettings,
) (x table.Transaction, err error)

BeginTransaction begins new transaction within given session with given settings.

func (*Session) BulkUpsert

func (s *Session) BulkUpsert(ctx context.Context, table string, rows value.Value,
	opts ...options.BulkUpsertOption,
) (err error)

BulkUpsert uploads given list of ydb struct values to the table.

func (*Session) Close

func (s *Session) Close(ctx context.Context) (finalErr error)

func (*Session) CopyTable

func (s *Session) CopyTable(
	ctx context.Context,
	dst, src string,
	opts ...options.CopyTableOption,
) (err error)

CopyTable creates copy of table at given path.

func (*Session) CopyTables

func (s *Session) CopyTables(
	ctx context.Context,
	opts ...options.CopyTablesOption,
) (err error)

CopyTables creates copy of table at given path.

func (*Session) CreateTable

func (s *Session) CreateTable(
	ctx context.Context,
	path string,
	opts ...options.CreateTableOption,
) (err error)

CreateTable creates table at given path with given options.

func (*Session) DescribeTable

func (s *Session) DescribeTable(
	ctx context.Context,
	path string,
	opts ...options.DescribeTableOption,
) (options.Description, error)

DescribeTable describes table at given path.

func (*Session) DescribeTableOptions

func (s *Session) DescribeTableOptions(ctx context.Context) (
	desc options.TableOptionsDescription,
	err error,
)

DescribeTableOptions describes supported table options.

func (*Session) DropTable

func (s *Session) DropTable(
	ctx context.Context,
	path string,
	opts ...options.DropTableOption,
) (err error)

DropTable drops table at given path with given options.

func (*Session) Execute

func (s *Session) Execute(ctx context.Context, txControl *table.TransactionControl, sql string, params *params.Params,
	opts ...options.ExecuteDataQueryOption,
) (
	txr table.Transaction, r result.Result, err error,
)

Execute executes given data query represented by text.

func (*Session) ExecuteSchemeQuery

func (s *Session) ExecuteSchemeQuery(ctx context.Context, sql string,
	opts ...options.ExecuteSchemeQueryOption,
) (err error)

ExecuteSchemeQuery executes scheme query.

func (*Session) Explain

func (s *Session) Explain(ctx context.Context, sql string) (exp table.DataQueryExplanation, err error)

Explain explains data query represented by text.

func (*Session) ID

func (s *Session) ID() string

func (*Session) IsAlive

func (s *Session) IsAlive() bool

func (*Session) KeepAlive

func (s *Session) KeepAlive(ctx context.Context) (err error)

KeepAlive keeps idle session alive.

func (*Session) LastUsage

func (s *Session) LastUsage() time.Time

func (*Session) NodeID

func (s *Session) NodeID() uint32

func (*Session) Prepare

func (s *Session) Prepare(ctx context.Context, queryText string) (_ table.Statement, err error)

Prepare prepares data query within session s.

func (*Session) ReadRows

func (s *Session) ReadRows(
	ctx context.Context,
	path string,
	keys value.Value,
	opts ...options.ReadRowsOption,
) (_ result.Result, err error)

func (*Session) RenameTables

func (s *Session) RenameTables(
	ctx context.Context,
	opts ...options.RenameTablesOption,
) (err error)

RenameTables renames tables.

func (*Session) SetStatus

func (s *Session) SetStatus(status table.SessionStatus)

func (*Session) Status

func (s *Session) Status() table.SessionStatus

func (*Session) StreamExecuteScanQuery

func (s *Session) StreamExecuteScanQuery(ctx context.Context, sql string, parameters *params.Params,
	opts ...options.ExecuteScanQueryOption,
) (_ result.StreamResult, err error)

StreamExecuteScanQuery scan-reads table at given path with given options.

Note that given ctx controls the lifetime of the whole read, not only this StreamExecuteScanQuery() call; that is, the time until returned result is closed via Close() call or fully drained by sequential NextResultSet() calls.

func (*Session) StreamReadTable

func (s *Session) StreamReadTable(
	ctx context.Context,
	path string,
	opts ...options.ReadTableOption,
) (_ result.StreamResult, err error)

StreamReadTable reads table at given path with given options.

Note that given ctx controls the lifetime of the whole read, not only this StreamReadTable() call; that is, the time until returned result is closed via Close() call or fully drained by sequential NextResultSet() calls.

Source Files

client.go data_query.go errors.go retry.go session.go statement.go transaction.go ttl.go

Directories

PathSynopsis
internal/table/config
internal/table/scanner
Version
v3.99.7
Published
Feb 7, 2025
Platform
linux/amd64
Imports
42 packages
Last checked
15 seconds ago

Tools for package owners.