gorm-custom-data-types
CommunityPersist complex Go types as database fields
Software Engineering#gorm#jsonb#custom-data-types#sql-scanner#driver-valuer#gorm-value#database-dialects
Authorliurida
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Many Go types cannot be directly mapped to database column representations, making it difficult to store structured, encrypted, or dialect-specific values reliably; this Skill provides patterns and interfaces to convert complex Go values into database-compatible formats for GORM models.
Core Features & Use Cases
- Scanner and Valuer Integration: Implement sql.Scanner and driver.Valuer to control how values are read from and written to the database.
- Dialect-Specific Types: Define GormDBDataType to return database-specific column types for migrations across MySQL, Postgres, SQLite, and others.
- SQL Expression Support: Provide GormValue/GormValuer implementations to persist values using SQL expressions or database functions, useful for spatial types or context-aware encryption.
- Use Case: Store JSON objects as JSONB on Postgres, JSON on MySQL, or TEXT on SQLite while preserving queryability and migration correctness.
Quick Start
Create a GORM model field that implements Scanner and Valuer, implement GormDBDataType for your target dialect, and run AutoMigrate to verify the generated column type.
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-custom-data-types Download link: https://github.com/liurida/gorm-development-skill/archive/main.zip#gorm-custom-data-types 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.