gorm-models

Declare GORM models with gorm.Model embedding and field tags.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/liurida/gorm-development-skill --skill gorm-models
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gorm-models
Source: https://github.com/liurida/gorm-development-skill/tree/main/models
Command: npx skills add https://github.com/liurida/gorm-development-skill --skill gorm-models

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Defines and documents GORM models with proper embedding, field tags, permissions, timestamps, and embedded structs to ensure robust database mapping in Go projects.

Core Features & Use Cases

  • Model declarations using Go structs mapped to database tables.
  • Embed gorm.Model for standard fields like ID, CreatedAt, UpdatedAt, DeletedAt.
  • Field tags reference to customize column behavior, constraints, and serialization.
  • Field-level permissions examples to restrict read/write access.
  • Timestamp tracking strategies for automatic auditing.
  • Embedded structs and composition for complex models.
  • Comprehensive example showing best practices and reuse.

Quick Start

Define a Go struct for your data model, embed gorm.Model for standard fields, and annotate fields with appropriate tags.

Frequently Asked Questions about gorm-models

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define GORM models with proper struct tags and embeddings in Go?

To define GORM models, declare Go structs mapped to database tables, embed gorm.Model for standard fields like ID and timestamps, and annotate fields with tags to customize column behavior and constraints.

What does embedding gorm.Model do for my Go database models?

Embedding gorm.Model in your Go database models provides standard fields like ID, CreatedAt, UpdatedAt, and DeletedAt automatically. This ensures robust database mapping and automatic timestamp tracking for auditing.

How do I customize column behavior and permissions using GORM field tags?

Customize column behavior and permissions using GORM field tags by annotating struct fields. This restricts read/write access, sets database constraints, and controls serialization for robust model declarations.

Can I use embedded structs and composition for complex GORM models?

Yes, you can use embedded structs and composition for complex GORM models. This allows you to reuse common fields across multiple structs while maintaining structured models with proper database mapping in Go projects.

What is the best way to implement automatic timestamp tracking in GORM?

The best way to implement automatic timestamp tracking in GORM is by embedding gorm.Model. This automatically handles CreatedAt, UpdatedAt, and DeletedAt fields for automatic auditing and robust database mapping.

Does this approach to GORM models work for any Go project using ORM?

Yes, this approach works for Go projects using GORM that require structured models. It enforces Go struct conventions and gorm.Model embedding, ensuring robust database mapping with tags, permissions, and timestamps.