mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: add support for WithNamed<E> feature-flag (#2792)
* entc/gen: struct fields and methods for NamedEdge api * entc/gen: generate WithNamedEdge methods for named-edges * entc/gen: implement eager-loading for named-edges * entc/gen: simplify eager-loading template * entc/gen: drop support for unqiue edges in named-based loading * all: codegen * doc/website: named-edges feature-flag * Update doc/md/eager-load.mdx * Update doc/md/eager-load.mdx
This commit is contained in:
@@ -46,8 +46,7 @@ type FileEdges struct {
|
||||
func (e FileEdges) ParentOrErr() (*File, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.Parent == nil {
|
||||
// The edge parent was loaded in eager-loading,
|
||||
// but was not found.
|
||||
// Edge was loaded but was not found.
|
||||
return nil, &NotFoundError{label: file.Label}
|
||||
}
|
||||
return e.Parent, nil
|
||||
|
||||
@@ -22,13 +22,12 @@ import (
|
||||
// FileQuery is the builder for querying File entities.
|
||||
type FileQuery struct {
|
||||
config
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
predicates []predicate.File
|
||||
// eager-loading edges.
|
||||
limit *int
|
||||
offset *int
|
||||
unique *bool
|
||||
order []OrderFunc
|
||||
fields []string
|
||||
predicates []predicate.File
|
||||
withParent *FileQuery
|
||||
withChildren *FileQuery
|
||||
// intermediate query (i.e. traversal path).
|
||||
|
||||
Reference in New Issue
Block a user