mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/load: add schema-type field for schema (#459)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -35,22 +35,23 @@ type Position struct {
|
||||
|
||||
// Field represents an ent.Field that was loaded from a complied user package.
|
||||
type Field struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Info *field.TypeInfo `json:"type,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Size *int64 `json:"size,omitempty"`
|
||||
Enums []string `json:"enums,omitempty"`
|
||||
Unique bool `json:"unique,omitempty"`
|
||||
Nillable bool `json:"nillable,omitempty"`
|
||||
Optional bool `json:"optional,omitempty"`
|
||||
Default bool `json:"default,omitempty"`
|
||||
DefaultValue interface{} `json:"default_value,omitempty"`
|
||||
UpdateDefault bool `json:"update_default,omitempty"`
|
||||
Immutable bool `json:"immutable,omitempty"`
|
||||
Validators int `json:"validators,omitempty"`
|
||||
StorageKey string `json:"storage_key,omitempty"`
|
||||
Position *Position `json:"position,omitempty"`
|
||||
Sensitive bool `json:"sensitive,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Info *field.TypeInfo `json:"type,omitempty"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
Size *int64 `json:"size,omitempty"`
|
||||
Enums []string `json:"enums,omitempty"`
|
||||
Unique bool `json:"unique,omitempty"`
|
||||
Nillable bool `json:"nillable,omitempty"`
|
||||
Optional bool `json:"optional,omitempty"`
|
||||
Default bool `json:"default,omitempty"`
|
||||
DefaultValue interface{} `json:"default_value,omitempty"`
|
||||
UpdateDefault bool `json:"update_default,omitempty"`
|
||||
Immutable bool `json:"immutable,omitempty"`
|
||||
Validators int `json:"validators,omitempty"`
|
||||
StorageKey string `json:"storage_key,omitempty"`
|
||||
Position *Position `json:"position,omitempty"`
|
||||
Sensitive bool `json:"sensitive,omitempty"`
|
||||
SchemaType map[string]string `json:"schema_type,omitempty"`
|
||||
}
|
||||
|
||||
// Edge represents an ent.Edge that was loaded from a complied user package.
|
||||
@@ -106,6 +107,7 @@ func NewField(fd *field.Descriptor) (*Field, error) {
|
||||
StorageKey: fd.StorageKey,
|
||||
Validators: len(fd.Validators),
|
||||
Sensitive: fd.Sensitive,
|
||||
SchemaType: fd.SchemaType,
|
||||
}
|
||||
if sf.Info == nil {
|
||||
return nil, fmt.Errorf("missing type info for field %q", sf.Name)
|
||||
|
||||
Reference in New Issue
Block a user