From e4fe82dd7f498cc7be0c5203b66588cef5cd765e Mon Sep 17 00:00:00 2001 From: jiftechnify Date: Sat, 15 Jul 2023 11:12:35 +0900 Subject: [PATCH] keep up with the latest specs for since/until filter --- storage/elasticsearch/query.go | 4 ++-- storage/postgresql/query.go | 4 ++-- storage/sqlite3/query.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/elasticsearch/query.go b/storage/elasticsearch/query.go index 4c28530..59ffdd6 100644 --- a/storage/elasticsearch/query.go +++ b/storage/elasticsearch/query.go @@ -74,12 +74,12 @@ func buildDsl(filter *nostr.Filter) ([]byte, error) { // since if filter.Since != nil { - dsl.Must(esquery.Range("event.created_at").Gt(filter.Since)) + dsl.Must(esquery.Range("event.created_at").Gte(filter.Since)) } // until if filter.Until != nil { - dsl.Must(esquery.Range("event.created_at").Lt(filter.Until)) + dsl.Must(esquery.Range("event.created_at").Lte(filter.Until)) } // search diff --git a/storage/postgresql/query.go b/storage/postgresql/query.go index 2b615b0..5c217f5 100644 --- a/storage/postgresql/query.go +++ b/storage/postgresql/query.go @@ -159,11 +159,11 @@ func (b PostgresBackend) queryEventsSql(filter *nostr.Filter, doCount bool) (str } if filter.Since != nil { - conditions = append(conditions, "created_at > ?") + conditions = append(conditions, "created_at >= ?") params = append(params, filter.Since) } if filter.Until != nil { - conditions = append(conditions, "created_at < ?") + conditions = append(conditions, "created_at <= ?") params = append(params, filter.Until) } diff --git a/storage/sqlite3/query.go b/storage/sqlite3/query.go index 67031c9..802b360 100644 --- a/storage/sqlite3/query.go +++ b/storage/sqlite3/query.go @@ -154,11 +154,11 @@ func queryEventsSql(filter *nostr.Filter, doCount bool) (string, []any, error) { } if filter.Since != nil { - conditions = append(conditions, "created_at > ?") + conditions = append(conditions, "created_at >= ?") params = append(params, filter.Since) } if filter.Until != nil { - conditions = append(conditions, "created_at < ?") + conditions = append(conditions, "created_at <= ?") params = append(params, filter.Until) } if filter.Search != "" {