mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Minor concatenation-related simplifications in internal/storage/
Use plain strings concatenation instead of building an array and then joining it.
This commit is contained in:
parent
863a5b3648
commit
e2ee74428a
3 changed files with 14 additions and 16 deletions
|
@ -60,18 +60,16 @@ func (b *BatchBuilder) WithoutDisabledFeeds() *BatchBuilder {
|
|||
}
|
||||
|
||||
func (b *BatchBuilder) FetchJobs() (jobs model.JobList, err error) {
|
||||
var parts []string
|
||||
parts = append(parts, `SELECT id, user_id FROM feeds`)
|
||||
query := `SELECT id, user_id FROM feeds`
|
||||
|
||||
if len(b.conditions) > 0 {
|
||||
parts = append(parts, fmt.Sprintf("WHERE %s", strings.Join(b.conditions, " AND ")))
|
||||
query += fmt.Sprintf(" WHERE %s", strings.Join(b.conditions, " AND "))
|
||||
}
|
||||
|
||||
if b.limit > 0 {
|
||||
parts = append(parts, fmt.Sprintf("ORDER BY next_check_at ASC LIMIT %d", b.limit))
|
||||
query += fmt.Sprintf(" ORDER BY next_check_at ASC LIMIT %d", b.limit)
|
||||
}
|
||||
|
||||
query := strings.Join(parts, " ")
|
||||
rows, err := b.db.Query(query, b.args...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`store: unable to fetch batch of jobs: %v`, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue