entc/gen: skip Table() predicate and warn about reserved schema name (Client) (#2486)

* entc/gen: do no generate `Table()` predicate and warn the user in case of reserved schema name like `Client`.

* doc/md: document reserved schema name

* doc/md: revert reserved schema name as this was already working

* doc/md: rephrase
This commit is contained in:
MasseElch
2022-04-20 16:30:59 +02:00
committed by GitHub
parent 4e1affecbc
commit 2c8e58ce94
17 changed files with 630 additions and 3 deletions

View File

@@ -41,7 +41,7 @@ func ID(id {{ $.ID.Type }}) predicate.{{ $.Name }} {
{{/* JSON cannot be compared using "=" and Enum has a type defined with the field name */}}
{{ $hasP := not (or $f.IsJSON $f.IsEnum) }}
{{ $comparable := or $f.ConvertedToBasic $f.Type.Valuer }}
{{ $undeclared := (and (ne $func "Label") (ne $func "Hooks") (ne $func "Policy")) }}
{{ $undeclared := (and (ne $func "Label") (ne $func "Hooks") (ne $func "Policy") (ne $func "Table")) }}
{{- if and $hasP $comparable $undeclared }}
{{ $arg := "v" }}
// {{ $func }} applies equality check predicate on the {{ quote $f.Name }} field. It's identical to {{ $func }}EQ.