add update statement
This commit is contained in:
@@ -30,6 +30,10 @@ func (q *SelectQuery) Args() []any {
|
||||
}
|
||||
|
||||
func (q *SelectQuery) Columns(defs ...string) *SelectQuery {
|
||||
if q.columns == nil {
|
||||
q.columns = []Column{}
|
||||
}
|
||||
|
||||
for _, def := range defs {
|
||||
q.columns = append(q.columns, Column(def))
|
||||
}
|
||||
@@ -157,6 +161,10 @@ func (q *SelectQuery) String() string {
|
||||
}
|
||||
|
||||
func (q *SelectQuery) Where(def string, args ...any) *SelectQuery {
|
||||
if q.where == nil {
|
||||
q.where = []Where{}
|
||||
}
|
||||
|
||||
q.where = append(q.where, Where(def))
|
||||
|
||||
if len(args) > 0 {
|
||||
@@ -172,10 +180,7 @@ func (q *SelectQuery) Where(def string, args ...any) *SelectQuery {
|
||||
|
||||
func Select(from string) *SelectQuery {
|
||||
q := &SelectQuery{
|
||||
columns: []Column{},
|
||||
tables: []SelectTable{From(from)},
|
||||
|
||||
where: []Where{},
|
||||
tables: []SelectTable{From(from)},
|
||||
}
|
||||
|
||||
return q
|
||||
|
||||
Reference in New Issue
Block a user