v0.0.409
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m41s

This commit is contained in:
Mike Schwörer 2024-03-11 17:05:10 +01:00
parent 645113d553
commit 401aad9fa4
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 71 additions and 7 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.408"
const GoextVersion = "0.0.409"
const GoextVersionTimestamp = "2024-03-11T16:41:47+0100"
const GoextVersionTimestamp = "2024-03-11T17:05:10+0100"

View File

@ -5,12 +5,76 @@ import (
"time"
)
func Coalesce[T any](v *T, def T) T {
if v == nil {
return def
} else {
return *v
func Coalesce[T any](v1 *T, def T) T {
if v1 != nil {
return *v1
}
return def
}
func CoalesceOpt[T any](v1 *T, v2 *T) *T {
if v1 != nil {
return v1
}
return v2
}
func Coalesce3[T any](v1 *T, v2 *T, def T) T {
if v1 != nil {
return *v1
}
if v2 != nil {
return *v2
}
return def
}
func Coalesce3Opt[T any](v1 *T, v2 *T, v3 *T) *T {
if v1 != nil {
return v1
}
if v2 != nil {
return v2
}
return v3
}
func Coalesce4[T any](v1 *T, v2 *T, v3 *T, def T) T {
if v1 != nil {
return *v1
}
if v2 != nil {
return *v2
}
if v3 != nil {
return *v3
}
return def
}
func Coalesce4Opt[T any](v1 *T, v2 *T, v3 *T, v4 *T) *T {
if v1 != nil {
return v1
}
if v2 != nil {
return v2
}
if v3 != nil {
return v3
}
return v4
}
func CoalesceString(s *string, def string) string {