// Package relspecgo provides bidirectional conversion between database schema formats. // // RelSpec is a comprehensive database schema tool that reads, writes, and transforms // database schemas across multiple formats including live databases, ORM models, // schema definition languages, and data interchange formats. // // # Features // // - Read from 15+ formats: PostgreSQL, SQLite, DBML, GORM, Prisma, Drizzle, and more // - Write to 15+ formats: SQL, ORM models, schema definitions, JSON/YAML // - Interactive TUI editor for visual schema management // - Schema diff and merge capabilities // - Format-agnostic intermediate representation // // # Architecture // // RelSpec uses a hub-and-spoke architecture with models.Database as the central type: // // Input Format → Reader → models.Database → Writer → Output Format // // This allows any supported input format to be converted to any supported output format // without requiring N² conversion implementations. // // # Key Packages // // - pkg/models: Core data structures (Database, Schema, Table, Column, etc.) // - pkg/readers: Input format readers (dbml, pgsql, gorm, etc.) // - pkg/writers: Output format writers (dbml, pgsql, gorm, etc.) // - pkg/ui: Interactive terminal UI for schema editing // - pkg/diff: Schema comparison and difference detection // - pkg/merge: Schema merging utilities // - pkg/transform: Validation and normalization // // # Installation // // go install git.warky.dev/wdevs/relspecgo/cmd/relspec@latest // // # Usage // // Command-line conversion: // // relspec convert --from dbml --from-path schema.dbml \ // --to gorm --to-path ./models // // Interactive editor: // // relspec edit --from pgsql --from-conn "postgres://..." \ // --to dbml --to-path schema.dbml // // Schema comparison: // // relspec diff --source-type pgsql --source-conn "postgres://..." \ // --target-type dbml --target-path schema.dbml // // Merge schemas: // // relspec merge --target schema1.dbml --sources schema2.dbml,schema3.dbml // // # Supported Formats // // Input/Output Formats: // - dbml: Database Markup Language // - dctx: DCTX schema files // - drawdb: DrawDB JSON format // - graphql: GraphQL schema definition // - json: JSON schema representation // - yaml: YAML schema representation // - gorm: Go GORM models // - bun: Go Bun models // - drizzle: TypeScript Drizzle ORM // - prisma: Prisma schema language // - typeorm: TypeScript TypeORM entities // - pgsql: PostgreSQL (live DB or SQL) // - sqlite: SQLite (database file or SQL) // // # Library Usage // // RelSpec can be used as a Go library: // // import ( // "git.warky.dev/wdevs/relspecgo/pkg/models" // "git.warky.dev/wdevs/relspecgo/pkg/readers/dbml" // "git.warky.dev/wdevs/relspecgo/pkg/writers/gorm" // ) // // // Read DBML // reader := dbml.NewReader(&readers.ReaderOptions{ // FilePath: "schema.dbml", // }) // db, err := reader.ReadDatabase() // // // Write GORM models // writer := gorm.NewWriter(&writers.WriterOptions{ // OutputPath: "./models", // PackageName: "models", // }) // err = writer.WriteDatabase(db) // // # Documentation // // Full documentation available at: https://git.warky.dev/wdevs/relspecgo // // API documentation: go doc git.warky.dev/wdevs/relspecgo/... // // # License // // See LICENSE file in the repository root. package relspecgo