Generics & more
- Now a Go module under the path
github.com/guregu/null/v5⚠️ Please use this instead of from the formergopkg.inpath.- Previously this package didn't use modules to support ancient pre-go mod environments, but now module support is required.
- Added missing types from
database/sql:Int32, Int16, Byte - Added generic
Value[T]embeddingsql.Null[T]- Note that
zero.Value[T]requires thatTiscomparable.null.Value[T]supports any value. - This doesn't support TextMarshaler because there's no generic way to support all types (e.g. structs). We could support some types but I'm not sure if that's useful.
- This type requires Go version ≥1.22, on lower versions it won't be present
- Note that
Behavior from v4 is unchanged, so it should be an easy upgrade.
Thank you and enjoy.
What's Changed
Full Changelog: v4.0.0...v5.0.0