feat(ui): add relationship management features in schema editor
- Implement functionality to create, update, delete, and view relationships between tables. - Introduce new UI screens for managing relationships, including forms for adding and editing relationships. - Enhance table editor with navigation to relationship management. - Ensure relationships are displayed in a structured table format for better usability.
This commit is contained in:
67
pkg/writers/doc.go
Normal file
67
pkg/writers/doc.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Package writers provides interfaces and implementations for writing database schemas
|
||||
// to various output formats and destinations.
|
||||
//
|
||||
// # Overview
|
||||
//
|
||||
// The writers package defines a common Writer interface that all format-specific writers
|
||||
// implement. This allows RelSpec to export database schemas to multiple formats including:
|
||||
// - SQL schema files (PostgreSQL, SQLite)
|
||||
// - Schema definition files (DBML, DCTX, DrawDB, GraphQL)
|
||||
// - ORM model files (GORM, Bun, Drizzle, Prisma, TypeORM)
|
||||
// - Data interchange formats (JSON, YAML)
|
||||
//
|
||||
// # Architecture
|
||||
//
|
||||
// Each writer implementation is located in its own subpackage (e.g., pkg/writers/dbml,
|
||||
// pkg/writers/pgsql) and implements the Writer interface, supporting three levels of
|
||||
// granularity:
|
||||
// - WriteDatabase() - Write complete database with all schemas
|
||||
// - WriteSchema() - Write single schema with all tables
|
||||
// - WriteTable() - Write single table with all columns and metadata
|
||||
//
|
||||
// # Usage
|
||||
//
|
||||
// Writers are instantiated with WriterOptions containing destination-specific configuration:
|
||||
//
|
||||
// // Write to file
|
||||
// writer := dbml.NewWriter(&writers.WriterOptions{
|
||||
// OutputPath: "schema.dbml",
|
||||
// })
|
||||
// err := writer.WriteDatabase(db)
|
||||
//
|
||||
// // Write ORM models with package name
|
||||
// writer := gorm.NewWriter(&writers.WriterOptions{
|
||||
// OutputPath: "./models",
|
||||
// PackageName: "models",
|
||||
// })
|
||||
// err := writer.WriteDatabase(db)
|
||||
//
|
||||
// // Write with schema flattening for SQLite
|
||||
// writer := sqlite.NewWriter(&writers.WriterOptions{
|
||||
// OutputPath: "schema.sql",
|
||||
// FlattenSchema: true,
|
||||
// })
|
||||
// err := writer.WriteDatabase(db)
|
||||
//
|
||||
// # Schema Flattening
|
||||
//
|
||||
// The FlattenSchema option controls how schema-qualified table names are handled:
|
||||
// - false (default): Uses dot notation (schema.table)
|
||||
// - true: Joins with underscore (schema_table), useful for SQLite
|
||||
//
|
||||
// # Supported Formats
|
||||
//
|
||||
// - dbml: Database Markup Language files
|
||||
// - dctx: DCTX schema files
|
||||
// - drawdb: DrawDB JSON format
|
||||
// - graphql: GraphQL schema definition language
|
||||
// - json: JSON database schema
|
||||
// - yaml: YAML database schema
|
||||
// - gorm: Go GORM model structs
|
||||
// - bun: Go Bun model structs
|
||||
// - drizzle: TypeScript Drizzle ORM schemas
|
||||
// - prisma: Prisma schema language
|
||||
// - typeorm: TypeScript TypeORM entities
|
||||
// - pgsql: PostgreSQL SQL schema
|
||||
// - sqlite: SQLite SQL schema with automatic flattening
|
||||
package writers
|
||||
Reference in New Issue
Block a user