Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module( "vef:datasource", fx.Provide( provideRegistry, providePrimary, ), )
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.