Get the latest tech news

Goenums: Type Safe Enum Generator for Go


Type Safe Enum generator for Go. Contribute to zarldev/goenums development by creating an account on GitHub.

Transform basic iota based constants into feature-rich enums with string conversion, validation, JSON handling, database integration, and more. Type Safety: Wrapper types prevent accidental misuse of enum values String Conversion: Automatic string representation and parsing JSON Support: Built-in marshaling and unmarshaling Database Integration: SQL Scanner and Valuer implementations Validation: Methods to check for valid enum values Iteration: Modern Go 1.21+ iteration support with legacy fallback Extensibility: Add custom fields to enums via comments Exhaustive Handling: Helper functions to ensure you handle all enum values Zero Dependencies: Completely dependency-free, using only the Go standard library This allows you to automatically regenerate your enum code whenever your source files change, integrating smoothly into your existing build process.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of safe enum generator

safe enum generator

Photo of goenums

goenums