package xsql

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

Index

Constants

const (
	UnknownQueryMode = iota
	DataQueryMode
	ExplainQueryMode
	ScanQueryMode
	SchemeQueryMode
	ScriptingQueryMode

	DefaultQueryMode = DataQueryMode
)

Variables

var (
	ErrUnsupported = driver.ErrSkip
)

Functions

func WithQueryMode

func WithQueryMode(ctx context.Context, m QueryMode) context.Context

WithQueryMode returns a copy of context with given QueryMode

func WithTxControl

func WithTxControl(ctx context.Context, txc *table.TransactionControl) context.Context

Types

type Connector

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

Connector is a producer of database/sql connections

func Open

func Open(opts ...ConnectorOption) (_ *Connector, err error)

func Unwrap

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

func (*Connector) Close

func (c *Connector) Close() (err error)

func (*Connector) Connect

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

func (*Connector) Driver

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

type ConnectorOption

type ConnectorOption func(c *Connector) error

func Parse

func Parse(dataSourceName string) (opts []config.Option, connectorOpts []ConnectorOption, err error)

func WithBindings

func WithBindings(bindings ...bind.Binding) ConnectorOption

func WithCreateSession

func WithCreateSession(f func(ctx context.Context) (s table.ClosableSession, err error)) ConnectorOption

func WithDatabaseName

func WithDatabaseName(databaseName string) ConnectorOption

func WithDefaultDataQueryOptions

func WithDefaultDataQueryOptions(opts ...options.ExecuteDataQueryOption) ConnectorOption

func WithDefaultQueryMode

func WithDefaultQueryMode(mode QueryMode) ConnectorOption

func WithDefaultScanQueryOptions

func WithDefaultScanQueryOptions(opts ...options.ExecuteScanQueryOption) ConnectorOption

func WithDefaultTxControl

func WithDefaultTxControl(txControl *table.TransactionControl) ConnectorOption

func WithDescribePath

func WithDescribePath(f func(ctx context.Context, path string) (e scheme.Entry, err error)) ConnectorOption

func WithDisableServerBalancer

func WithDisableServerBalancer() ConnectorOption

func WithIdleThreshold

func WithIdleThreshold(idleThreshold time.Duration) ConnectorOption

func WithListDirectory

func WithListDirectory(f func(ctx context.Context, path string) (d scheme.Directory, err error)) ConnectorOption

func WithOnClose

func WithOnClose(f func(connector *Connector)) ConnectorOption

func WithScriptingExecute

func WithScriptingExecute(scriptingExecute func(
	ctx context.Context, query string, params *table.QueryParameters) (result.StreamResult, error),
) ConnectorOption

func WithTrace

type QueryMode

type QueryMode int

func QueryModeFromString

func QueryModeFromString(s string) QueryMode

func (QueryMode) String

func (t QueryMode) String() string

Source Files

conn.go connector.go context.go dsn.go errors.go mode.go rows.go stmt.go tx.go unwrap_go1.18.go valuer.go

Directories

PathSynopsis
internal/xsql/badconn
internal/xsql/bind
internal/xsql/isolation
Version
v3.43.0-rc4
Published
Feb 27, 2023
Platform
windows/amd64
Imports
32 packages
Last checked
41 seconds ago

Tools for package owners.