WIP: BuildLogFilter

Jef Roosens 2022-05-19 22:43:38 +02:00
parent 596da100b6
commit 74baccb507
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 13 additions and 3 deletions

View File

@ -1,11 +1,11 @@
module db
import models { BuildLog }
import models { BuildLog, BuildLogFilter }
// get_build_logs returns all BuildLog's in the database.
pub fn (db &VieterDb) get_build_logs() []BuildLog {
pub fn (db &VieterDb) get_build_logs(filter BuildLogFilter) []BuildLog {
res := sql db.conn {
select from BuildLog order by id
select from BuildLog where filter.repo == 0 || repo_id == filter.repo order by id
}
return res

View File

@ -26,3 +26,13 @@ pub fn (bl &BuildLog) str() string {
return str
}
[params]
pub struct BuildLogFilter {
pub mut:
repo int
before time.Time
after time.Time
failed_only bool
arch string
}