本站源代码
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
567B

  1. // Copyright 2016 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package builder
  5. import (
  6. "fmt"
  7. )
  8. // Delete creates a delete Builder
  9. func Delete(conds ...Cond) *Builder {
  10. builder := &Builder{cond: NewCond()}
  11. return builder.Delete(conds...)
  12. }
  13. func (b *Builder) deleteWriteTo(w Writer) error {
  14. if len(b.from) <= 0 {
  15. return ErrNoTableName
  16. }
  17. if _, err := fmt.Fprintf(w, "DELETE FROM %s WHERE ", b.from); err != nil {
  18. return err
  19. }
  20. return b.cond.WriteTo(w)
  21. }
上海开阖软件有限公司 沪ICP备12045867号-1