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/insert.go
13
qb/insert.go
@@ -5,7 +5,6 @@ package qb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -23,17 +22,7 @@ func Insert(table string) *InsertBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *InsertBuilder) ToCql() (stmt string, names []string, err error) {
|
||||
if b.table == "" {
|
||||
err = errors.New("insert statements must specify a table")
|
||||
return
|
||||
}
|
||||
|
||||
if len(b.columns) == 0 {
|
||||
err = errors.New("insert statements must specify columns")
|
||||
return
|
||||
}
|
||||
|
||||
func (b *InsertBuilder) ToCql() (stmt string, names []string) {
|
||||
cql := bytes.Buffer{}
|
||||
|
||||
cql.WriteString("INSERT ")
|
||||
|
||||
Reference in New Issue
Block a user