go-gorm/gorm

GitHub: go-gorm/gorm

GORM 是 Go 语言的全功能 ORM 库,通过结构体映射和链式调用简化数据库操作,实现对多种数据库的统一抽象和高效访问。

Stars: 39634 | Forks: 4145

# GORM Golang 的奇妙 ORM 库,旨在对开发者友好。 [![go report card](https://goreportcard.com/badge/github.com/go-gorm/gorm "go report card")](https://goreportcard.com/report/github.com/go-gorm/gorm) [![test status](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/27b0c8dd6d003233.svg)](https://github.com/go-gorm/gorm/actions) [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) [![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-blue?logo=go&logoColor=white)](https://pkg.go.dev/gorm.io/gorm?tab=doc) ## 概述 * 功能齐全的 ORM * 关联 (Has One, Has Many, Belongs To, Many To Many, Polymorphism, Single-table inheritance) * Hooks (Before/After Create/Save/Update/Delete/Find) * 使用 `Preload`, `Joins` 进行预加载 * 事务、嵌套事务、保存点、回滚至保存点 * Context、Prepared Statement Mode、DryRun Mode * 批量插入、FindInBatches、Find To Map * SQL Builder、Upsert、Locking、Optimizer/Index/Comment Hints、NamedArg、使用 SQL Expr 进行搜索/更新/创建 * 复合主键 * 自动迁移 * 日志 * 可扩展、灵活的插件 API:Database Resolver (多数据库、读写分离) / Prometheus… * 每个功能都配有测试 * 开发者友好 ## 快速开始 * GORM 指南 [https://gorm.io](https://gorm.io) * Gen 指南 [https://gorm.io/gen/index.html](https://gorm.io/gen/index.html) ## 贡献者 [感谢](https://github.com/go-gorm/gorm/graphs/contributors)您为 GORM 框架做出的贡献! ## 许可证 © Jinzhu, 2013~time.Now 基于 [MIT License](https://github.com/go-gorm/gorm/blob/master/LICENSE) 发布
标签:Golang, GORM, Go语言, Hook机制, MIT协议, ORM, Read/Write Splitting, SQL构建器, 中间件, 事务处理, 关联查询, 后端开发, 多线程, 威胁情报, 安全编程, 对象关系映射, 开发者工具, 开源库, 搜索引擎爬虫, 数据库, 数据库操作, 数据持久化, 数据迁移, 日志审计, 测试用例, 程序破解