feat(domains): add domain support for DrawDB integration
Some checks failed
CI / Test (1.24) (push) Successful in -27m28s
CI / Test (1.25) (push) Successful in -27m30s
CI / Build (push) Failing after -28m36s
Integration Tests / Integration Tests (push) Failing after -28m8s
CI / Lint (push) Successful in -27m54s

- Introduce Domain and DomainTable models for logical grouping of tables.
- Implement export and import functionality for domains in DrawDB format.
- Update template execution modes to include domain processing.
- Enhance documentation for domain features and usage.
This commit is contained in:
2026-01-04 15:49:47 +02:00
parent 8c602e3db0
commit 5d3c86119e
7 changed files with 325 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ const (
DatabaseMode EntrypointMode = "database"
// SchemaMode executes the template once per schema (multi-file output)
SchemaMode EntrypointMode = "schema"
// DomainMode executes the template once per domain (multi-file output)
DomainMode EntrypointMode = "domain"
// ScriptMode executes the template once per script (multi-file output)
ScriptMode EntrypointMode = "script"
// TableMode executes the template once per table (multi-file output)
@@ -80,6 +82,8 @@ func (w *Writer) WriteDatabase(db *models.Database) error {
return w.executeDatabaseMode(db)
case SchemaMode:
return w.executeSchemaMode(db)
case DomainMode:
return w.executeDomainMode(db)
case ScriptMode:
return w.executeScriptMode(db)
case TableMode:
@@ -143,6 +147,28 @@ func (w *Writer) executeSchemaMode(db *models.Database) error {
return nil
}
// executeDomainMode executes the template once per domain
func (w *Writer) executeDomainMode(db *models.Database) error {
for _, domain := range db.Domains {
data := NewDomainData(domain, db, w.options.Metadata)
output, err := w.executeTemplate(data)
if err != nil {
return fmt.Errorf("failed to execute template for domain %s: %w", domain.Name, err)
}
filename, err := w.generateFilename(data)
if err != nil {
return fmt.Errorf("failed to generate filename for domain %s: %w", domain.Name, err)
}
if err := w.writeOutput(output, filename); err != nil {
return fmt.Errorf("failed to write output for domain %s: %w", domain.Name, err)
}
}
return nil
}
// executeScriptMode executes the template once per script
func (w *Writer) executeScriptMode(db *models.Database) error {
for _, schema := range db.Schemas {