schema/field: add Comparable method to TypeInfo (#576)

This commit is contained in:
Ariel Mashraki
2020-07-02 16:34:34 +03:00
committed by GitHub
parent 372ccf79aa
commit 5e58b094d8

View File

@@ -111,6 +111,16 @@ func (t TypeInfo) ValueScanner() bool {
return t.RType.implements(valueScannerType)
}
// Comparable reports whether values of this type are comparable.
func (t TypeInfo) Comparable() bool {
switch t.Type {
case TypeBool, TypeTime, TypeUUID, TypeEnum, TypeString:
return true
default:
return t.Numeric()
}
}
var stringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
// Stringer indicates if this type implements the Stringer interface.