What problem does it solve?
This Skill helps address the challenge of transforming struct fields during database interactions, such as encryption or compression, without altering the Go type, ensuring both type safety and efficiency.
Core Features & Use Cases
- Transparent Field Transformation: Encode/decode fields without altering the Go type or wrapping every read/write operation.
- Codec Registration: Easily register custom codecs with a specific tag to transform data as needed.
- Built-in Codecs: Utilize built-in codecs for JSON, GOB, and Unix Time.
- Use Case: For example, storing an encrypted field with a
[]byte type without wrapping the entire field and affecting type safety.
Quick Start
Register a custom codec for field encryption using 'codec.Register("secretbox", codec.Func(...))' and tag the field 'orm:"value,codec:secretbox"'.