diff --git a/tw/twmodel/helpers.go b/tw/twmodel/helpers.go index a9ffd19..087be55 100644 --- a/tw/twmodel/helpers.go +++ b/tw/twmodel/helpers.go @@ -1,40 +1,9 @@ package twmodel import ( - "time" + "reflect" ) func isZero(v interface{}) bool { - switch c := v.(type) { - case string: - return c == "" - case *string, - []string, - []VersionCode, - []ServerStatus, - *int: - return c == nil - case int: - return c == 0 - case []int: - return c == nil - case float64: - return c == 0 - case *float64: - return c == nil - case float32: - return c == 0 - case *float32: - return c == nil - case bool: - return !c - case *bool: - return c == nil - case time.Time: - return c.IsZero() - case *time.Time: - return c == nil - default: - return false - } + return reflect.ValueOf(v).IsZero() }