Version 0.5.0
Breaking Changes
SQL support now requires the -sql flag (previously generated by default)
- Before: SQL interfaces were always generated
- After: SQL interfaces only generated when
-sqlflag is provided - Migration: Add
-sqlto yourgo:generatedirectives if using SQL databases
New Features
- MongoDB BSON support (
-bsonflag): Generates proper BSON marshal/unmarshal methods - YAML support (
-yamlflag): Generates yaml.v3 marshal/unmarshal methods - Conditional code generation: All database/serialization features are now opt-in
Bug Fixes
- Fixed MongoDB storage issue where enums were stored as empty documents instead of strings
- Fixed handling of negative enum values (e.g.,
PriorityNone = -1) - Fixed SQL NULL handling to use zero value when available
Improvements
- Added comprehensive integration tests with real databases (MongoDB via testcontainers, SQLite)
- Improved test coverage to 99.6%
- Added runtime verification tests
- Updated documentation and examples
Usage Examples
# Basic enum (no database support)
go run github.com/go-pkgz/enum@latest -type status -lower
# With SQL support (REQUIRED if you use SQL databases)
go run github.com/go-pkgz/enum@latest -type status -sql
# With MongoDB support
go run github.com/go-pkgz/enum@latest -type status -bson -lower
# With all features
go run github.com/go-pkgz/enum@latest -type status -sql -bson -yaml -lower