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/media.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/media.go')
-rw-r--r-- | internal/db/bundb/media.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/db/bundb/media.go b/internal/db/bundb/media.go index a9b60e3ae..80a4f8bbe 100644 --- a/internal/db/bundb/media.go +++ b/internal/db/bundb/media.go @@ -241,7 +241,7 @@ func (m *mediaDB) GetRemoteOlderThan(ctx context.Context, olderThan time.Time, l Column("media_attachment.id"). Where("? = ?", bun.Ident("media_attachment.cached"), true). Where("? < ?", bun.Ident("media_attachment.created_at"), olderThan). - WhereGroup(" AND ", whereNotEmptyAndNotNull("media_attachment.remote_url")). + Where("? IS NOT NULL", bun.Ident("media_attachment.remote_url")). Order("media_attachment.created_at DESC") if limit != 0 { @@ -261,8 +261,8 @@ func (m *mediaDB) CountRemoteOlderThan(ctx context.Context, olderThan time.Time) TableExpr("? AS ?", bun.Ident("media_attachments"), bun.Ident("media_attachment")). Column("media_attachment.id"). Where("? = ?", bun.Ident("media_attachment.cached"), true). - Where("? < ?", bun.Ident("media_attachment.created_at"), olderThan). - WhereGroup(" AND ", whereNotEmptyAndNotNull("media_attachment.remote_url")) + Where("? IS NOT NULL", bun.Ident("media_attachment.remote_url")). + Where("? < ?", bun.Ident("media_attachment.created_at"), olderThan) count, err := q.Count(ctx) if err != nil { |