Documentation
¶
Overview ¶
Package nucleus is the Nucleus-backed implementation of Orbit's neutral datasource contract (ADR-001). It is the single place in Orbit that imports nucleus/pkg/model and pkg/db: it wraps a *model.Registry, per-alias *db.DB handles, and model.NewCRUD, and translates them to datasource.ModelInfo / datasource.RecordStore / datasource.Page. The Data Studio panel depends only on the datasource contract; a Quark adapter will implement the same contract later, proving the abstraction did not keep Nucleus's shape.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements datasource.DataSource over Nucleus.
func (*Adapter) All ¶
func (a *Adapter) All() []datasource.ModelInfo
All returns every registered model as neutral ModelInfo.
func (*Adapter) Get ¶
func (a *Adapter) Get(name string) (datasource.ModelInfo, bool)
Get returns one model by name.
func (*Adapter) Store ¶
func (a *Adapter) Store(modelName, dbAlias string) (datasource.RecordStore, error)
Store resolves the RecordStore for a (model, dbAlias). An empty dbAlias falls back to the model's declared alias, then to DefaultAlias — the same order the panel's handlers applied. Stores are cached per (alias, model), like getCRUD.
type Config ¶
type Config struct {
// Registry is the application's shared model registry (rt.Models()).
Registry *model.Registry
// DefaultAlias is the database alias used when a model declares none and a
// request specifies none.
DefaultAlias string
// Resolve maps a database alias to its engine-aware handle and dialect
// string. An empty alias means DefaultAlias. It replaces the panel's old
// databaseHandle + databaseRuntimeInfoByAlias plumbing.
Resolve func(alias string) (handle *db.DB, dialect string, err error)
// Bus is passed to model.NewCRUD (may be nil).
Bus *signals.Bus
// Observer, when non-nil, is installed on each CRUD as the fallback live-SQL
// feed unless BusConnected reports true — mirroring the panel's getCRUD,
// which skipped the per-CRUD observer once the observability bus was wired.
Observer model.SQLQueryObserver
BusConnected func() bool
}
Config wires the adapter from the same runtime accessors the panel used to hold directly (registry, per-alias handles, the signals bus).