You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
567 B
28 lines
567 B
8 years ago
|
// Copyright 2016 The Xorm Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
8 years ago
|
package builder
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
6 years ago
|
// Delete creates a delete Builder
|
||
|
func Delete(conds ...Cond) *Builder {
|
||
|
builder := &Builder{cond: NewCond()}
|
||
|
return builder.Delete(conds...)
|
||
|
}
|
||
|
|
||
8 years ago
|
func (b *Builder) deleteWriteTo(w Writer) error {
|
||
6 years ago
|
if len(b.from) <= 0 {
|
||
|
return ErrNoTableName
|
||
8 years ago
|
}
|
||
|
|
||
6 years ago
|
if _, err := fmt.Fprintf(w, "DELETE FROM %s WHERE ", b.from); err != nil {
|
||
8 years ago
|
return err
|
||
|
}
|
||
|
|
||
|
return b.cond.WriteTo(w)
|
||
|
}
|