Closed ilopmar closed 10 years ago
Sometimes you have to write a criteria matching an array of arguments using pgArrayContains. But if the array is empty you have to use pgArrayIsEmpty. Check the example:
pgArrayContains
pgArrayIsEmpty
xxxxx.withCriteria { if (tagList) { pgArrayContains 'tags', tagList } else { pgArrayIsEmpty 'tags' } }
It would be nice if the previous criteria could be written like this:
xxxxx.withCriteria { pgArrayIsEmptyOrContains 'tags', tagList }
And if tagList is empty it use pgArrayIsEmpty but if not it use pgArrayContains under the hood.
tagList
Created in release 0.6.6: https://github.com/kaleidos/grails-postgresql-extensions/releases/tag/0.6.6
Sometimes you have to write a criteria matching an array of arguments using
pgArrayContains
. But if the array is empty you have to usepgArrayIsEmpty
. Check the example:It would be nice if the previous criteria could be written like this:
And if
tagList
is empty it usepgArrayIsEmpty
but if not it usepgArrayContains
under the hood.