Skip to content
Snippets Groups Projects
Commit f12c0a26 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Added ValueFromPointer

parent 4068ac11
No related branches found
No related tags found
No related merge requests found
...@@ -157,3 +157,11 @@ func MergeMaps(maps ...map[string]string) map[string]string { ...@@ -157,3 +157,11 @@ func MergeMaps(maps ...map[string]string) map[string]string {
func PointerValue[V any](value V) *V { func PointerValue[V any](value V) *V {
return &value return &value
} }
func ValueFromPointer[V any](value *V) V {
if value != nil {
return *value
}
return *new(V) // zero value of V
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment