gorm-serializer

Serialize complex Go structures into database columns via GORM SerializerInterface.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Storing and retrieving complex Go structures—such as slices, maps, or custom structs—in a single database column is cumbersome without a consistent serialization strategy. This skill provides a standardized way to convert these types into formats that databases can store and later reconstruct.

Core Features & Use Cases

  • Built‑in serializers: JSON, GOB, and UnixTime for quick adoption.
  • Custom serializer registration: Implement SerializerInterface and register with schema.RegisterSerializer.
  • Field‑level custom types: Define types that embed their own serialization logic.
  • Practical scenarios: Persist user preferences as JSON, encrypt sensitive fields, or store timestamps as Unix epochs without manual conversion.

Quick Start

Use the serializer skill to save a User model with JSON‑serialized fields to the database.

Frequently Asked Questions about gorm-serializer

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

FAQPage Schema
How do I store complex Go structures in a single database column using GORM?

To store complex Go structures in a single database column using GORM, you can apply built-in serializers like JSON or GOB to automatically convert types such as slices and maps for storage and later reconstruction.

What is the best way to serialize a map or slice for PostgreSQL in GORM?

The best way to serialize a map or slice for PostgreSQL in GORM is using the built-in JSON or GOB serializers, which provide a standardized strategy to persist complex Go types across supported databases.

Can I create a custom serializer for sensitive fields in GORM models?

Yes, you can create a custom serializer for sensitive fields in GORM by implementing the SerializerInterface with Scan and Value methods, then registering it using schema.RegisterSerializer.

Does GORM support UnixTime serialization for timestamp fields?

Yes, GORM supports UnixTime serialization for timestamp fields through its built-in serializers, allowing you to store timestamps as Unix epochs without manual conversion.

How do I define field-level custom types with embedded serialization logic in GORM?

You can define field-level custom types with embedded serialization logic in GORM by creating types that implement their own serialization behavior, ensuring consistent storage and retrieval of complex data structures.