Skip to content

Commit 0795de0

Browse files
committed
create a feed query builder
1 parent 926ddf6 commit 0795de0

File tree

5 files changed

+336
-303
lines changed

5 files changed

+336
-303
lines changed

model/feed.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ import (
1515

1616
// List of supported schedulers.
1717
const (
18-
SchedulerRoundRobin = "round_robin"
19-
SchedulerEntryFrequency = "entry_frequency"
18+
SchedulerRoundRobin = "round_robin"
19+
SchedulerEntryFrequency = "entry_frequency"
20+
// Default settings for the feed query builder
21+
DefaultFeedSorting = "parsing_error_count"
22+
DefaultFeedSortingDirection = "desc"
2023
)
2124

2225
// Feed represents a feed in the application.

storage/entry.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ func (s *Storage) CountAllEntries() map[string]int64 {
2626
defer rows.Close()
2727

2828
results := make(map[string]int64)
29-
results["unread"] = 0
30-
results["read"] = 0
31-
results["removed"] = 0
29+
results[model.EntryStatusUnread] = 0
30+
results[model.EntryStatusRead] = 0
31+
results[model.EntryStatusRemoved] = 0
3232

3333
for rows.Next() {
3434
var status string
@@ -41,7 +41,7 @@ func (s *Storage) CountAllEntries() map[string]int64 {
4141
results[status] = count
4242
}
4343

44-
results["total"] = results["unread"] + results["read"] + results["removed"]
44+
results["total"] = results[model.EntryStatusUnread] + results[model.EntryStatusRead] + results[model.EntryStatusRemoved]
4545
return results
4646
}
4747

storage/entry_query_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
269269
entries := make(model.Entries, 0)
270270
for rows.Next() {
271271
var entry model.Entry
272-
var iconID interface{}
272+
var iconID sql.NullInt64
273273
var tz string
274274

275275
entry.Feed = &model.Feed{}

0 commit comments

Comments
 (0)