# aarondl/sqlboiler

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/aarondl-sqlboiler).**

6,989 stars · 557 forks · Go · NOASSERTION

## Links

- GitHub: https://github.com/aarondl/sqlboiler
- awesome-repositories: https://awesome-repositories.com/repository/aarondl-sqlboiler.md

## Topics

`database` `go` `golang` `mssql` `mysql` `orm` `postgres` `postgresql` `sqlboiler` `sqlite3`

## Description

sqlboiler is a database-first ORM generator for Go that analyzes an existing database schema to produce strongly typed structures and query helpers. It functions as a schema-driven code generator, transforming database tables and relationships into executable Go source code.

The project distinguishes itself through a type-safe query builder that uses chainable modifiers to construct SQL statements, eliminating the need for raw string concatenation. It utilizes customizable text templates to generate source code, allowing for the aliasing of schema entities and the creation of custom templates based on database metadata.

The system covers a broad range of relational data mapping capabilities, including foreign key relationship mapping, batch-based eager loading to prevent N+1 performance issues, and type-safe mapping for database enums. It also provides automation for CRUD operations, including support for upserts, soft deletes using timestamps, and lifecycle hooks that trigger before or after database operations.

## Tags

### Data & Databases

- [Type-Safe Database Clients](https://awesome-repositories.com/f/data-databases/type-safe-database-clients.md) — Generates strongly-typed Go interfaces from a database schema to ensure compile-time safety for all database operations. ([source](https://github.com/aarondl/sqlboiler#readme))
- [CRUD Operations](https://awesome-repositories.com/f/data-databases/crud-operations.md) — Implements standard insert, update, delete, and retrieve operations via generated methods. ([source](https://github.com/aarondl/sqlboiler#readme))
- [Data Querying](https://awesome-repositories.com/f/data-databases/data-querying.md) — Constructs database queries using a chainable system of modifiers and finishers for flexible data retrieval. ([source](https://github.com/aarondl/sqlboiler#readme))
- [Database-to-Code Scaffolding](https://awesome-repositories.com/f/data-databases/data-structure-definitions/data-class-generators/database-to-code-scaffolding.md) — Generates language-specific data classes and helper methods based on an existing database schema.
- [Database ORMs](https://awesome-repositories.com/f/data-databases/database-orms.md) — Functions as a database-first ORM that maps database records to typed Go application objects.
- [Database Query Execution](https://awesome-repositories.com/f/data-databases/database-query-execution.md) — Executes SQL commands and binds results to strongly typed structures using model-specific helpers. ([source](https://github.com/aarondl/sqlboiler/blob/master/CHANGELOG.md))
- [CRUD Interfaces](https://awesome-repositories.com/f/data-databases/database-record-management/crud-interfaces.md) — Provides automated interfaces for common database record modifications based on generated models.
- [Database Schema Mapping](https://awesome-repositories.com/f/data-databases/database-schema-mapping.md) — Transforms database tables and views into typed structures using configurable naming and case styles. ([source](https://github.com/aarondl/sqlboiler/blob/master/CHANGELOG.md))
- [Relationship Mapping](https://awesome-repositories.com/f/data-databases/foreign-key-constraints/relationship-mapping.md) — Generates dedicated getter methods and mapping logic based on database foreign key constraints to navigate table associations.
- [Chainable Modifier Patterns](https://awesome-repositories.com/f/data-databases/query-optimization-patterns/query-generation-patterns/chainable-modifier-patterns.md) — Provides a type-safe query builder using a chainable modifier pattern to construct SQL statements without raw strings.
- [SQL Query Builders](https://awesome-repositories.com/f/data-databases/sql-query-builders.md) — Implements a chainable modifier system to construct type-safe SQL statements without manual string concatenation.
- [Type-Safe Query Builders](https://awesome-repositories.com/f/data-databases/type-safe-query-builders.md) — Provides a modular system of query modifiers to build SQL queries with compile-time validation and avoid string concatenation. ([source](https://github.com/aarondl/sqlboiler/blob/master/README.md))
- [Template-Based Code Customizers](https://awesome-repositories.com/f/data-databases/custom-data-types/custom-data-type-providers/code-generators/template-based-code-customizers.md) — Allows overriding base templates and applying column filters to control the structure of generated output. ([source](https://github.com/aarondl/sqlboiler/blob/master/CHANGELOG.md))
- [Soft Deletion](https://awesome-repositories.com/f/data-databases/data-filtering/soft-deletion.md) — Marks a timestamp in a designated column to hide records from queries. ([source](https://github.com/aarondl/sqlboiler#readme))
- [Database Lifecycle Hooks](https://awesome-repositories.com/f/data-databases/database-lifecycle-hooks.md) — Allows registration of custom functions that trigger automatically before or after database CRUD operations.
- [Database Record Querying](https://awesome-repositories.com/f/data-databases/database-record-querying.md) — Provides a type-safe way to retrieve data from tables using filters and query modifiers. ([source](https://github.com/aarondl/sqlboiler/blob/master/CHANGELOG.md))
- [Eager Loading](https://awesome-repositories.com/f/data-databases/eager-loading.md) — Retrieves related records in a single or recursive set of queries to prevent N+1 performance degradation. ([source](https://github.com/aarondl/sqlboiler/blob/master/README.md))
- [Application-to-Database Enum Mapping](https://awesome-repositories.com/f/data-databases/enum-definitions/application-to-database-enum-mapping.md) — Converts database enum types into language-specific constants to ensure type safety and eliminate raw strings.
- [Model Lifecycle Hooks](https://awesome-repositories.com/f/data-databases/model-lifecycle-hooks.md) — Provides mechanisms for triggering custom logic during specific database model events like insert or update. ([source](https://github.com/aarondl/sqlboiler/blob/master/README.md))
- [Relational Association Mapping](https://awesome-repositories.com/f/data-databases/object-relational-mappings/code-to-relational-mappings/relational-association-mapping.md) — Provides dedicated mapping and getter methods to navigate foreign key relationships between database tables.
- [Eager Loading](https://awesome-repositories.com/f/data-databases/query-performance-tuning/eager-loading.md) — Implements batch-based eager loading to retrieve related records and prevent N+1 query performance issues.
- [Relationship Modeling](https://awesome-repositories.com/f/data-databases/relationship-modeling.md) — Generates dedicated getter methods and mapping logic based on database foreign key constraints. ([source](https://github.com/aarondl/sqlboiler/blob/master/CHANGELOG.md))
- [Association Definitions](https://awesome-repositories.com/f/data-databases/relationship-modeling/association-definitions.md) — Provides helper methods to manage associations based on foreign key definitions. ([source](https://github.com/aarondl/sqlboiler#readme))
- [Soft Deletion](https://awesome-repositories.com/f/data-databases/soft-deletion.md) — Implements soft deletion by marking a timestamp in a designated column to hide records from standard queries.

### Development Tools & Productivity

- [ORM Code Generators](https://awesome-repositories.com/f/development-tools-productivity/orm-code-generators.md) — Automatically generates database models and boilerplate CRUD code from existing database schemas. ([source](https://github.com/aarondl/sqlboiler/blob/master/.gitignore))
- [Schema-Driven Code Generators](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/code-generation/schema-driven-code-generators.md) — Analyzes existing database schemas to produce strongly typed Go structures and query helpers at compile time.
- [Model Generators](https://awesome-repositories.com/f/development-tools-productivity/type-generators/database-schema/model-generators.md) — Creates strongly typed structures and helper methods by analyzing existing database schemas. ([source](https://github.com/aarondl/sqlboiler/blob/master/README.md))

### Programming Languages & Runtimes

- [Template-Based Code Generators](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-generators/specification-from-code-generators/natural-language-code-generators/template-based-code-generators.md) — Uses customizable text templates to transform database metadata into executable Go source code.
