You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package misc
|
|
|
|
// Fallback 当值为空时返回默认值
|
|
func Fallback[T any](v T, fs ...T) T {
|
|
if !IsZero(v) {
|
|
return v
|
|
}
|
|
for _, f := range fs {
|
|
if !IsZero(f) {
|
|
return f
|
|
}
|
|
}
|
|
return v
|
|
}
|
|
|