Database Model Generator for Go/GORM
Generate Go ORM structs from your database tables with a beautiful GUI or CLI
- π₯οΈ Modern GUI - Beautiful desktop application built with Wails v2 + Vue 3
- π Dark/Light Theme - Toggle between dark and light themes
- π¬ MySQL Support - Full MySQL/MariaDB database introspection
- π PostgreSQL Support - Full PostgreSQL with schema selection
- π·οΈ GORM Tags - Auto-generated GORM struct tags with type mapping
- π Smart Type Mapping - Intelligent database-to-Go type conversion
- πΎ Export Models - Save individual or all models to files
- π§ CLI Mode - Command-line interface for automation
- π‘ Live Preview - Real-time code preview with syntax highlighting
- Go 1.23 or higher
- Node.js 18 or higher
- Wails CLI
# Clone the repository
git clone https://github.com/rowjak/godb-orm.git
cd godb-orm
# Install Wails CLI (if not installed)
go install github.com/wailsapp/wails/v2/cmd/wails@latest
# Build the application
wails build
# The binary will be in build/bin/# Run in development mode with hot-reload
wails dev- Launch the application
- Enter your database connection details:
- Host: Database host (e.g.,
localhost) - Port: Database port (MySQL:
3306, PostgreSQL:5432) - User: Database username
- Password: Database password
- Database: Database name
- Driver: Select
MySQLorPostgreSQL
- Host: Database host (e.g.,
- Click Connect
- For PostgreSQL, select the desired Schema
- Browse and select tables from the left panel
- View the generated Go struct in the code preview panel
- Click Copy to copy to clipboard or Save to export to file
# Generate models for all tables
godb-orm --host localhost --port 3306 --user root --db mydb --driver mysql
# Generate model for a specific table
godb-orm -H localhost -P 3306 -u root -d mydb --driver mysql --table users
# PostgreSQL with schema
godb-orm --host localhost --port 5432 --user postgres --db mydb --driver postgres --schema publicThe application saves your connection settings to ~/.godb-orm/config.yaml for convenience.
godb-orm/
βββ app.go # Main Wails application & bridge
βββ main.go # Entry point
βββ wails.json # Wails configuration
βββ cmd/
β βββ root.go # CLI commands (Cobra)
βββ internal/
β βββ config/ # Configuration management
β βββ database/ # Database introspection
β β βββ models.go # Data models
β β βββ connection.go # Connection factory
β β βββ mysql_introspector.go
β β βββ postgres_introspector.go
β βββ generator/ # Code generation
β βββ generator.go # Main generator
β βββ tagbuilder.go # GORM tag builder
β βββ typemapper.go # DB-to-Go type mapping
β βββ template.go # Go struct template
βββ frontend/ # Vue 3 frontend
β βββ src/
β β βββ App.vue # Main component
β β βββ style.css # Global styles & themes
β βββ public/
β βββ appicon.webp # App icon
βββ build/
βββ appicon.png # Build assets
| MySQL Type | Go Type |
|---|---|
INT, INTEGER |
int32 |
BIGINT |
int64 |
SMALLINT |
int16 |
TINYINT |
int8 |
TINYINT(1) |
bool |
FLOAT |
float32 |
DOUBLE, DECIMAL |
float64 |
VARCHAR, TEXT |
string |
DATETIME, TIMESTAMP |
time.Time |
DATE |
time.Time |
JSON |
datatypes.JSON |
BLOB, BINARY |
[]byte |
ENUM |
string |
| PostgreSQL Type | Go Type |
|---|---|
INTEGER, INT4 |
int32 |
BIGINT, INT8 |
int64 |
SMALLINT, INT2 |
int16 |
BOOLEAN |
bool |
REAL, FLOAT4 |
float32 |
DOUBLE PRECISION, FLOAT8 |
float64 |
NUMERIC, DECIMAL |
float64 |
VARCHAR, TEXT |
string |
TIMESTAMP, TIMESTAMPTZ |
time.Time |
DATE |
time.Time |
UUID |
uuid.UUID |
JSON, JSONB |
datatypes.JSON |
BYTEA |
[]byte |
SERIAL, BIGSERIAL |
int32, int64 |
package models
import (
"time"
)
// User represents the users table
type User struct {
ID int64 `gorm:"primaryKey;autoIncrement;column:id;type:bigint" json:"id"`
Name string `gorm:"column:name;type:varchar(255);not null" json:"name"`
Email string `gorm:"column:email;type:varchar(255);not null" json:"email"`
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp" json:"updated_at"`
}
// TableName returns the table name for GORM
func (User) TableName() string {
return "users"
}Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Abdur Rozaq
- Email: [email protected]
- GitHub: @rowjak

