fever write api [wip]

This commit is contained in:
Nazar Kanaev
2020-10-25 16:29:26 +00:00
parent 40a9773beb
commit b0364087ad
3 changed files with 46 additions and 2 deletions

View File

@@ -67,6 +67,13 @@ type ItemFilter struct {
SinceID *int64
}
type MarkFilter struct {
FolderID *int64
FeedID *int64
Before *time.Time
}
func (s *Storage) CreateItems(items []Item) bool {
tx, err := s.db.Begin()
if err != nil {
@@ -240,7 +247,7 @@ func (s *Storage) UpdateItemStatus(item_id int64, status ItemStatus) bool {
return err == nil
}
func (s *Storage) MarkItemsRead(filter ItemFilter) bool {
func (s *Storage) MarkItemsRead(filter MarkFilter) bool {
cond := make([]string, 0)
args := make([]interface{}, 0)
@@ -252,6 +259,7 @@ func (s *Storage) MarkItemsRead(filter ItemFilter) bool {
cond = append(cond, "i.feed_id = ?")
args = append(args, *filter.FeedID)
}
// TODO: filter.Before
predicate := "1"
if len(cond) > 0 {
predicate = strings.Join(cond, " and ")