datasource

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"vef:datasource",
	fx.Provide(
		provideRegistry,
		providePrimary,
		providePrimaryKind,
	),
)

Module constructs the data source Registry from configuration, seeds the non-primary static (TOML) and provider-supplied sources during startup, exposes the primary connection's raw *sql.DB (consumed by the schema reflection service), and derives the primary orm.DB for common callers.

Functions

func NewFromDB

func NewFromDB(rawDB *sql.DB, primary orm.DB, cfg config.DataSourceConfig, logger logx.Logger) datasource.Registry

NewFromDB wraps an already-built orm.DB as the primary data source without re-opening it. It is intended for test harnesses (apptest) that want to share an existing connection across an FX app without paying the cost of a real Open/Ping dance. Production code should always go through the FX module. The caller supplies both the *sql.DB lifecycle handle and the orm.DB wrapper built over it, so datasource stays unaware of bun.

Types

type ProviderParams

type ProviderParams struct {
	fx.In

	Providers []datasource.Provider `group:"vef:datasource:providers"`
}

ProviderParams collects every datasource.Provider declared through vef.ProvideDataSourceProvider. The group is optional so applications with no providers still satisfy the signature.

Jump to

Keyboard shortcuts

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