entc/gen/features/multischema: pass schema to count query (#1390)

Fixed #1385
This commit is contained in:
Ariel Mashraki
2021-03-25 13:48:32 +02:00
committed by GitHub
parent d62b810096
commit 2d09c8f846
6 changed files with 17 additions and 2 deletions

View File

@@ -78,6 +78,12 @@ func ({{ $receiver }} *{{ $builder }}) sqlAll(ctx context.Context) ([]*{{ $.Name
func ({{ $receiver }} *{{ $builder }}) sqlCount(ctx context.Context) (int, error) {
_spec := {{ $receiver }}.querySpec()
{{- /* Allow mutating the sqlgraph.QuerySpec by ent extensions or user templates.*/}}
{{- with $tmpls := matchTemplate "dialect/sql/query/spec/*" }}
{{- range $tmpl := $tmpls }}
{{- xtemplate $tmpl $ }}
{{- end }}
{{- end }}
return sqlgraph.CountNodes(ctx, {{ $receiver }}.driver, _spec)
}