2025-12-28 11:41:55 +02:00
2025-12-17 20:44:02 +02:00
2025-12-18 22:50:29 +02:00
2025-12-18 21:39:37 +02:00
2025-12-28 11:41:55 +02:00
2025-12-18 13:38:32 +02:00
2025-12-28 11:41:55 +02:00
2025-12-28 11:41:55 +02:00
2025-12-19 22:27:20 +02:00
2025-12-16 13:12:43 +02:00
2025-12-18 14:37:34 +02:00
2025-12-16 13:12:43 +02:00
2025-12-28 10:15:30 +02:00
2025-12-18 14:35:05 +02:00
2025-12-16 13:12:43 +02:00
2025-12-19 22:27:20 +02:00
2025-12-19 22:27:20 +02:00
2025-12-16 08:38:49 +00:00
2025-12-16 13:12:43 +02:00
2025-12-19 22:28:24 +02:00
2025-12-28 11:41:55 +02:00
2025-12-28 11:41:55 +02:00

RelSpec

Database Relations Specification Tool for Go

RelSpec is a comprehensive database relations management tool that reads, transforms, and writes database table specifications across multiple formats and ORMs.

Overview

RelSpec provides bidirectional conversion and comparison between various database specification formats, allowing you to:

  • Inspect live databases and extract their structure
  • Convert between different ORM models (GORM, Bun , etc.)
  • Transform legacy schema definitions (Clarion DCTX, XML, JSON, etc.)
  • Generate standardized specification files (JSON, YAML, etc.)

1.00

Features

Readers (Input Formats)

RelSpec can read database schemas from multiple sources:

ORM Models

  • GORM - Go GORM model definitions
  • Bun - Go Bun model definitions
  • Drizzle - TypeScript Drizzle ORM schemas
  • Prisma - Prisma schema language
  • TypeORM - TypeScript TypeORM entities

Database Inspection

  • PostgreSQL - Direct PostgreSQL database introspection

Schema Formats

  • DBML - Database Markup Language (dbdiagram.io)
  • DCTX - Clarion database dictionary format
  • DrawDB - DrawDB JSON format
  • GraphQL - GraphQL Schema Definition Language (SDL)
  • JSON - RelSpec canonical JSON format
  • YAML - RelSpec canonical YAML format

Writers (Output Formats)

RelSpec can write database schemas to multiple formats:

ORM Models

  • GORM - Generate GORM-compatible Go structs
  • Bun - Generate Bun-compatible Go structs
  • Drizzle - Generate Drizzle ORM TypeScript schemas
  • Prisma - Generate Prisma schema files
  • TypeORM - Generate TypeORM TypeScript entities

Database DDL

  • PostgreSQL - PostgreSQL DDL (CREATE TABLE, etc.)

Schema Formats

  • DBML - Database Markup Language
  • DCTX - Clarion database dictionary format
  • DrawDB - DrawDB JSON format
  • GraphQL - GraphQL Schema Definition Language (SDL)
  • JSON - RelSpec canonical JSON format
  • YAML - RelSpec canonical YAML format

Use of AI

Rules and use of AI

Installation

go get github.com/wdevs/relspecgo

go install -v git.warky.dev/wdevs/relspecgo/cmd/relspec@latest

Usage

# Inspect database and generate GORM models
relspec --input db --conn "postgres://..." --output gorm --out-file models.go

# Convert GORM models to Bun
relspec --input gorm --in-file existing.go --output bun --out-file bun_models.go

# Export database schema to JSON
relspec --input db --conn "mysql://..." --output json --out-file schema.json

# Convert Clarion DCTX to YAML
relspec --input dctx --in-file legacy.dctx --output yaml --out-file schema.yaml

Project Structure

relspecgo/
├── cmd/              # CLI application
├── pkg/
│   ├── readers/      # Input format readers
│   ├── writers/      # Output format writers
│   ├── models/       # Internal data models
│   └── transform/    # Transformation logic
├── examples/         # Usage examples
└── tests/            # Test files

Todo

Todo List of Features

Development

Prerequisites

  • Go 1.21 or higher
  • Access to test databases (optional)

Building

go build -o relspec ./cmd/relspec

Testing

go test ./...

License

Apache License 2.0 - See LICENSE for details.

Copyright 2025 Warky Devs

Contributing

Contributions welcome. Please open an issue or submit a pull request.

Description
Resolve Spec Go
Readme Apache-2.0 7.4 MiB
v1.0.12 Latest
2026-01-10 16:28:51 +00:00
Languages
Go 96.5%
TypeScript 2.1%
Shell 0.8%
Makefile 0.6%