query

package
v3.99.4-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusUnknown = Status(iota)
	StatusIdle
	StatusInUse
	StatusClosing
	StatusClosed
	StatusError
)

Variables

View Source
var (
	ErrTransactionRollingBack = xerrors.Wrap(errors.New("the transaction is rolling back"))

	ErrOptionNotForTxExecute = errors.New("option is not for execute on transaction")
)

Functions

func IsAlive added in v3.99.0

func IsAlive(status Status) bool

func MaterializedResultSet added in v3.77.0

func MaterializedResultSet(
	index int,
	columnNames []string,
	columnTypes []types.Type,
	rows []query.Row,
) *materializedResultSet

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 New

func (*Client) Close

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

func (*Client) Do

func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) (finalErr error)

func (*Client) DoTx

func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options.DoTxOption) (finalErr error)

func (*Client) Exec added in v3.77.0

func (c *Client) Exec(ctx context.Context, q string, opts ...options.Execute) (finalErr error)

func (*Client) ExecuteScript added in v3.77.0

func (c *Client) ExecuteScript(
	ctx context.Context, q string, ttl time.Duration, opts ...options.Execute,
) (
	op *options.ExecuteScriptOperation, err error,
)

func (*Client) FetchScriptResults added in v3.77.0

func (c *Client) FetchScriptResults(ctx context.Context,
	opID string, opts ...options.FetchScriptOption,
) (*options.FetchScriptResult, error)

func (*Client) Query added in v3.77.0

func (c *Client) Query(ctx context.Context, q string, opts ...options.Execute) (r query.Result, err error)

func (*Client) QueryResultSet added in v3.77.0

func (c *Client) QueryResultSet(
	ctx context.Context, q string, opts ...options.Execute,
) (rs result.ClosableResultSet, finalErr error)

QueryResultSet is a helper which read all rows from first result set in result

func (*Client) QueryRow added in v3.77.0

func (c *Client) QueryRow(ctx context.Context, q string, opts ...options.Execute) (_ query.Row, finalErr error)

QueryRow is a helper which read only one row from first result set in result

type Core added in v3.99.0

type Core interface {
	query.SessionInfo
	closer.Closer
	pool.Item

	Done() <-chan struct{}
	SetStatus(code Status)
}

type Option added in v3.99.0

type Option func(*sessionCore)

func OnChangeStatus added in v3.99.0

func OnChangeStatus(onChangeStatus func(status Status)) Option

func WithConn added in v3.99.0

func WithConn(cc grpc.ClientConnInterface) Option

func WithDeleteTimeout added in v3.99.0

func WithDeleteTimeout(deleteTimeout time.Duration) Option

func WithTrace added in v3.99.0

func WithTrace(t *trace.Query) Option

type Row added in v3.80.8

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

func NewRow added in v3.69.0

func NewRow(columns []*Ydb.Column, v *Ydb.Value) *Row

func (Row) Scan added in v3.80.8

func (r Row) Scan(dst ...interface{}) (err error)

func (Row) ScanNamed added in v3.80.8

func (r Row) ScanNamed(dst ...scanner.NamedDestination) (err error)

func (Row) ScanStruct added in v3.80.8

func (r Row) ScanStruct(dst interface{}, opts ...scanner.ScanStructOption) (err error)

type Session

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

func CreateSession added in v3.89.6

func CreateSession(ctx context.Context, c *Client) (*Session, error)

func (*Session) Begin

func (s *Session) Begin(
	ctx context.Context,
	txSettings query.TransactionSettings,
) (
	tx query.Transaction, finalErr error,
)

func (*Session) Exec added in v3.77.0

func (s *Session) Exec(
	ctx context.Context, q string, opts ...options.Execute,
) (finalErr error)

func (*Session) Query added in v3.77.0

func (s *Session) Query(
	ctx context.Context, q string, opts ...options.Execute,
) (_ query.Result, finalErr error)

func (*Session) QueryResultSet added in v3.77.0

func (s *Session) QueryResultSet(
	ctx context.Context, q string, opts ...options.Execute,
) (rs result.ClosableResultSet, finalErr error)

func (*Session) QueryRow added in v3.77.0

func (s *Session) QueryRow(ctx context.Context, q string, opts ...options.Execute) (_ query.Row, finalErr error)

type Status added in v3.99.0

type Status uint32

func StatusFromErr added in v3.99.0

func StatusFromErr(err error) Status

func (Status) String added in v3.99.0

func (s Status) String() string

type Transaction added in v3.76.2

type Transaction struct {
	baseTx.LazyID
	// contains filtered or unexported fields
}

func (*Transaction) CommitTx added in v3.76.2

func (tx *Transaction) CommitTx(ctx context.Context) (finalErr error)

func (*Transaction) Exec added in v3.77.0

func (tx *Transaction) Exec(ctx context.Context, q string, opts ...options.Execute) (
	finalErr error,
)

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) Query added in v3.77.0

func (tx *Transaction) Query(ctx context.Context, q string, opts ...options.Execute) (
	_ query.Result, finalErr error,
)

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) QueryRow added in v3.77.0

func (tx *Transaction) QueryRow(
	ctx context.Context, q string, opts ...options.Execute,
) (row query.Row, 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

func (*Transaction) UnLazy added in v3.77.0

func (tx *Transaction) UnLazy(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL