diff options
author | 2023-07-05 12:34:37 +0200 | |
---|---|---|
committer | 2023-07-05 12:34:37 +0200 | |
commit | d9c69f6ce05daddf2f6d5d8c6c03b4c3d55df93a (patch) | |
tree | 7ee20e4665bdad322321dc10f59175f7b076a7ba /internal/db/bundb/util.go | |
parent | [chore/bugfix] Break Websockets logic into smaller read/write functions, don'... (diff) | |
download | gotosocial-d9c69f6ce05daddf2f6d5d8c6c03b4c3d55df93a.tar.xz |
[chore/performance] Remove remaining 'whereEmptyOrNull' funcs (#1946)
Diffstat (limited to 'internal/db/bundb/util.go')
-rw-r--r-- | internal/db/bundb/util.go | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/internal/db/bundb/util.go b/internal/db/bundb/util.go index a656a41c3..06bb289d3 100644 --- a/internal/db/bundb/util.go +++ b/internal/db/bundb/util.go @@ -22,34 +22,6 @@ import ( "github.com/uptrace/bun" ) -// whereEmptyOrNull is a convenience function to return a bun WhereGroup that specifies -// that the given column should be EITHER an empty string OR null. -// -// Use it as follows: -// -// q = q.WhereGroup(" AND ", whereEmptyOrNull("whatever_column")) -func whereEmptyOrNull(column string) func(*bun.SelectQuery) *bun.SelectQuery { - return func(q *bun.SelectQuery) *bun.SelectQuery { - return q. - WhereOr("? IS NULL", bun.Ident(column)). - WhereOr("? = ''", bun.Ident(column)) - } -} - -// whereNotEmptyAndNotNull is a convenience function to return a bun WhereGroup that specifies -// that the given column should be NEITHER an empty string NOR null. -// -// Use it as follows: -// -// q = q.WhereGroup(" AND ", whereNotEmptyAndNotNull("whatever_column")) -func whereNotEmptyAndNotNull(column string) func(*bun.SelectQuery) *bun.SelectQuery { - return func(q *bun.SelectQuery) *bun.SelectQuery { - return q. - Where("? IS NOT NULL", bun.Ident(column)). - Where("? != ''", bun.Ident(column)) - } -} - // updateWhere parses []db.Where and adds it to the given update query. func updateWhere(q *bun.UpdateQuery, where []db.Where) { for _, w := range where { |