v0.0.542
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m9s

This commit is contained in:
2024-11-07 13:13:12 +01:00
parent 9b2028ab54
commit 8a92a6cc52
2 changed files with 10 additions and 2 deletions

View File

@@ -10,6 +10,14 @@ type JsonOpt[T any] struct {
value T
}
func NewJsonOpt[T any](v T) JsonOpt[T] {
return JsonOpt[T]{isSet: true, value: v}
}
func EmptyJsonOpt[T any]() JsonOpt[T] {
return JsonOpt[T]{isSet: false}
}
// MarshalJSON returns m as the JSON encoding of m.
func (m JsonOpt[T]) MarshalJSON() ([]byte, error) {
if !m.isSet {