v0.0.544
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m0s

This commit is contained in:
2024-11-26 15:10:27 +01:00
parent d9517fe73c
commit 27cc9366b5
4 changed files with 22 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package dataext
import (
"encoding/json"
"errors"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
)
type JsonOpt[T any] struct {
@@ -59,6 +60,13 @@ func (m JsonOpt[T]) ValueOrNil() *T {
return &m.value
}
func (m JsonOpt[T]) ValueDblPtrOrNil() **T {
if !m.isSet {
return nil
}
return langext.DblPtr(m.value)
}
func (m JsonOpt[T]) MustValue() T {
if !m.isSet {
panic("value not set")