Back01Case Study

Fusion ORM

A Go ORM that pairs a SQL-first query engine with a fluent chaining API, a callback pipeline, and first-class generics.

Fusion ORM is a Go ORM built directly on database/sql, shipping pure-Go SQLite and pgx/v5 PostgreSQL dialects. It offers chainable queries (Where/Or/Order/Limit/Select/Distinct), full CRUD parity, batched inserts with RETURNING, nested Preload and inline Joins across has-one, has-many, belongs-to, many-to-many, and polymorphic relations, a typed fusion.G[T] generics facade, soft delete, an LRU+TTL prepared-statement cache, error translation onto sentinel errors, AutoMigrate plus versioned Go and SQL migrations, and QueryHook-based observability with a no-N+1 test suite.

System Specifications

Tech Stack
Go 1.27+database/sqlSQLite (pure-Go)PostgreSQL (pgx/v5)GenericsCallback PipelineAutoMigratePrepared StatementsSoft DeleteQueryHook / sloggolangci-lintRace Detector CI
5
Features
12
Technologies
0
Gallery shots
Case Study
Status
03 / Architecture & Engineering

What it does

Query first

Chainable Where/Or/Order/Limit/Offset/Select/Distinct, struct and map conditions, Scopes, raw Clauses, and stable ToSQL output.

CRUD parity & batch inserts

Create/Save/Updates/Delete/First/Take/Last/Find, FindInBatches, FirstOrInit/FirstOrCreate, Pluck, Row/Rows/Scan — plus single-statement batch inserts with RETURNING or LastInsertID backfill.

Relations

Batched, nested Preload with apply functions and inline Joins for has-one, has-many, belongs-to, many-to-many, and polymorphic relations, plus a full Association API.

Generics & soft delete

fusion.G[T] exposes checked chain and finisher interfaces with typed return values; embed fusion.DeletedAt for soft delete with Unscoped and Restore.

Migrations & observability

Built-in AutoMigrate with versioned Go and numbered SQL migrations guarded by a lock table, prepared-statement caching, error sentinels, and QueryHook/slog tracing with slow-query detection.

04 / Tech Stack

Tech stack

  • Go 1.27+
  • database/sql
  • SQLite (pure-Go)
  • PostgreSQL (pgx/v5)
  • Generics
  • Callback Pipeline
  • AutoMigrate
  • Prepared Statements
  • Soft Delete
  • QueryHook / slog
  • golangci-lint
  • Race Detector CI
Next Case Study

TukiaHub — Event Management

Full-stack event discovery and ticketing marketplace pairing an attendee storefront with organizer and admin consoles, built on Next.js and Go.