qb: removed error from builder ToCql function
Builder is not in a position to validate the statement and the effort is duplicated when the query is build. The checked errors are simple and do not occur most of the time.
This commit is contained in:
13
qb/delete.go
13
qb/delete.go
@@ -5,8 +5,6 @@ package qb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -26,16 +24,7 @@ func Delete(table string) *DeleteBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *DeleteBuilder) ToCql() (stmt string, names []string, err error) {
|
||||
if b.table == "" {
|
||||
err = errors.New("delete statements must specify a table")
|
||||
return
|
||||
}
|
||||
if len(b.where) == 0 {
|
||||
err = fmt.Errorf("delete statements must have at least one WHERE clause")
|
||||
return
|
||||
}
|
||||
|
||||
func (b *DeleteBuilder) ToCql() (stmt string, names []string) {
|
||||
cql := bytes.Buffer{}
|
||||
|
||||
cql.WriteString("DELETE ")
|
||||
|
||||
Reference in New Issue
Block a user