mirror of
https://github.com/ent/ent.git
synced 2026-04-28 05:30:56 +03:00
entc/gen/template: allow mutating the sqlgraph.EdgeQuerySpec by ent extensions or user templates
This commit is contained in:
committed by
Ariel Mashraki
parent
d1db24d13f
commit
0f78dfe1c0
File diff suppressed because one or more lines are too long
@@ -168,6 +168,7 @@ var (
|
||||
"dialect/additional/*",
|
||||
"dialect/*/import/additional/*",
|
||||
"dialect/*/*/spec/*",
|
||||
"dialect/*/*/*/spec/*",
|
||||
}
|
||||
// templates holds the Go templates for the code generation.
|
||||
templates *Template
|
||||
|
||||
@@ -255,6 +255,12 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery() *sql.Selector {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
{{- /* Allow mutating the sqlgraph.EdgeQuerySpec by ent extensions or user templates.*/}}
|
||||
{{- with $tmpls := matchTemplate "dialect/sql/query/eagerloading/spec/*" }}
|
||||
{{- range $tmpl := $tmpls }}
|
||||
{{- xtemplate $tmpl $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
if err := sqlgraph.QueryEdges(ctx, {{ $receiver }}.driver, _spec); err != nil {
|
||||
return nil, fmt.Errorf(`query edges "{{ $e.Name }}": %v`, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user