-
Notifications
You must be signed in to change notification settings - Fork 5
/
update.v
51 lines (44 loc) · 977 Bytes
/
update.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module vsql
// insert statement
// status: done
// todo:map[string]string => map[string]interface{}
pub fn (mut db DB) insert(data map[string]string) &DB {
db.stmt.typ = .insert
db.stmt.data = data.clone()
return db
}
// status:done
pub fn (mut db DB) into(name string) &DB {
db.stmt.table_name = name
return db
}
// only use for pg,mysql
// status:done
pub fn (mut db DB) returning(column string, other_columns ...string) &DB {
db.stmt.returning << column
for c in other_columns {
db.stmt.returning << c
}
return db
}
// update statement
// staus:done
pub fn (mut db DB) update(data map[string]string) &DB { // TODO:map[string]interface
db.stmt.typ = .update
db.stmt.data = data.clone()
return db
}
// staus:wip
pub fn (mut db DB) increment(column string) &DB {
return db
}
// staus:wip
pub fn (mut db DB) decrement(column string) &DB {
return db
}
// delete statement
// staus:done
pub fn (mut db DB) delete() &DB {
db.stmt.typ = .delete
return db
}