1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Add changed_after and changed_before options to /v1/entries endpoint

This commit is contained in:
Frédéric Guillot 2023-10-05 20:28:36 -07:00
parent 67eb574fd4
commit fccc25f7a3
5 changed files with 88 additions and 44 deletions

View file

@ -51,15 +51,29 @@ func (e *EntryQueryBuilder) WithStarred(starred bool) *EntryQueryBuilder {
return e
}
// BeforeDate adds a condition < published_at
func (e *EntryQueryBuilder) BeforeDate(date time.Time) *EntryQueryBuilder {
// BeforeChangedDate adds a condition < changed_at
func (e *EntryQueryBuilder) BeforeChangedDate(date time.Time) *EntryQueryBuilder {
e.conditions = append(e.conditions, fmt.Sprintf("e.changed_at < $%d", len(e.args)+1))
e.args = append(e.args, date)
return e
}
// AfterChangedDate adds a condition > changed_at
func (e *EntryQueryBuilder) AfterChangedDate(date time.Time) *EntryQueryBuilder {
e.conditions = append(e.conditions, fmt.Sprintf("e.changed_at > $%d", len(e.args)+1))
e.args = append(e.args, date)
return e
}
// BeforePublishedDate adds a condition < published_at
func (e *EntryQueryBuilder) BeforePublishedDate(date time.Time) *EntryQueryBuilder {
e.conditions = append(e.conditions, fmt.Sprintf("e.published_at < $%d", len(e.args)+1))
e.args = append(e.args, date)
return e
}
// AfterDate adds a condition > published_at
func (e *EntryQueryBuilder) AfterDate(date time.Time) *EntryQueryBuilder {
// AfterPublishedDate adds a condition > published_at
func (e *EntryQueryBuilder) AfterPublishedDate(date time.Time) *EntryQueryBuilder {
e.conditions = append(e.conditions, fmt.Sprintf("e.published_at > $%d", len(e.args)+1))
e.args = append(e.args, date)
return e