Registry / orm / gorm
library1.31.1gogounverified

GORM is a developer-friendly ORM library for Go, handling database operations with a focus on convention over configuration.

go get gorm.io/gorm
INSTALL
IMPORT
SIG · GORM
G
gorm
ormgov1.31.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gorm
✓ gorm.io/gorm

Opens a SQLite database, auto-migrates a Product model, and inserts a record.

package main import ( "gorm.io/gorm" "gorm.io/driver/sqlite" ) type Product struct { gorm.Model Code string Price uint } func main() { db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{}) if err != nil { panic("failed to connect database") } db.AutoMigrate(&Product{}) db.Create(&Product{Code: "D42", Price: 100}) }
Debug
Known issues
breakingGORM's AutoMigrate may alter existing tables in unexpected ways, potentially causing data loss.
fix
Use AutoMigrate only in development or with a backup; for production, use versioned migrations.
affects: >=1.0.0
Upgrade
Version history
1.31.1latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
39 hits · last 30 days
node
34
Resources
gorm — go get gorm · libregistry