entc: improve generated comments for edges and fields (#2632)

* replace default field comment with user comment if defined
* use comments defined on edges in generated entities
* add docs for comment method on edges and fields
* update integration to reflect above changes
This commit is contained in:
Will Bicks
2022-06-13 08:52:47 -04:00
committed by GitHub
parent 1572f1eb14
commit cd1afb235c
24 changed files with 88 additions and 31 deletions

View File

@@ -73,6 +73,7 @@ type Edge struct {
Required bool `json:"required,omitempty"`
StorageKey *edge.StorageKey `json:"storage_key,omitempty"`
Annotations map[string]interface{} `json:"annotations,omitempty"`
Comment string `json:"comment,omitempty"`
}
// Index represents an ent.Index that was loaded from a complied user package.
@@ -97,6 +98,7 @@ func NewEdge(ed *edge.Descriptor) *Edge {
RefName: ed.RefName,
Through: ed.Through,
StorageKey: ed.StorageKey,
Comment: ed.Comment,
Annotations: make(map[string]interface{}),
}
for _, at := range ed.Annotations {