database

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const KeyDatabase = coredatabase.KeyDatabase

Variables

This section is empty.

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 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