entql: add driver.Valuer to generated predicates

This commit is contained in:
Ariel Mashraki
2020-12-01 16:20:30 +02:00
committed by Ariel Mashraki
parent 1270ba1bd8
commit a20ce535d1
42 changed files with 1371 additions and 33 deletions

View File

@@ -117,7 +117,7 @@ type predicateAdder interface {
{{ range $f := $n.Fields }}
{{ $type := $f.Type.Type.String }}
{{ $iface := print (pascal $type) "P" }}
{{ if $f.IsTime }}{{ $iface = "TimeP" }}{{ else if $f.IsBytes }}{{ $iface = "BytesP" }}{{ end }}
{{ if $f.IsTime }}{{ $iface = "TimeP" }}{{ else if $f.IsBytes }}{{ $iface = "BytesP" }}{{ else if $f.IsUUID }}{{ $iface = "ValueP" }}{{ end }}
// Where{{ $f.StructField }} applies the entql {{ $type }} predicate on the {{ $f.Name }} field.
func (f *{{ $filter }}) Where{{ $f.StructField }}(p entql.{{ $iface }}) {
f.Where(p.Field({{ $n.Package }}.{{ $f.Constant }}))