mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
schema/field: add Comparable method to TypeInfo (#576)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user