Full-featured ORM library for Golang with associations, hooks, transactions, migrations, and developer-friendly chainable API
Overall
score
81%
A utility that processes large datasets from a database efficiently and generates summary reports without loading all records into memory at once.
@generates
package processor
import (
"gorm.io/gorm"
)
// UserRecord represents a user in the database
type UserRecord struct {
ID uint `gorm:"primaryKey"`
Name string
Email string
IsActive bool
Age int
}
// OrderRecord represents an order in the database
type OrderRecord struct {
ID uint `gorm:"primaryKey"`
UserID uint
Amount float64
Status string
}
// ProcessUserBatches processes user records in batches and executes a callback for each batch.
// Returns the total number of records processed and any error encountered.
func ProcessUserBatches(db *gorm.DB, batchSize int, callback func(users []UserRecord) error) (int, error)
// CountActiveUsers counts the total number of active users by processing records in batches.
func CountActiveUsers(db *gorm.DB, batchSize int) (int, error)
// CalculateTotalRevenue calculates the total revenue from completed orders by processing in batches.
func CalculateTotalRevenue(db *gorm.DB, batchSize int) (float64, error)Provides ORM functionality for database operations including batch processing.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/golang-gorm-io--gormdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10