Add test for webhook (#29755)

Follow #29690
This commit is contained in:
wxiaoguang
2024-03-14 09:10:51 +08:00
committed by GitHub
parent 83ba882bab
commit 43de021ac1
2 changed files with 38 additions and 49 deletions

View File

@ -212,3 +212,12 @@ func ToFloat64(number any) (float64, error) {
func ToPointer[T any](val T) *T {
return &val
}
// IfZero returns "def" if "v" is a zero value, otherwise "v"
func IfZero[T comparable](v, def T) T {
var zero T
if v == zero {
return def
}
return v
}