commons

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DbImage = "postgres:17.4-alpine"
View Source
const DbName = "rollups"
View Source
const DbPassword = "password"
View Source
const DbUser = "postgres"
View Source
const DefaultTimeout time.Duration = 5 * time.Minute
View Source
const OpenEpoch = 19
View Source
const Schema = "" /* 143-byte string literal not displayed */
View Source
const TimeoutInSeconds = 10

Variables

This section is empty.

Functions

func CloseConnect added in v0.0.2

func CloseConnect(db *sqlx.DB) error

func ConfigureLog

func ConfigureLog(level slog.Leveler)

func GetTransaction added in v0.0.2

func GetTransaction(ctx context.Context) (*sqlx.Tx, bool)

func PrepareKeyArguments added in v0.0.2

func PrepareKeyArguments(args ...any) ([]string, []any)

func StartTransaction added in v0.0.2

func StartTransaction(ctx context.Context, db *sqlx.DB) (context.Context, *sqlx.Tx, error)

func ToBig added in v0.0.2

func ToBig(value any) (*big.Int, error)

func ToUint64 added in v0.0.2

func ToUint64(value interface{}) (uint64, error)

Types

type DBExecutor added in v0.0.2

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

func (*DBExecutor) ExecContext added in v0.0.2

func (d *DBExecutor) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

ExecContext implements sqlx.ExecerContext.

func (*DBExecutor) PrepareNamedContext added in v0.0.2

func (d *DBExecutor) PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)

PrepareNamedContext implements DBExecutorInterface.

type DBExecutorInterface added in v0.0.2

type DBExecutorInterface interface {
	sqlx.ExecerContext
	PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error)
}

func NewDBExecutor added in v0.0.2

func NewDBExecutor(db *sqlx.DB) DBExecutorInterface

type DBTransactor added in v0.0.2

type DBTransactor interface {
	StartTransaction(ctx context.Context) (context.Context, *sqlx.Tx, error)
}

type DbFactory

type DbFactory struct {
	TempDir string
	Timeout time.Duration
}

func NewDbFactory

func NewDbFactory() *DbFactory

func (*DbFactory) Cleanup

func (d *DbFactory) Cleanup()

func (*DbFactory) CreateDb

func (d *DbFactory) CreateDb(sqliteFileName string) *sqlx.DB

func (*DbFactory) CreateDbCtx

func (d *DbFactory) CreateDbCtx(ctx context.Context, sqliteFileName string) (*sqlx.DB, error)

type StdoutLogConsumer

type StdoutLogConsumer struct{}

StdoutLogConsumer is a LogConsumer that prints the log to stdout

func (*StdoutLogConsumer) Accept

func (lc *StdoutLogConsumer) Accept(l testcontainers.Log)

Accept prints the log to stdout

type ToHex added in v0.0.2

type ToHex interface {
	Hex() string
}

Jump to

Keyboard shortcuts

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