gorm-hooks
CommunityAdd validation and logic to GORM lifecycle
Authorliurida
Version1.0.0
Installs0
System Documentation
What problem does it solve?
GORM hooks let you inject model-level validation, defaulting, audit logging, and transactional side effects directly into CRUD operations so that data integrity and side effects are enforced close to the data layer.
Core Features & Use Cases
- Validation & Normalization: Run BeforeSave/BeforeCreate/BeforeUpdate hooks to enforce required fields and normalize values.
- Defaults & IDs: Generate UUIDs and set defaults before persistence.
- Audit & Cascading Actions: Create audit records or perform cascading updates in AfterCreate/AfterUpdate while remaining inside the same transaction.
- Protection & Short-circuiting: Prevent destructive operations (for example, block deletion of admin users) by returning errors from hooks.
- Use Case: Enforce per-record business rules and create audit logs for user creation without scattering logic across services.
Quick Start
Add a BeforeCreate hook that sets a UUID, validates required fields, and records an audit entry within the same transaction.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: gorm-hooks Download link: https://github.com/liurida/gorm-development-skill/archive/main.zip#gorm-hooks Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.