Skip to content

Version 0.5.0

Choose a tag to compare

@umputun umputun released this 02 Sep 00:08
· 14 commits to master since this release
8483a46

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 -sql flag is provided
  • Migration: Add -sql to your go:generate directives if using SQL databases

New Features

  • MongoDB BSON support (-bson flag): Generates proper BSON marshal/unmarshal methods
  • YAML support (-yaml flag): 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