awesome-repositories.com
Blog
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectAboutHow we rankPressMCP server
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
go-gorm avatar

go-gorm/gorm

0
View on GitHub↗
39,798 stars·4,154 forks·Go·MIT·18 viewsgorm.io↗

Gorm

GORM is a developer-focused object-relational mapping library for Go that provides a comprehensive data persistence framework. It serves as a database access layer, allowing developers to map application structures to database tables and perform CRUD operations using a fluent, type-safe query builder instead of writing raw SQL.

The library distinguishes itself through its association-aware persistence, which automatically tracks and synchronizes complex entity relationships during database operations. It utilizes a driver-agnostic interface to maintain consistent behavior across various storage engines and employs a reflection-based system to map programming language types to database schemas. Developers can further customize behavior using a callback-based hook system that executes logic at specific points in the operation lifecycle.

Beyond core mapping, the project provides robust support for transaction management, connection pooling, and automated schema migrations. It handles complex relational modeling, including one-to-one, one-to-many, and many-to-many associations, while offering advanced features like eager loading, soft deletes, and conflict resolution strategies for upsert operations.

The framework is designed for integration into Go applications, providing a unified interface for managing database connectivity and transactional integrity.

Features

  • Database Transactions - Provides a structured API for executing atomic database operations to ensure data consistency and integrity.
  • Object-Relational Mappers - // Get all recordsresult := db.Find(&users)// SELECT FROM users;result.RowsAffected // returns found records count, equals len(users)result.Error // returns error
  • Object-Relational Mapping - Manages complex object relationships by automatically tracking and synchronizing linked records during create, update, and delete operations.
  • Query Builders - A fluent interface for constructing complex SQL statements programmatically while maintaining type safety and preventing common injection vulnerabilities.
  • Database Abstraction Layers - Provides a unified abstraction over various database dialects to ensure consistent query execution across different underlying storage engines.
  • Database Transaction Management - GORM perform write (create/update/delete) operations run inside a transaction to ensure data consistency, you can disable it during initialization if it is not required, you will gain about 30%+ performance improvement a
  • Batch Data Processing - To efficiently insert large number of records, pass a slice to the Create method. GORM will generate a single SQL statement to insert all the data and backfill primary key values, hook methods will be invoked too. It w
  • Connection Managers - Database connection management establishes secure links to external storage systems by initializing drivers with connection strings and configuration settings for reliable communication.
  • Object-Relational Mapping Associations - GORM automates the saving of associations and their references when creating or updating records, using an upsert technique that primarily updates foreign key references for existing associations. ### Auto-Saving Associa
  • Persistence Frameworks - A structured environment for defining database schemas as code and automating the synchronization of application state with storage.
  • Query Condition Builders - String Conditions // Get first matched recorddb.Where("name = ?", "jinzhu").First(&user)// SELECT FROM users WHERE name = 'jinzhu' ORDER BY id LIMIT 1;// Get all matched recordsdb.Where("name <> ?", "jinzhu").Find(
  • Transaction Management - Wraps database operations within atomic units of work to maintain data integrity and ensure consistent state across multiple queries.
  • Transaction Managers - Ensuring data integrity by grouping multiple database operations into atomic units that either succeed or fail together.
  • Database Tools - Object-Relational Mapper for Go.
  • Databases and Storage - Developer-friendly ORM library.
  • Object Relational Mappers - Feature-rich and developer-friendly ORM.
  • Object Relational Mapping - Feature-rich and developer-friendly ORM.
  • Persistence Frameworks - Popular object-relational mapping library for Go.
  • Database Access Layers - A collection of tools that manage connections, transaction lifecycles, and query execution across various relational database management systems.
  • Eager Loading Strategies - GORM automates the saving of associations and their references when creating or updating records, using an upsert technique that primarily updates foreign key references for existing associations. ### Auto-Saving Associa
  • Schema Modelers - Database schema modeling allows defining application objects that map to database tables, supporting custom data types, null-value handling, and persistent storage structures.
  • Single Record Retrievers - GORM provides First, Take, Last methods to retrieve a single object from the database, it adds LIMIT 1 condition when querying the database, and it will return the error ErrRecordNotFound if no record is found.
  • Migration Tools - Synchronizing application data structures with database table schemas to ensure consistent and reliable storage across different environments.
  • Schema Mapping Tools - Uses runtime type inspection to automatically map programming language structures to database tables and manage field-level data persistence.
  • Soft Deletion Mechanisms - If your model includes a gorm.DeletedAt field (which is included in gorm.Model), it will get soft delete ability automatically! When calling Delete, the record WON’T be removed from the database, but GORM will set
  • Upsert Strategies - GORM provides compatible Upsert support for different databases import "gorm.io/gorm/clause"// Do nothing on conflictdb.Clauses(clause.OnConflict{DoNothing: true}).Create(&user)// Update columns to default value on id
  • Connection Pools - Managing a collection of reusable database connections to improve application performance and resource efficiency under high traffic loads.
  • Data Modeling Tools - Defining complex relationships between data entities such as one-to-one, one-to-many, and many-to-many associations within an application.
  • Database Deletion Utilities - When deleting a record, the deleted value needs to have primary key or it will trigger a Batch Delete, for example: ### Generics API ctx := context.Background()// Delete by IDerr := gorm.GEmail.Where("id = ?", 10).Delete
  • Database Lifecycle Hooks - GORM allows user defined hooks to be implemented for BeforeSave, BeforeCreate, AfterSave, AfterCreate. These hook method will be called when creating a record, refer Hooks for details on the lifecycle func (u *Us
  • Lifecycle Hooks - Executes user-defined logic at specific points in the database operation lifecycle to enable custom data validation and transformation.
  • Relational Join Mappers - Specify Joins conditions type result struct { Name string Email string}db.Model(&User{}).Select("users.name, emails.email").Joins("left join emails on emails.user_id = users.id").Scan(&result{})// SELECT users.name, emai

Star history

Star history chart for go-gorm/gormStar history chart for go-gorm/gorm

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Frequently asked questions

What does go-gorm/gorm do?

GORM is a developer-focused object-relational mapping library for Go that provides a comprehensive data persistence framework. It serves as a database access layer, allowing developers to map application structures to database tables and perform CRUD operations using a fluent, type-safe query builder instead of writing raw SQL.

What are the main features of go-gorm/gorm?

The main features of go-gorm/gorm are: Database Transactions, Object-Relational Mappers, Object-Relational Mapping, Query Builders, Database Abstraction Layers, Database Transaction Management, Batch Data Processing, Connection Managers.

What are some open-source alternatives to go-gorm/gorm?

Open-source alternatives to go-gorm/gorm include: sqlalchemy/sqlalchemy — SQLAlchemy is a comprehensive Python SQL toolkit and object-relational mapper that provides a full suite of tools for… sequelize/sequelize — Sequelize is an object-relational mapping library that provides a unified interface for managing relational data… typeorm/typeorm — TypeORM is an object-relational mapper for TypeScript and JavaScript that bridges the gap between object-oriented… dotnet/efcore — Entity Framework Core is an object-relational mapper that enables developers to interact with database systems using… hibernate/hibernate-orm — Hibernate ORM is a Java object-relational mapper and a full implementation of the Jakarta Persistence API. It serves… dapperlib/dapper — Dapper is a lightweight object-relational mapper for .NET that functions as a high-performance data access library. It…

Open-source alternatives to Gorm

Similar open-source projects, ranked by how many features they share with Gorm.
  • sqlalchemy/sqlalchemysqlalchemy avatar

    sqlalchemy/sqlalchemy

    11,612View on GitHub↗

    SQLAlchemy is a comprehensive Python SQL toolkit and object-relational mapper that provides a full suite of tools for interacting with relational databases. It serves as a foundational layer for database connectivity, offering both a high-level object-oriented interface for data persistence and a programmatic SQL expression language for constructing complex, dialect-agnostic queries. The project distinguishes itself through its sophisticated unit of work persistence, which coordinates atomic transactions and tracks object state changes to minimize redundant database operations. It provides a

    Pythonpythonsqlsqlalchemy
    View on GitHub↗11,612
  • sequelize/sequelizesequelize avatar

    sequelize/sequelize

    30,349View on GitHub↗

    Sequelize is an object-relational mapping library that provides a unified interface for managing relational data through code. By implementing the Active Record pattern, it maps database tables to application objects, allowing developers to perform standard create, read, update, and delete operations using high-level method calls. The library abstracts complex database interactions by translating these calls into optimized, engine-specific SQL statements, ensuring consistent behavior across different database systems. The project distinguishes itself through a comprehensive suite of tools for

    TypeScriptdb2-ibm-ifeature-richjavascript
    View on GitHub↗30,349
  • typeorm/typeormtypeorm avatar

    typeorm/typeorm

    36,540View on GitHub↗

    TypeORM is an object-relational mapper for TypeScript and JavaScript that bridges the gap between object-oriented application code and relational database tables. It provides a comprehensive data persistence layer that allows developers to define database entities using class decorators or configuration objects, enabling seamless interaction with data through object-oriented patterns. The project distinguishes itself through a flexible architecture that supports both the data mapper and repository patterns, alongside a fluent query builder that translates high-level method calls into platform

    TypeScriptactive-recordcockroachdbdata-mapper
    View on GitHub↗36,540
  • dotnet/efcoredotnet avatar

    dotnet/efcore

    14,587View on GitHub↗

    Entity Framework Core is an object-relational mapper that enables developers to interact with database systems using strongly-typed code. It serves as a comprehensive data access framework, providing a unified interface for mapping application objects to relational and non-relational database schemas while managing the lifecycle of data operations through a central context. The project distinguishes itself through a provider-based architecture that decouples core data access logic from specific database engines, allowing for consistent interaction across diverse storage systems. It features a

    C#aspnet-productc-sharpdatabase
    View on GitHub↗14,587
  • See all 30 alternatives to Gorm→