-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.go
84 lines (66 loc) · 2.05 KB
/
update.go
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package azamat
import (
"database/sql"
sq "github.com/Masterminds/squirrel"
)
type UpdateBuilder struct {
sq.UpdateBuilder
}
func Update(table string) UpdateBuilder {
return UpdateBuilder{sq.Update(table)}
}
func (b UpdateBuilder) Run(runner Runner) (sql.Result, error) {
return b.RunWith(runner).Exec()
}
func (b UpdateBuilder) PlaceholderFormat(f sq.PlaceholderFormat) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.PlaceholderFormat(f)
return b
}
func (b UpdateBuilder) RunWith(runner sq.BaseRunner) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.RunWith(runner)
return b
}
func (b UpdateBuilder) Prefix(sql string, args ...interface{}) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Prefix(sql, args...)
return b
}
func (b UpdateBuilder) PrefixExpr(expr sq.Sqlizer) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.PrefixExpr(expr)
return b
}
func (b UpdateBuilder) Table(table string) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Table(table)
return b
}
func (b UpdateBuilder) Set(column string, value interface{}) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Set(column, value)
return b
}
func (b UpdateBuilder) SetMap(clauses map[string]interface{}) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.SetMap(clauses)
return b
}
func (b UpdateBuilder) Where(pred interface{}, args ...interface{}) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Where(pred, args...)
return b
}
func (b UpdateBuilder) OrderBy(orderBys ...string) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.OrderBy(orderBys...)
return b
}
func (b UpdateBuilder) Limit(limit uint64) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Limit(limit)
return b
}
func (b UpdateBuilder) Offset(offset uint64) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Offset(offset)
return b
}
func (b UpdateBuilder) Suffix(sql string, args ...interface{}) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.Suffix(sql, args...)
return b
}
func (b UpdateBuilder) SuffixExpr(expr sq.Sqlizer) UpdateBuilder {
b.UpdateBuilder = b.UpdateBuilder.SuffixExpr(expr)
return b
}