mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-26 10:20:29 +00:00
Merge pull request #1702 from strk/pgsql-fix
Fix PostgreSQL error on empty repository list
This commit is contained in:
commit
59b0200412
2 changed files with 12 additions and 3 deletions
|
@ -24,6 +24,7 @@ func (db *datastore) GetRepoListOf(listof []*model.RepoLite) ([]*model.Repo, err
|
||||||
repos []*model.Repo
|
repos []*model.Repo
|
||||||
args []interface{}
|
args []interface{}
|
||||||
stmt string
|
stmt string
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
switch meddler.Default {
|
switch meddler.Default {
|
||||||
case meddler.PostgreSQL:
|
case meddler.PostgreSQL:
|
||||||
|
@ -31,7 +32,9 @@ func (db *datastore) GetRepoListOf(listof []*model.RepoLite) ([]*model.Repo, err
|
||||||
default:
|
default:
|
||||||
stmt, args = toList(listof)
|
stmt, args = toList(listof)
|
||||||
}
|
}
|
||||||
err := meddler.QueryAll(db, &repos, fmt.Sprintf(repoListOfQuery, stmt), args...)
|
if len(args) > 0 {
|
||||||
|
err = meddler.QueryAll(db, &repos, fmt.Sprintf(repoListOfQuery, stmt), args...)
|
||||||
|
}
|
||||||
return repos, err
|
return repos, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ func (db *datastore) GetUserFeed(listof []*model.RepoLite) ([]*model.Feed, error
|
||||||
feed []*model.Feed
|
feed []*model.Feed
|
||||||
args []interface{}
|
args []interface{}
|
||||||
stmt string
|
stmt string
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
switch meddler.Default {
|
switch meddler.Default {
|
||||||
case meddler.PostgreSQL:
|
case meddler.PostgreSQL:
|
||||||
|
@ -37,7 +38,9 @@ func (db *datastore) GetUserFeed(listof []*model.RepoLite) ([]*model.Feed, error
|
||||||
default:
|
default:
|
||||||
stmt, args = toList(listof)
|
stmt, args = toList(listof)
|
||||||
}
|
}
|
||||||
err := meddler.QueryAll(db, &feed, fmt.Sprintf(userFeedQuery, stmt), args...)
|
if len(args) > 0 {
|
||||||
|
err = meddler.QueryAll(db, &feed, fmt.Sprintf(userFeedQuery, stmt), args...)
|
||||||
|
}
|
||||||
return feed, err
|
return feed, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +49,7 @@ func (db *datastore) GetUserFeedLatest(listof []*model.RepoLite) ([]*model.Feed,
|
||||||
feed []*model.Feed
|
feed []*model.Feed
|
||||||
args []interface{}
|
args []interface{}
|
||||||
stmt string
|
stmt string
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
switch meddler.Default {
|
switch meddler.Default {
|
||||||
case meddler.PostgreSQL:
|
case meddler.PostgreSQL:
|
||||||
|
@ -53,7 +57,9 @@ func (db *datastore) GetUserFeedLatest(listof []*model.RepoLite) ([]*model.Feed,
|
||||||
default:
|
default:
|
||||||
stmt, args = toList(listof)
|
stmt, args = toList(listof)
|
||||||
}
|
}
|
||||||
err := meddler.QueryAll(db, &feed, fmt.Sprintf(userFeedLatest, stmt), args...)
|
if len(args) > 0 {
|
||||||
|
err = meddler.QueryAll(db, &feed, fmt.Sprintf(userFeedLatest, stmt), args...)
|
||||||
|
}
|
||||||
return feed, err
|
return feed, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue