stdsql

package
v0.4.21 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(ctx context.Context, db *sqlx.DB, sql string) error

func QueryAndProcessMany

func QueryAndProcessMany[T any](ctx context.Context, conn *sqlx.DB, sql string, handler func(ctx context.Context, rows []*T) error, opts ...exec.QueryManyOpt[T]) error

func QueryMany

func QueryMany[T any](ctx context.Context, conn *sqlx.DB, sql string, opts ...exec.QueryManyOpt[T]) ([]*T, error)

func QueryMaps

func QueryMaps(ctx context.Context, conn *sqlx.DB, sql string) ([]exec.QueryMapResult, error)

Types

type Querier_Opts added in v0.2.5

type Querier_Opts[T any] func(querier *StdSqlQuerier[T])

func Querier_WithSshTunnelDialer added in v0.2.5

func Querier_WithSshTunnelDialer[T any](sshTunnelDialer *sshtunnel.SshTunnelDialer) Querier_Opts[T]

type StdSqlExecutor

type StdSqlExecutor interface {
	GetDb() *sqlx.DB
	QueryRows(ctx context.Context, q string, args ...interface{}) (*sqlx.Rows, error)
}

type StdSqlQuerier

type StdSqlQuerier[T any] struct {
	// contains filtered or unexported fields
}

func NewQuerier

func NewQuerier[T any](conn *sqlx.DB, opts ...Querier_Opts[T]) *StdSqlQuerier[T]

func (StdSqlQuerier[T]) Close

func (s StdSqlQuerier[T]) Close() error

func (StdSqlQuerier[T]) Exec

func (s StdSqlQuerier[T]) Exec(ctx context.Context, sql string) error

func (StdSqlQuerier[T]) QueryAndProcessMany

func (s StdSqlQuerier[T]) QueryAndProcessMany(
	ctx context.Context,
	sql string,
	handler func(ctx context.Context, batch []*T) error,
	opts ...exec.QueryManyOpt[T],
) error

func (StdSqlQuerier[T]) QueryMany

func (s StdSqlQuerier[T]) QueryMany(ctx context.Context, sql string, opts ...exec.QueryManyOpt[T]) ([]*T, error)

func (StdSqlQuerier[T]) QueryMaps

func (s StdSqlQuerier[T]) QueryMaps(ctx context.Context, sql string) ([]exec.QueryMapResult, error)

Jump to

Keyboard shortcuts

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