bunx

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataLockTaken = errors.New("data lock taken")
)

Functions

func WithTransaction

func WithTransaction(ctx context.Context, tx bun.Tx) context.Context

Types

type Client

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

func NewClient

func NewClient(db *bun.DB) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DB

func (c *Client) DB(ctx context.Context) DB

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Transaction

func (c *Client) Transaction(ctx context.Context, callback func(ctx context.Context, tx bun.Tx) error) error

func (*Client) TransactionWithTryAdvisoryLock

func (c *Client) TransactionWithTryAdvisoryLock(ctx context.Context, key string, callback func(ctx context.Context, tx bun.Tx) error) error

TransactionWithTryAdvisoryLock is Transaction with pg_try_advisory_xact_lock if a lock has already taken, returns error immediately

type DB

type DB interface {
	bun.IDB
	bun.IConn
}

type Logger

type Logger interface {
	Info(args ...interface{})
}

func DefaultLogger

func DefaultLogger() Logger

func NewNoopLogger

func NewNoopLogger() Logger

type Migrator

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

func NewMigrator

func NewMigrator(db *bun.DB, migrationFS embed.FS, logger Logger) (*Migrator, error)

func (*Migrator) Migrate

func (m *Migrator) Migrate(ctx context.Context) error

func (*Migrator) Reset

func (m *Migrator) Reset(ctx context.Context) error

func (*Migrator) Rollback

func (m *Migrator) Rollback(ctx context.Context) error

func (*Migrator) Status

func (m *Migrator) Status(ctx context.Context) error

type NoopLogger

type NoopLogger struct{}

func (*NoopLogger) Info

func (n *NoopLogger) Info(_ ...interface{})

Jump to

Keyboard shortcuts

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