Skip to content

Commit

Permalink
Merge pull request #1396 from 090809/similar-to-psql
Browse files Browse the repository at this point in the history
feat: add similar to for psql ref #1391
  • Loading branch information
stephenafamo authored Jun 26, 2024
2 parents 4b7da0d + 9014766 commit 77666a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- define "where_similarto_override" -}}
{{$name := printf "whereHelper%s" (goVarname .Type)}}
func (w {{$name}}) SIMILAR(x {{.Type}}) qm.QueryMod { return qm.Where(w.field+" SIMILAR TO ?", x) }
func (w {{$name}}) NSIMILAR(x {{.Type}}) qm.QueryMod { return qm.Where(w.field+" NOT SIMILAR TO ?", x) }
{{- end -}}
1 change: 1 addition & 0 deletions templates/main/00_struct.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (w {{$name}}) GTE(x {{.Type}}) qm.QueryMod { return qmhelper.Where(w.field,
func (w {{$name}}) LIKE(x {{.Type}}) qm.QueryMod { return qm.Where(w.field+" LIKE ?", x) }
func (w {{$name}}) NLIKE(x {{.Type}}) qm.QueryMod { return qm.Where(w.field+" NOT LIKE ?", x) }
{{- block "where_ilike_override" . }}{{- end}}
{{- block "where_similarto_override" . }}{{- end}}
{{end -}}
{{if or (isPrimitive .Type) (isNullPrimitive .Type) (isEnumDBType .DBType) -}}
func (w {{$name}}) IN(slice []{{convertNullToPrimitive .Type}}) qm.QueryMod {
Expand Down

0 comments on commit 77666a3

Please sign in to comment.