mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: support default id values for edge schemas (#2688)
This commit is contained in:
@@ -177,6 +177,11 @@ func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) ({{ $ret }}
|
||||
{{ if or $.NumHooks $.NumPolicy }}_ = {{ end }}createE.defaults()
|
||||
_, specE := createE.createSpec()
|
||||
edge.Target.Fields = specE.Fields
|
||||
{{- if and .HasOneFieldID .ID.Default }}
|
||||
if specE.ID.Value != nil {
|
||||
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
|
||||
}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user