squirrel_builder

package
v0.0.0-...-35a4376 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayContains

func ArrayContains(column string, elements ...any) squirrel.Sqlizer

Types

type Builder

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

func NewSquirrelBuilder

func NewSquirrelBuilder(db *sql.DB, opts ...Option) *Builder

func (Builder) Builder

func (Builder) Close

func (b Builder) Close() error

func (Builder) DB

func (b Builder) DB() *sql.DB

func (Builder) ExecuteInTransactionWithCommit

func (b Builder) ExecuteInTransactionWithCommit(
	ctx context.Context,
	txOpts *sql.TxOptions,
	transactionFunction func(TransactionContext) error,
) error

func (Builder) ExecuteInTransactionalContext

func (b Builder) ExecuteInTransactionalContext(
	ctx transaction_context.TransactionContext,
	txFunction func(context.Context, StatementBuilder) error,
) error

func (Builder) ExecuteWithCommit

func (b Builder) ExecuteWithCommit(
	ctx context.Context,
	transactionFunction func(transaction_context.TransactionContext) error,
	opts ...transaction_context.TxOptions,
) error

type CaseBuilder

type CaseBuilder func(squirrel.CaseBuilder) squirrel.CaseBuilder

type Option

type Option func(*Builder)

func WithCertsWatcherPlugin

func WithCertsWatcherPlugin(dsn string, logger log.Logger) Option

func WithDBMaxIdleConnections

func WithDBMaxIdleConnections(n int) Option

func WithDBMaxIdleTime

func WithDBMaxIdleTime(d time.Duration) Option

func WithDBMaxLifetime

func WithDBMaxLifetime(d time.Duration) Option

func WithDBMaxOpenConnections

func WithDBMaxOpenConnections(n int) Option

func WithLoger

func WithLoger(logger log.Logger) Option

func WithMeter

func WithMeter(meter metric.Meter) Option

func WithPlugin

func WithPlugin(plugin func(*Builder)) Option

func WithStatementBuilderPlaceholderFormat

func WithStatementBuilderPlaceholderFormat(f squirrel.PlaceholderFormat) Option

func WithStatsLoggerPlugin

func WithStatsLoggerPlugin(logger log.Logger, d ...time.Duration) Option

func WithTracer

func WithTracer(tracer tracing.Tracer) Option

type Options

type Options []Option

func DefaultDBOptions

func DefaultDBOptions(dsn string, logger log.Logger) Options

type StatementBuilder

type StatementBuilder interface {
	Select(columns ...string) squirrel.SelectBuilder
	Insert(into string) squirrel.InsertBuilder
	Update(table string) squirrel.UpdateBuilder
	Delete(from string) squirrel.DeleteBuilder
}

type TransactionContext

type TransactionContext struct {
	context.Context
	// contains filtered or unexported fields
}

func IsTransactionContext

func IsTransactionContext(ctx context.Context) (TransactionContext, bool)

func (TransactionContext) Commit

func (t TransactionContext) Commit() error

func (TransactionContext) Rollback

func (t TransactionContext) Rollback() error

func (TransactionContext) Span

func (t TransactionContext) Span() trace.Span

func (TransactionContext) StatementBuilder

func (t TransactionContext) StatementBuilder() StatementBuilder

func (TransactionContext) Tx

func (t TransactionContext) Tx() *sql.Tx

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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