database

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var ErrConfigRequired = errors.New("database facade: config or database required")

Functions

func Close

func Close()

func Gorm

func Gorm(ctxs ...context.Context) *gorm.DB

func GormFrom

func GormFrom(app *runtime.App) *gorm.DB

func Init

func Init(cfg Config, mode string) error

func InitWithConfig

func InitWithConfig(cfg Config, mode string) error

func PGX

func PGX(ctxs ...context.Context) *pgxpool.Pool

func PGXFrom

func PGXFrom(app *runtime.App) *pgxpool.Pool

func PGXTransaction

func PGXTransaction(ctx context.Context, fn func(tx pgx.Tx) error) error

func Transaction

func Transaction(ctx context.Context, fn func(tx *gorm.DB) error) error

func Use

func Use(opts ...UseOption) runtime.Capability

Types

type Config

type Config = coredatabase.Config

type ConfigLoader

type ConfigLoader func(app *runtime.App) (Config, error)

type Database

type Database = coredatabase.Database

func From

func From(app *runtime.App) *Database

func New

func New(ctx context.Context, cfg Config, mode string) (*Database, error)

type ModeLoader

type ModeLoader func(app *runtime.App) (string, error)

type UseOption

type UseOption func(*useOptions)

func WithConfig

func WithConfig(cfg Config) UseOption

func WithConfigLoader

func WithConfigLoader(loader ConfigLoader) UseOption

func WithDatabase

func WithDatabase(db *Database) UseOption

func WithDependencies

func WithDependencies(deps ...runtime.Dependency) UseOption

func WithExternal added in v0.1.4

func WithExternal() UseOption

func WithInternal

func WithInternal() UseOption

func WithMode

func WithMode(mode string) UseOption

func WithModeLoader

func WithModeLoader(loader ModeLoader) UseOption

Jump to

Keyboard shortcuts

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