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:
Michał Matczuk
2017-07-28 09:43:58 +02:00
parent 2afe71e2b9
commit eb033c4922
8 changed files with 8 additions and 67 deletions

View File

@@ -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 ")