package xsql

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

Index

Constants

const (
	QUERY = iota + 1
	TABLE
)

Variables

var (
	ErrUnsupported = driver.ErrSkip
)

Functions

func WithExplain

func WithExplain(ctx context.Context) context.Context

Types

type Conn

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

func (*Conn) Begin

func (c *Conn) Begin() (_ driver.Tx, finalErr error)

func (*Conn) BeginTx

func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (_ driver.Tx, finalErr error)

func (*Conn) CheckNamedValue

func (c *Conn) CheckNamedValue(value *driver.NamedValue) (finalErr error)

func (*Conn) Close

func (c *Conn) Close() (finalErr error)

func (*Conn) Engine

func (c *Conn) Engine() Engine

func (*Conn) ExecContext

func (c *Conn) ExecContext(ctx context.Context, sql string, args []driver.NamedValue) (
	_ driver.Result, finalErr error,
)

func (*Conn) GetColumnType

func (c *Conn) GetColumnType(ctx context.Context, tableName, columnName string) (dataType string, _ error)

func (*Conn) GetColumns

func (c *Conn) GetColumns(ctx context.Context, tableName string) (columns []string, _ error)

func (*Conn) GetDatabaseName

func (c *Conn) GetDatabaseName() string

func (*Conn) GetIndexColumns

func (c *Conn) GetIndexColumns(ctx context.Context, tableName, indexName string) (columns []string, finalErr error)

func (*Conn) GetIndexes

func (c *Conn) GetIndexes(ctx context.Context, tableName string) (indexes []string, _ error)

func (*Conn) GetPrimaryKeys

func (c *Conn) GetPrimaryKeys(ctx context.Context, tableName string) ([]string, error)

func (*Conn) GetTables

func (c *Conn) GetTables(ctx context.Context, folder string, recursive, excludeSysDirs bool) (
	tables []string, _ error,
)

func (*Conn) ID

func (c *Conn) ID() string

func (*Conn) IsColumnExists

func (c *Conn) IsColumnExists(ctx context.Context, tableName, columnName string) (columnExists bool, finalErr error)

func (*Conn) IsPrimaryKey

func (c *Conn) IsPrimaryKey(ctx context.Context, tableName, columnName string) (ok bool, _ error)

func (*Conn) IsTableExists

func (c *Conn) IsTableExists(ctx context.Context, tableName string) (tableExists bool, finalErr error)

func (*Conn) LastUsage

func (c *Conn) LastUsage() time.Time

func (*Conn) NodeID

func (c *Conn) NodeID() uint32

func (*Conn) Ping

func (c *Conn) Ping(ctx context.Context) (finalErr error)

func (*Conn) Prepare

func (c *Conn) Prepare(string) (driver.Stmt, error)

func (*Conn) PrepareContext

func (c *Conn) PrepareContext(ctx context.Context, sql string) (_ driver.Stmt, finalErr error)

func (*Conn) QueryContext

func (c *Conn) QueryContext(ctx context.Context, sql string, args []driver.NamedValue) (
	_ driver.Rows, finalErr error,
)

func (*Conn) Version

func (c *Conn) Version(_ context.Context) (_ string, _ error)

type Connector

type Connector struct {
	TableOpts []xtable.Option
	QueryOpts []xquery.Option
	// contains filtered or unexported fields
}

func Open

func Open(parent ydbDriver, balancer grpc.ClientConnInterface, opts ...Option) (_ *Connector, err error)

func Unwrap

func Unwrap[T *sql.DB | *sql.Conn](v T) (connector *Connector, _ error)

func (*Connector) Bindings

func (c *Connector) Bindings() bind.Bindings

func (*Connector) Clock

func (c *Connector) Clock() clockwork.Clock

func (*Connector) Close

func (c *Connector) Close() error

func (*Connector) Connect

func (c *Connector) Connect(ctx context.Context) (_ driver.Conn, finalErr error)

func (*Connector) Driver

func (c *Connector) Driver() driver.Driver

func (*Connector) Name

func (c *Connector) Name() string

func (*Connector) Open

func (c *Connector) Open(name string) (driver.Conn, error)

func (*Connector) Parent

func (c *Connector) Parent() ydbDriver

func (*Connector) Query

func (c *Connector) Query() *query.Client

func (*Connector) RetryBudget

func (c *Connector) RetryBudget() budget.Budget

func (*Connector) Scheme

func (c *Connector) Scheme() scheme.Client

func (*Connector) Scripting

func (c *Connector) Scripting() scripting.Client

func (*Connector) Table

func (c *Connector) Table() table.Client

func (*Connector) Trace

func (c *Connector) Trace() *trace.DatabaseSQL

func (*Connector) TraceRetry

func (c *Connector) TraceRetry() *trace.Retry

type Engine

type Engine uint8

func (Engine) String

func (e Engine) String() string

type Option

type Option interface {
	Apply(c *Connector) error
}

func Merge

func Merge(opts ...Option) Option

func WithDefaultQueryMode

func WithDefaultQueryMode(mode xtable.QueryMode) Option

func WithDisableServerBalancer

func WithDisableServerBalancer() Option

func WithFakeTx

func WithFakeTx(modes ...xtable.QueryMode) Option

func WithIdleThreshold

func WithIdleThreshold(idleThreshold time.Duration) Option

func WithOnClose

func WithOnClose(onClose func(*Connector)) Option

func WithQueryOptions

func WithQueryOptions(opts ...xquery.Option) Option

func WithQueryService

func WithQueryService(b bool) Option

func WithRetryBudget

func WithRetryBudget(budget budget.Budget) Option

func WithTableOptions

func WithTableOptions(opts ...xtable.Option) Option

func WithTrace

func WithTrace(
	t *trace.DatabaseSQL,
	opts ...trace.DatabaseSQLComposeOption,
) Option

func WithTraceRetry

func WithTraceRetry(
	t *trace.Retry,
	opts ...trace.RetryComposeOption,
) Option

type QueryBindOption

type QueryBindOption interface {
	Option
	bind.Bind
}

func WithQueryBind

func WithQueryBind(bind bind.Bind) QueryBindOption

func WithTablePathPrefix

func WithTablePathPrefix(tablePathPrefix string) QueryBindOption

type Stmt

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

func (*Stmt) Close

func (stmt *Stmt) Close() (finalErr error)

func (*Stmt) Exec

func (stmt *Stmt) Exec([]driver.Value) (driver.Result, error)

func (*Stmt) ExecContext

func (stmt *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (_ driver.Result, finalErr error)

func (*Stmt) NumInput

func (stmt *Stmt) NumInput() int

func (*Stmt) Query

func (stmt *Stmt) Query([]driver.Value) (driver.Rows, error)

func (*Stmt) QueryContext

func (stmt *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (_ driver.Rows, finalErr error)

type Tx

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

func (*Tx) Commit

func (tx *Tx) Commit() (finalErr error)

func (*Tx) ExecContext

func (tx *Tx) ExecContext(ctx context.Context, sql string, args []driver.NamedValue) (
	_ driver.Result, finalErr error,
)

func (*Tx) ID

func (tx *Tx) ID() string

func (*Tx) PrepareContext

func (tx *Tx) PrepareContext(ctx context.Context, sql string) (_ driver.Stmt, finalErr error)

func (*Tx) QueryContext

func (tx *Tx) QueryContext(ctx context.Context, sql string, args []driver.NamedValue) (
	_ driver.Rows, finalErr error,
)

func (*Tx) Rollback

func (tx *Tx) Rollback() (finalErr error)

Source Files

conn.go conn_helpers.go connector.go context.go errors.go options.go rows.go stmt.go tx.go unwrap.go

Directories

PathSynopsis
internal/xsql/badconn
internal/xsql/common
internal/xsql/xquery
internal/xsql/xtable
Version
v3.101.2
Published
Mar 13, 2025
Platform
js/wasm
Imports
37 packages
Last checked
9 minutes ago

Tools for package owners.