builder_delete.go 458 B

12345678910111213141516171819202122
  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. "errors"
  7. "fmt"
  8. )
  9. func (b *Builder) deleteWriteTo(w Writer) error {
  10. if len(b.tableName) <= 0 {
  11. return errors.New("no table indicated")
  12. }
  13. if _, err := fmt.Fprintf(w, "DELETE FROM %s WHERE ", b.tableName); err != nil {
  14. return err
  15. }
  16. return b.cond.WriteTo(w)
  17. }