What problem does it solve?
This Skill unit provides a comprehensive guide to define and manage ORM models using LiteORM's declarative ORM front-end, streamlining the process of creating and interacting with database models.
Core Features & Use Cases
- Model Definition: Learn how to define model structs with
TableName() and orm:"..." tags.
- AutoMigrate: Automate the creation and synchronization of database tables with
AutoMigrate.
- Associations: Understand how to handle relationships like belongs-to, has-many, and many-to-many.
- Hooks: Implement custom hooks for lifecycle events like create, update, and delete.
- Soft Delete: Implement soft delete functionality for models with soft delete columns.
- Use Case: Create a
User model with associated Post and Comment models, and implement soft delete for user records.
Quick Start
Use the orm-models skill to define a new model 'User' with fields for ID, username, and email.