mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: derive the id-type from the schema (#823)
if it was not provided
This commit is contained in:
@@ -160,11 +160,15 @@ type (
|
||||
|
||||
// NewType creates a new type and its fields from the given schema.
|
||||
func NewType(c *Config, schema *load.Schema) (*Type, error) {
|
||||
idType := c.IDType
|
||||
if idType == nil {
|
||||
idType = defaultIDType
|
||||
}
|
||||
typ := &Type{
|
||||
Config: c,
|
||||
ID: &Field{
|
||||
Name: "id",
|
||||
Type: c.IDType,
|
||||
Type: idType,
|
||||
StructTag: structTag("id", ""),
|
||||
},
|
||||
schema: schema,
|
||||
|
||||
Reference in New Issue
Block a user