wip [CI SKIP]

Jef Roosens 2022-05-02 20:59:53 +02:00
parent b5d4816679
commit 8174327a34
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 18 additions and 1 deletions

View File

@ -91,8 +91,25 @@ pub fn (db &VieterDb) delete_git_repo(repo_id int) {
}
}
pub fn (db &VieterDb) update_git_repo(repo GitRepo) {
pub fn (db &VieterDb) update_git_repo(repo_id int, params map[string]string) {
/* sql db.conn { */
/* update GitRepo set repo */
/* } */
mut values := []string{}
$for field in GitRepo.fields {
if field.name in params {
$if field.typ is string {
values << "${field.name} = '${params[field.name]}'"
/* r.$(field.name) = params[field.name] */
// This specific type check is needed for the compiler to ensure
// our types are correct
}
/* $else $if field.typ is []GitRepoArch { */
/* r.$(field.name) = params[field.name].split(',').map(GitRepoArch{ value: it }) */
/* } */
}
}
}