Add option to add ALLOW FILTERING to the update query (#290)
This commit is contained in:
11
qb/update.go
11
qb/update.go
@@ -37,6 +37,7 @@ type UpdateBuilder struct {
|
||||
_if _if
|
||||
using using
|
||||
exists bool
|
||||
allowFiltering bool
|
||||
}
|
||||
|
||||
// Update returns a new UpdateBuilder with the given table name.
|
||||
@@ -72,6 +73,10 @@ func (b *UpdateBuilder) ToCql() (stmt string, names []string) {
|
||||
cql.WriteString("IF EXISTS ")
|
||||
}
|
||||
|
||||
if b.allowFiltering {
|
||||
cql.WriteString("ALLOW FILTERING ")
|
||||
}
|
||||
|
||||
stmt = cql.String()
|
||||
return
|
||||
}
|
||||
@@ -196,6 +201,12 @@ func (b *UpdateBuilder) AddFunc(column string, fn *Func) *UpdateBuilder {
|
||||
return b.addValue(column, fn)
|
||||
}
|
||||
|
||||
// AllowFiltering sets a ALLOW FILTERING clause on the query.
|
||||
func (b *UpdateBuilder) AllowFiltering() *UpdateBuilder {
|
||||
b.allowFiltering = true
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *UpdateBuilder) addValue(column string, value value) *UpdateBuilder {
|
||||
b.assignments = append(b.assignments, assignment{
|
||||
column: column,
|
||||
|
||||
Reference in New Issue
Block a user