summaryrefslogtreecommitdiff
path: root/internal/db/pg/pg.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-05-29 19:39:43 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-29 19:39:43 +0200
commit1fe5e36ac3a631a53724fe99583b7f11baa32c53 (patch)
tree40ae75c3613c9c6915273f98fe7ce41046d11381 /internal/db/pg/pg.go
parentfederate account updates (diff)
downloadgotosocial-1fe5e36ac3a631a53724fe99583b7f11baa32c53.tar.xz
Search (#36)
First implementation of search functionality for remote account and status lookups.
Diffstat (limited to 'internal/db/pg/pg.go')
-rw-r--r--internal/db/pg/pg.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/db/pg/pg.go b/internal/db/pg/pg.go
index 64d6fb636..f352404aa 100644
--- a/internal/db/pg/pg.go
+++ b/internal/db/pg/pg.go
@@ -223,7 +223,12 @@ func (ps *postgresService) GetWhere(where []db.Where, i interface{}) error {
q := ps.conn.Model(i)
for _, w := range where {
- q = q.Where("? = ?", pg.Safe(w.Key), w.Value)
+ if w.CaseInsensitive {
+ q = q.Where("LOWER(?) = LOWER(?)", pg.Safe(w.Key), w.Value)
+ } else {
+ q = q.Where("? = ?", pg.Safe(w.Key), w.Value)
+ }
+
}
if err := q.Select(); err != nil {
@@ -1143,7 +1148,6 @@ func (ps *postgresService) GetNotificationsForAccount(accountID string, limit in
q := ps.conn.Model(&notifications).Where("target_account_id = ?", accountID)
-
if maxID != "" {
n := &gtsmodel.Notification{}
if err := ps.conn.Model(n).Where("id = ?", maxID).Select(); err != nil {