able to get product

This commit is contained in:
Gitea
2023-11-30 00:39:51 +03:00
parent 606b94e35b
commit 414dc87091
19 changed files with 2204 additions and 77 deletions

View File

@ -0,0 +1,11 @@
package xdefault
import "reflect"
func WithFallback[T comparable](value, fallback T) T {
if reflect.ValueOf(value).IsZero() {
return fallback
}
return value
}