Full-featured ORM library for Golang with associations, hooks, transactions, migrations, and developer-friendly chainable API
Overall
score
81%
Build a simple user management system that tracks users with automatic timestamp management.
The system should manage user records with the following capabilities:
User Model: Create a user data structure that includes:
Database Operations: Implement the following operations:
Timestamp Behavior:
@generates
The implementation should include:
package main
import (
"gorm.io/gorm"
)
// User represents a user in the system
type User struct {
// Struct fields will be defined in implementation
}
// UserManager handles user-related database operations
type UserManager struct {
db *gorm.DB
}
// NewUserManager creates a new UserManager instance
func NewUserManager(db *gorm.DB) *UserManager
// CreateUser creates a new user in the database
func (m *UserManager) CreateUser(username, email string) (*User, error)
// UpdateUser updates an existing user's information
func (m *UserManager) UpdateUser(id uint, username, email string) (*User, error)
// DeleteUser soft deletes a user
func (m *UserManager) DeleteUser(id uint) error
// GetUser retrieves a user by ID (excludes soft-deleted users)
func (m *UserManager) GetUser(id uint) (*User, error)
// ListUsers returns all active (non-deleted) users
func (m *UserManager) ListUsers() ([]User, error)Provides ORM functionality with automatic timestamp management and soft delete support.
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