wip [CI SKIP]
parent
b5d4816679
commit
8174327a34
19
src/db/git.v
19
src/db/git.v
|
|
@ -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 }) */
|
||||
/* } */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue