Documentation
¶
Overview ¶
Package datexport is a process-wide registry of data-bearing tables that live OUTSIDE the framework entity registry — the physical tables a battery (auth sessions, the job queue, …) or an app creates with raw DDL.
The framework's data export/import (App.ExportData / App.ImportData) walks BOTH the entity registry AND this registry so a dump is complete. A data-bearing module registers its tables from init() (mirroring framework/agentsinv): importing the module == including its tables.
Entries are declarative — {Name, Table, PrimaryKey, Columns} — so the framework can centralize all raw read/write behind one SafeIdent-guarded code path (see framework/export_data.go). A registered table that is absent from the live DB at export time is skipped with a note; an unregistered raw table is silently excluded (register an exporter to include it).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(e DataExporter)
Register adds a data exporter. Safe to call from init(). An exporter whose Name matches an existing entry replaces it (last-writer-wins) so a battery that registers a runtime-renamed table updates cleanly.
func Reset ¶
Reset clears the registry. The *testing.T parameter is a discipline marker (production may pass nil since testing is stdlib); intended for tests.
func Unregister ¶
Unregister removes an exporter by Name. Returns true if an entry was removed.
Types ¶
type DataExporter ¶
type DataExporter struct {
Name string
Source string
Table string
PrimaryKey string
Columns []string
}
DataExporter describes one physical table owned by a battery or app that the entity registry does not cover.
- Name is the unique archive key and the .ndjson filename stem. It must be a safe SQL identifier (it doubles as a lookup key) and unique across all registered exporters and entity names.
- Source is the owning module ("auth", "queue", …) recorded in the manifest for provenance; it is never used to build SQL.
- Table is the physical SQL table name.
- PrimaryKey is the keyset-paging column (defaults to "id" when empty).
- Columns are the physical column names in a stable order.
Table, PrimaryKey, and every Column are validated by the framework via core/query.SafeIdent before they ever reach a query.