schema/field: fix uuid import path config

This commit is contained in:
Ariel Mashraki
2021-04-25 18:14:51 +03:00
committed by Ariel Mashraki
parent 8979de939e
commit 43e74a334f
2 changed files with 5 additions and 1 deletions

View File

@@ -131,7 +131,7 @@ func UUID(name string, typ driver.Valuer) *uuidBuilder {
Type: TypeUUID,
Nillable: true,
Ident: rt.String(),
PkgPath: rt.PkgPath(),
PkgPath: indirect(rt).PkgPath(),
},
}}
}

View File

@@ -523,6 +523,10 @@ func TestField_UUID(t *testing.T) {
assert.Equal(t, "comment", fd.Comment)
assert.True(t, fd.Nillable)
fd = field.UUID("id", &uuid.UUID{}).
Descriptor()
assert.Equal(t, "github.com/google/uuid", fd.Info.PkgPath)
fd = field.UUID("id", uuid.UUID{}).
Default(uuid.UUID{}).
Descriptor()