database

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	bun.IConn
	bun.IDB

	PingContext(ctx context.Context) error
	// RunInTx the mapping of this method here is necessary because in bun.IDB there is no RunInTx method and
	// in no other interface, so we need to add a declaration to make it available.
	RunInTx(ctx context.Context, opts *sql.TxOptions, fn func(ctx context.Context, tx bun.Tx) error) error
	Close() error
}

type Database

type Database interface {
	Master() DB
	Replica() DB
	Stop(ctx context.Context) error
}

func New

func New(
	t tracer.Tracer,
	postgresMasterURL string,
	postgresReplicaURL string,
) (Database, error)

func Setup

func Setup(
	lc fx.Lifecycle,
	t tracer.Tracer,
	postgresMasterURL string,
	postgresReplicaURL string,
) (Database, error)

type NullTime

type NullTime = sql.NullTime

Jump to

Keyboard shortcuts

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