mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
schema/field: reject pointers for basic types (#505)
This commit is contained in:
@@ -728,7 +728,7 @@ func (d *Descriptor) goType(typ interface{}, expectKind reflect.Kind) {
|
||||
info.Nillable = true
|
||||
}
|
||||
switch {
|
||||
case tv.Kind() == expectKind:
|
||||
case t.Kind() == expectKind:
|
||||
case t.Implements(valueScannerType):
|
||||
n := t.NumMethod()
|
||||
for i := 0; i < n; i++ {
|
||||
|
||||
@@ -146,6 +146,8 @@ func TestString(t *testing.T) {
|
||||
assert.Error(t, fd.Err())
|
||||
fd = field.String("name").GoType(struct{}{}).Descriptor()
|
||||
assert.Error(t, fd.Err())
|
||||
fd = field.String("name").GoType(new(http.Dir)).Descriptor()
|
||||
assert.Error(t, fd.Err())
|
||||
}
|
||||
|
||||
func TestTime(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user