Skip to content

Commit

Permalink
Merge pull request #42 from korora-tech/main
Browse files Browse the repository at this point in the history
feat: add "and" logical operator
  • Loading branch information
muratmirgun authored Jan 8, 2024
2 parents c5401e9 + 7f14802 commit f84277b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions filterbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ func (f *FilterBuilder) Filter(column, operator, value string) *FilterBuilder {
return f
}

func (f *FilterBuilder) And(filters, foreignTable string) *FilterBuilder {
if foreignTable != "" {
f.params[foreignTable+".and"] = fmt.Sprintf("(%s)", filters)
} else {
f.params[foreignTable+"and"] = fmt.Sprintf("(%s)", filters)
}
return f
}

func (f *FilterBuilder) Or(filters, foreignTable string) *FilterBuilder {
if foreignTable != "" {
f.params[foreignTable+".or"] = fmt.Sprintf("(%s)", filters)
Expand Down

0 comments on commit f84277b

Please sign in to comment.