tessl install tessl/golang-gorm-io--gorm@1.31.0Full-featured ORM library for Golang with associations, hooks, transactions, migrations, and developer-friendly chainable API
Agent Success
Agent success rate when using this tile
81%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.13x
Baseline
Agent success rate without this tile
72%
Build a flexible data reporting system that can query database records and generate custom reports in multiple output formats (JSON, CSV-style maps, and aggregated summaries).
The system should provide three reporting functions:
Each function should properly handle database row iteration, type conversion, and error handling.
Your implementation should work with the following models:
type User struct {
ID uint
Name string
Email string
Age int
Salary float64
}
type Stats struct {
TotalUsers int64
TotalSalary float64
AverageSalary float64
}@generates
package reporter
import "gorm.io/gorm"
// GetUserRecords retrieves all user records from the database and returns them as a slice of User structs.
// It should use database row scanning to populate the struct fields with proper type conversion.
func GetUserRecords(db *gorm.DB) ([]User, error)
// GetUserMap retrieves user records and returns them as a slice of maps.
// Each map contains column names as keys and their corresponding values.
// This is useful when you need dynamic access to fields.
func GetUserMap(db *gorm.DB) ([]map[string]interface{}, error)
// GetAggregatedStats queries aggregated statistics and returns them in a Stats struct.
// The query should calculate total user count, total salary sum, and average salary.
func GetAggregatedStats(db *gorm.DB) (*Stats, error)
type User struct {
ID uint
Name string
Email string
Age int
Salary float64
}
type Stats struct {
TotalUsers int64
TotalSalary float64
AverageSalary float64
}Provides ORM functionality including database querying and row scanning capabilities.
@satisfied-by