Documentation ¶
Overview ¶
Package qb provides CQL query builders. The builders create CQL statement and a list of named parameters that can later be bound using gocqlx.
Index ¶
- func As(column, name string) string
- func TTL(d time.Duration) int64
- func Timestamp(t time.Time) int64
- type BatchBuilder
- func (b *BatchBuilder) Add(builder Builder) *BatchBuilder
- func (b *BatchBuilder) AddStmt(stmt string, names []string) *BatchBuilder
- func (b *BatchBuilder) AddStmtWithPrefix(prefix, stmt string, names []string) *BatchBuilder
- func (b *BatchBuilder) AddWithPrefix(prefix string, builder Builder) *BatchBuilder
- func (b *BatchBuilder) Counter() *BatchBuilder
- func (b *BatchBuilder) TTL(d time.Duration) *BatchBuilder
- func (b *BatchBuilder) TTLNamed(name string) *BatchBuilder
- func (b *BatchBuilder) Timestamp(t time.Time) *BatchBuilder
- func (b *BatchBuilder) TimestampNamed(name string) *BatchBuilder
- func (b *BatchBuilder) ToCql() (stmt string, names []string)
- func (b *BatchBuilder) UnLogged() *BatchBuilder
- type Builder
- type Cmp
- func Contains(column string) Cmp
- func ContainsKey(column string) Cmp
- func ContainsKeyNamed(column, name string) Cmp
- func ContainsKeyTuple(column string, count int) Cmp
- func ContainsLit(column, literal string) Cmp
- func ContainsNamed(column, name string) Cmp
- func ContainsTuple(column string, count int) Cmp
- func Eq(column string) Cmp
- func EqFunc(column string, fn *Func) Cmp
- func EqLit(column, literal string) Cmp
- func EqNamed(column, name string) Cmp
- func EqTuple(column string, count int) Cmp
- func Gt(column string) Cmp
- func GtFunc(column string, fn *Func) Cmp
- func GtLit(column, literal string) Cmp
- func GtNamed(column, name string) Cmp
- func GtOrEq(column string) Cmp
- func GtOrEqFunc(column string, fn *Func) Cmp
- func GtOrEqLit(column, literal string) Cmp
- func GtOrEqNamed(column, name string) Cmp
- func GtOrEqTuple(column string, count int) Cmp
- func GtTuple(column string, count int) Cmp
- func In(column string) Cmp
- func InLit(column, literal string) Cmp
- func InNamed(column, name string) Cmp
- func InTuple(column string, count int) Cmp
- func Like(column string) Cmp
- func LikeTuple(column string, count int) Cmp
- func Lt(column string) Cmp
- func LtFunc(column string, fn *Func) Cmp
- func LtLit(column, literal string) Cmp
- func LtNamed(column, name string) Cmp
- func LtOrEq(column string) Cmp
- func LtOrEqFunc(column string, fn *Func) Cmp
- func LtOrEqLit(column, literal string) Cmp
- func LtOrEqNamed(column, name string) Cmp
- func LtOrEqTuple(column string, count int) Cmp
- func LtTuple(column string, count int) Cmp
- func Ne(column string) Cmp
- func NeFunc(column string, fn *Func) Cmp
- func NeLit(column, literal string) Cmp
- func NeNamed(column, name string) Cmp
- func NeTuple(column string, count int) Cmp
- type DeleteBuilder
- func (b *DeleteBuilder) Columns(columns ...string) *DeleteBuilder
- func (b *DeleteBuilder) Existing() *DeleteBuilder
- func (b *DeleteBuilder) From(table string) *DeleteBuilder
- func (b *DeleteBuilder) If(w ...Cmp) *DeleteBuilder
- func (b *DeleteBuilder) Timestamp(t time.Time) *DeleteBuilder
- func (b *DeleteBuilder) TimestampNamed(name string) *DeleteBuilder
- func (b *DeleteBuilder) ToCql() (stmt string, names []string)
- func (b *DeleteBuilder) Where(w ...Cmp) *DeleteBuilder
- type Func
- type InsertBuilder
- func (b *InsertBuilder) Columns(columns ...string) *InsertBuilder
- func (b *InsertBuilder) FuncColumn(column string, fn *Func) *InsertBuilder
- func (b *InsertBuilder) Into(table string) *InsertBuilder
- func (b *InsertBuilder) Json() *InsertBuilder
- func (b *InsertBuilder) LitColumn(column, literal string) *InsertBuilder
- func (b *InsertBuilder) NamedColumn(column, name string) *InsertBuilder
- func (b *InsertBuilder) TTL(d time.Duration) *InsertBuilder
- func (b *InsertBuilder) TTLNamed(name string) *InsertBuilder
- func (b *InsertBuilder) Timestamp(t time.Time) *InsertBuilder
- func (b *InsertBuilder) TimestampNamed(name string) *InsertBuilder
- func (b *InsertBuilder) ToCql() (stmt string, names []string)
- func (b *InsertBuilder) TupleColumn(column string, count int) *InsertBuilder
- func (b *InsertBuilder) Unique() *InsertBuilder
- type M
- type Order
- type SelectBuilder
- func (b *SelectBuilder) AllowFiltering() *SelectBuilder
- func (b *SelectBuilder) Avg(column string) *SelectBuilder
- func (b *SelectBuilder) BypassCache() *SelectBuilder
- func (b *SelectBuilder) Columns(columns ...string) *SelectBuilder
- func (b *SelectBuilder) Count(column string) *SelectBuilder
- func (b *SelectBuilder) CountAll() *SelectBuilder
- func (b *SelectBuilder) Distinct(columns ...string) *SelectBuilder
- func (b *SelectBuilder) From(table string) *SelectBuilder
- func (b *SelectBuilder) GroupBy(columns ...string) *SelectBuilder
- func (b *SelectBuilder) Json() *SelectBuilder
- func (b *SelectBuilder) Limit(limit uint) *SelectBuilder
- func (b *SelectBuilder) LimitPerPartition(limit uint) *SelectBuilder
- func (b *SelectBuilder) Max(column string) *SelectBuilder
- func (b *SelectBuilder) Min(column string) *SelectBuilder
- func (b *SelectBuilder) OrderBy(column string, o Order) *SelectBuilder
- func (b *SelectBuilder) Sum(column string) *SelectBuilder
- func (b *SelectBuilder) ToCql() (stmt string, names []string)
- func (b *SelectBuilder) Where(w ...Cmp) *SelectBuilder
- type TokenBuilder
- func (t TokenBuilder) Eq() Cmp
- func (t TokenBuilder) EqNamed(names ...string) Cmp
- func (t TokenBuilder) EqValue() Cmp
- func (t TokenBuilder) EqValueNamed(name string) Cmp
- func (t TokenBuilder) Gt() Cmp
- func (t TokenBuilder) GtNamed(names ...string) Cmp
- func (t TokenBuilder) GtOrEq() Cmp
- func (t TokenBuilder) GtOrEqNamed(names ...string) Cmp
- func (t TokenBuilder) GtOrEqValue() Cmp
- func (t TokenBuilder) GtOrEqValueNamed(name string) Cmp
- func (t TokenBuilder) GtValue() Cmp
- func (t TokenBuilder) GtValueNamed(name string) Cmp
- func (t TokenBuilder) Lt() Cmp
- func (t TokenBuilder) LtNamed(names ...string) Cmp
- func (t TokenBuilder) LtOrEq() Cmp
- func (t TokenBuilder) LtOrEqNamed(names ...string) Cmp
- func (t TokenBuilder) LtOrEqValue() Cmp
- func (t TokenBuilder) LtOrEqValueNamed(name string) Cmp
- func (t TokenBuilder) LtValue() Cmp
- func (t TokenBuilder) LtValueNamed(name string) Cmp
- type UpdateBuilder
- func (b *UpdateBuilder) Add(column string) *UpdateBuilder
- func (b *UpdateBuilder) AddFunc(column string, fn *Func) *UpdateBuilder
- func (b *UpdateBuilder) AddLit(column, literal string) *UpdateBuilder
- func (b *UpdateBuilder) AddNamed(column, name string) *UpdateBuilder
- func (b *UpdateBuilder) Existing() *UpdateBuilder
- func (b *UpdateBuilder) If(w ...Cmp) *UpdateBuilder
- func (b *UpdateBuilder) Remove(column string) *UpdateBuilder
- func (b *UpdateBuilder) RemoveFunc(column string, fn *Func) *UpdateBuilder
- func (b *UpdateBuilder) RemoveLit(column, literal string) *UpdateBuilder
- func (b *UpdateBuilder) RemoveNamed(column, name string) *UpdateBuilder
- func (b *UpdateBuilder) Set(columns ...string) *UpdateBuilder
- func (b *UpdateBuilder) SetFunc(column string, fn *Func) *UpdateBuilder
- func (b *UpdateBuilder) SetLit(column, literal string) *UpdateBuilder
- func (b *UpdateBuilder) SetNamed(column, name string) *UpdateBuilder
- func (b *UpdateBuilder) SetTuple(column string, count int) *UpdateBuilder
- func (b *UpdateBuilder) TTL(d time.Duration) *UpdateBuilder
- func (b *UpdateBuilder) TTLNamed(name string) *UpdateBuilder
- func (b *UpdateBuilder) Table(table string) *UpdateBuilder
- func (b *UpdateBuilder) Timestamp(t time.Time) *UpdateBuilder
- func (b *UpdateBuilder) TimestampNamed(name string) *UpdateBuilder
- func (b *UpdateBuilder) ToCql() (stmt string, names []string)
- func (b *UpdateBuilder) Where(w ...Cmp) *UpdateBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchBuilder ¶
type BatchBuilder struct {
// contains filtered or unexported fields
}
BatchBuilder builds CQL BATCH statements.
func (*BatchBuilder) Add ¶
func (b *BatchBuilder) Add(builder Builder) *BatchBuilder
Add builds the builder and adds the statement to the batch.
func (*BatchBuilder) AddStmt ¶
func (b *BatchBuilder) AddStmt(stmt string, names []string) *BatchBuilder
AddStmt adds statement to the batch.
func (*BatchBuilder) AddStmtWithPrefix ¶
func (b *BatchBuilder) AddStmtWithPrefix(prefix, stmt string, names []string) *BatchBuilder
AddStmtWithPrefix adds statement to the batch. Names are prefixed with the prefix + ".".
func (*BatchBuilder) AddWithPrefix ¶
func (b *BatchBuilder) AddWithPrefix(prefix string, builder Builder) *BatchBuilder
AddWithPrefix builds the builder and adds the statement to the batch. Names are prefixed with the prefix + ".".
func (*BatchBuilder) Counter ¶
func (b *BatchBuilder) Counter() *BatchBuilder
Counter sets a COUNTER BATCH clause on the query.
func (*BatchBuilder) TTL ¶
func (b *BatchBuilder) TTL(d time.Duration) *BatchBuilder
TTL adds USING TTL clause to the query.
func (*BatchBuilder) TTLNamed ¶
func (b *BatchBuilder) TTLNamed(name string) *BatchBuilder
TTLNamed adds USING TTL clause to the query with a custom parameter name.
func (*BatchBuilder) Timestamp ¶
func (b *BatchBuilder) Timestamp(t time.Time) *BatchBuilder
Timestamp adds USING TIMESTAMP clause to the query.
func (*BatchBuilder) TimestampNamed ¶
func (b *BatchBuilder) TimestampNamed(name string) *BatchBuilder
TimestampNamed adds a USING TIMESTAMP clause to the query with a custom parameter name.
func (*BatchBuilder) ToCql ¶
func (b *BatchBuilder) ToCql() (stmt string, names []string)
ToCql builds the query into a CQL string and named args.
func (*BatchBuilder) UnLogged ¶
func (b *BatchBuilder) UnLogged() *BatchBuilder
UnLogged sets a UNLOGGED BATCH clause on the query.
type Builder ¶
type Builder interface { // ToCql builds the query into a CQL string and named args. ToCql() (stmt string, names []string) }
Builder is interface implemented by all the builders.
type Cmp ¶
type Cmp struct {
// contains filtered or unexported fields
}
Cmp if a filtering comparator that is used in WHERE and IF clauses.
func ContainsKey ¶ added in v1.1.0
ContainsKey produces column CONTAINS KEY ?.
func ContainsKeyNamed ¶ added in v1.1.0
ContainsKeyNamed produces column CONTAINS KEY ? with a custom parameter name.
func ContainsKeyTuple ¶ added in v1.3.0
ContainsKeyTuple produces column CONTAINS KEY (?,?,...) with count placehplders.
func ContainsLit ¶
ContainsLit produces column CONTAINS literal and does not add a parameter to the query.
func ContainsNamed ¶
ContainsNamed produces column CONTAINS ? with a custom parameter name.
func ContainsTuple ¶ added in v1.3.0
ContainsTuple produces column CONTAINS (?,?,...) with count placeholders.
func GtOrEqFunc ¶
GtOrEqFunc produces column>=someFunc(?...).
func GtOrEqNamed ¶
GtOrEqNamed produces column>=? with a custom parameter name.
func GtOrEqTuple ¶ added in v1.3.0
GtOrEqTuple produces column>=(?,?,...) with count placeholders.
func LtOrEqFunc ¶
LtOrEqFunc produces column<=someFunc(?...).
func LtOrEqNamed ¶
LtOrEqNamed produces column<=? with a custom parameter name.
func LtOrEqTuple ¶ added in v1.3.0
LtOrEqTuple produces column<=(?,?,...) with count placeholders.
func NeLit ¶ added in v1.3.2
NeLit produces column!=literal and does not add a parameter to the query.
type DeleteBuilder ¶
type DeleteBuilder struct {
// contains filtered or unexported fields
}
DeleteBuilder builds CQL DELETE statements.
func Delete ¶
func Delete(table string) *DeleteBuilder
Delete returns a new DeleteBuilder with the given table name.
func (*DeleteBuilder) Columns ¶
func (b *DeleteBuilder) Columns(columns ...string) *DeleteBuilder
Columns adds delete columns to the query.
func (*DeleteBuilder) Existing ¶
func (b *DeleteBuilder) Existing() *DeleteBuilder
Existing sets a IF EXISTS clause on the query.
func (*DeleteBuilder) From ¶
func (b *DeleteBuilder) From(table string) *DeleteBuilder
From sets the table to be deleted from.
func (*DeleteBuilder) If ¶
func (b *DeleteBuilder) If(w ...Cmp) *DeleteBuilder
If adds an expression to the IF clause of the query. Expressions are ANDed together in the generated CQL.
func (*DeleteBuilder) Timestamp ¶
func (b *DeleteBuilder) Timestamp(t time.Time) *DeleteBuilder
Timestamp adds USING TIMESTAMP clause to the query.
func (*DeleteBuilder) TimestampNamed ¶
func (b *DeleteBuilder) TimestampNamed(name string) *DeleteBuilder
TimestampNamed adds a USING TIMESTAMP clause to the query with a custom parameter name.
func (*DeleteBuilder) ToCql ¶
func (b *DeleteBuilder) ToCql() (stmt string, names []string)
ToCql builds the query into a CQL string and named args.
func (*DeleteBuilder) Where ¶
func (b *DeleteBuilder) Where(w ...Cmp) *DeleteBuilder
Where adds an expression to the WHERE clause of the query. Expressions are ANDed together in the generated CQL.
type Func ¶
type Func struct { // function name Name string // name of the function parameters ParamNames []string }
Func is a custom database function invocation that can be use in a comparator or update statement.
type InsertBuilder ¶
type InsertBuilder struct {
// contains filtered or unexported fields
}
InsertBuilder builds CQL INSERT statements.
func Insert ¶
func Insert(table string) *InsertBuilder
Insert returns a new InsertBuilder with the given table name.
func (*InsertBuilder) Columns ¶
func (b *InsertBuilder) Columns(columns ...string) *InsertBuilder
Columns adds insert columns to the query.
func (*InsertBuilder) FuncColumn ¶
func (b *InsertBuilder) FuncColumn(column string, fn *Func) *InsertBuilder
FuncColumn adds an insert column initialized by evaluating a CQL function.
func (*InsertBuilder) Into ¶
func (b *InsertBuilder) Into(table string) *InsertBuilder
Into sets the INTO clause of the query.
func (*InsertBuilder) Json ¶ added in v1.3.0
func (b *InsertBuilder) Json() *InsertBuilder
Json sets the Json clause of the query.
func (*InsertBuilder) LitColumn ¶
func (b *InsertBuilder) LitColumn(column, literal string) *InsertBuilder
LitColumn adds an insert column with a literal value to the query.
func (*InsertBuilder) NamedColumn ¶
func (b *InsertBuilder) NamedColumn(column, name string) *InsertBuilder
NamedColumn adds an insert column with a custom parameter name.
func (*InsertBuilder) TTL ¶
func (b *InsertBuilder) TTL(d time.Duration) *InsertBuilder
TTL adds USING TTL clause to the query.
func (*InsertBuilder) TTLNamed ¶
func (b *InsertBuilder) TTLNamed(name string) *InsertBuilder
TTLNamed adds USING TTL clause to the query with a custom parameter name.
func (*InsertBuilder) Timestamp ¶
func (b *InsertBuilder) Timestamp(t time.Time) *InsertBuilder
Timestamp adds USING TIMESTAMP clause to the query.
func (*InsertBuilder) TimestampNamed ¶
func (b *InsertBuilder) TimestampNamed(name string) *InsertBuilder
TimestampNamed adds a USING TIMESTAMP clause to the query with a custom parameter name.
func (*InsertBuilder) ToCql ¶
func (b *InsertBuilder) ToCql() (stmt string, names []string)
ToCql builds the query into a CQL string and named args.
func (*InsertBuilder) TupleColumn ¶ added in v1.3.0
func (b *InsertBuilder) TupleColumn(column string, count int) *InsertBuilder
TupleColumn adds an insert column for a tuple value to the query.
func (*InsertBuilder) Unique ¶
func (b *InsertBuilder) Unique() *InsertBuilder
Unique sets a IF NOT EXISTS clause on the query.
type SelectBuilder ¶
type SelectBuilder struct {
// contains filtered or unexported fields
}
SelectBuilder builds CQL SELECT statements.
func Select ¶
func Select(table string) *SelectBuilder
Select returns a new SelectBuilder with the given table name.
func (*SelectBuilder) AllowFiltering ¶
func (b *SelectBuilder) AllowFiltering() *SelectBuilder
AllowFiltering sets a ALLOW FILTERING clause on the query.
func (*SelectBuilder) Avg ¶
func (b *SelectBuilder) Avg(column string) *SelectBuilder
Avg produces 'avg(column)' aggregation function.
func (*SelectBuilder) BypassCache ¶ added in v1.3.2
func (b *SelectBuilder) BypassCache() *SelectBuilder
BypassCache sets a BYPASS CACHE clause on the query.
BYPASS CACHE is a feature specific to ScyllaDB. See https://docs.scylladb.com/getting-started/dml/#bypass-cache
func (*SelectBuilder) Columns ¶
func (b *SelectBuilder) Columns(columns ...string) *SelectBuilder
Columns adds result columns to the query.
func (*SelectBuilder) Count ¶
func (b *SelectBuilder) Count(column string) *SelectBuilder
Count produces 'count(column)'.
func (*SelectBuilder) CountAll ¶
func (b *SelectBuilder) CountAll() *SelectBuilder
CountAll produces 'count(*)'.
func (*SelectBuilder) Distinct ¶
func (b *SelectBuilder) Distinct(columns ...string) *SelectBuilder
Distinct sets DISTINCT clause on the query.
func (*SelectBuilder) From ¶
func (b *SelectBuilder) From(table string) *SelectBuilder
From sets the table to be selected from.
func (*SelectBuilder) GroupBy ¶
func (b *SelectBuilder) GroupBy(columns ...string) *SelectBuilder
GroupBy sets GROUP BY clause on the query. Columns must be a primary key, this will automatically add the the columns as first selectors.
func (*SelectBuilder) Json ¶ added in v1.3.0
func (b *SelectBuilder) Json() *SelectBuilder
Json sets the clause of the query.
func (*SelectBuilder) Limit ¶
func (b *SelectBuilder) Limit(limit uint) *SelectBuilder
Limit sets a LIMIT clause on the query.
func (*SelectBuilder) LimitPerPartition ¶
func (b *SelectBuilder) LimitPerPartition(limit uint) *SelectBuilder
LimitPerPartition sets a PER PARTITION LIMIT clause on the query.
func (*SelectBuilder) Max ¶
func (b *SelectBuilder) Max(column string) *SelectBuilder
Max produces 'max(column)' aggregation function.
func (*SelectBuilder) Min ¶
func (b *SelectBuilder) Min(column string) *SelectBuilder
Min produces 'min(column)' aggregation function.
func (*SelectBuilder) OrderBy ¶
func (b *SelectBuilder) OrderBy(column string, o Order) *SelectBuilder
OrderBy sets ORDER BY clause on the query.
func (*SelectBuilder) Sum ¶
func (b *SelectBuilder) Sum(column string) *SelectBuilder
Sum produces 'sum(column)' aggregation function.
func (*SelectBuilder) ToCql ¶
func (b *SelectBuilder) ToCql() (stmt string, names []string)
ToCql builds the query into a CQL string and named args.
func (*SelectBuilder) Where ¶
func (b *SelectBuilder) Where(w ...Cmp) *SelectBuilder
Where adds an expression to the WHERE clause of the query. Expressions are ANDed together in the generated CQL.
type TokenBuilder ¶
type TokenBuilder []string
TokenBuilder helps implement pagination using token function.
func (TokenBuilder) EqNamed ¶
func (t TokenBuilder) EqNamed(names ...string) Cmp
EqNamed produces token(column)=token(?) with a custom parameter name.
func (TokenBuilder) EqValue ¶ added in v1.3.2
func (t TokenBuilder) EqValue() Cmp
EqValue produces token(column)=?
func (TokenBuilder) EqValueNamed ¶ added in v1.3.2
func (t TokenBuilder) EqValueNamed(name string) Cmp
EqValueNamed produces token(column)=? with a custom parameter name.
func (TokenBuilder) GtNamed ¶
func (t TokenBuilder) GtNamed(names ...string) Cmp
GtNamed produces token(column)>token(?) with a custom parameter name.
func (TokenBuilder) GtOrEq ¶
func (t TokenBuilder) GtOrEq() Cmp
GtOrEq produces token(column)>=token(?).
func (TokenBuilder) GtOrEqNamed ¶
func (t TokenBuilder) GtOrEqNamed(names ...string) Cmp
GtOrEqNamed produces token(column)>=token(?) with a custom parameter name.
func (TokenBuilder) GtOrEqValue ¶ added in v1.3.2
func (t TokenBuilder) GtOrEqValue() Cmp
GtOrEqValue produces token(column)>=?.
func (TokenBuilder) GtOrEqValueNamed ¶ added in v1.3.2
func (t TokenBuilder) GtOrEqValueNamed(name string) Cmp
GtOrEqValueNamed produces token(column)>=? with a custom parameter name.
func (TokenBuilder) GtValue ¶ added in v1.3.2
func (t TokenBuilder) GtValue() Cmp
GtValue produces token(column)>?.
func (TokenBuilder) GtValueNamed ¶ added in v1.3.2
func (t TokenBuilder) GtValueNamed(name string) Cmp
GtValueNamed produces token(column)>? with a custom parameter name.
func (TokenBuilder) LtNamed ¶
func (t TokenBuilder) LtNamed(names ...string) Cmp
LtNamed produces token(column)<token(?) with a custom parameter name.
func (TokenBuilder) LtOrEq ¶
func (t TokenBuilder) LtOrEq() Cmp
LtOrEq produces token(column)<=token(?).
func (TokenBuilder) LtOrEqNamed ¶
func (t TokenBuilder) LtOrEqNamed(names ...string) Cmp
LtOrEqNamed produces token(column)<=token(?) with a custom parameter name.
func (TokenBuilder) LtOrEqValue ¶ added in v1.3.2
func (t TokenBuilder) LtOrEqValue() Cmp
LtOrEqValue produces token(column)<=?.
func (TokenBuilder) LtOrEqValueNamed ¶ added in v1.3.2
func (t TokenBuilder) LtOrEqValueNamed(name string) Cmp
LtOrEqValueNamed produces token(column)<=? with a custom parameter name.
func (TokenBuilder) LtValue ¶ added in v1.3.2
func (t TokenBuilder) LtValue() Cmp
LtValue produces token(column)<?.
func (TokenBuilder) LtValueNamed ¶ added in v1.3.2
func (t TokenBuilder) LtValueNamed(name string) Cmp
LtValueNamed produces token(column)<? with a custom parameter name.
type UpdateBuilder ¶
type UpdateBuilder struct {
// contains filtered or unexported fields
}
UpdateBuilder builds CQL UPDATE statements.
func Update ¶
func Update(table string) *UpdateBuilder
Update returns a new UpdateBuilder with the given table name.
func (*UpdateBuilder) Add ¶
func (b *UpdateBuilder) Add(column string) *UpdateBuilder
Add adds SET column=column+? clauses to the query.
func (*UpdateBuilder) AddFunc ¶
func (b *UpdateBuilder) AddFunc(column string, fn *Func) *UpdateBuilder
AddFunc adds SET column=column+someFunc(?...) clauses to the query.
func (*UpdateBuilder) AddLit ¶
func (b *UpdateBuilder) AddLit(column, literal string) *UpdateBuilder
AddLit adds SET column=column+literal clauses to the query.
func (*UpdateBuilder) AddNamed ¶
func (b *UpdateBuilder) AddNamed(column, name string) *UpdateBuilder
AddNamed adds SET column=column+? clauses to the query with a custom parameter name.
func (*UpdateBuilder) Existing ¶
func (b *UpdateBuilder) Existing() *UpdateBuilder
Existing sets a IF EXISTS clause on the query.
func (*UpdateBuilder) If ¶
func (b *UpdateBuilder) If(w ...Cmp) *UpdateBuilder
If adds an expression to the IF clause of the query. Expressions are ANDed together in the generated CQL.
func (*UpdateBuilder) Remove ¶
func (b *UpdateBuilder) Remove(column string) *UpdateBuilder
Remove adds SET column=column-? clauses to the query.
func (*UpdateBuilder) RemoveFunc ¶
func (b *UpdateBuilder) RemoveFunc(column string, fn *Func) *UpdateBuilder
RemoveFunc adds SET column=column-someFunc(?...) clauses to the query.
func (*UpdateBuilder) RemoveLit ¶
func (b *UpdateBuilder) RemoveLit(column, literal string) *UpdateBuilder
RemoveLit adds SET column=column-literal clauses to the query.
func (*UpdateBuilder) RemoveNamed ¶
func (b *UpdateBuilder) RemoveNamed(column, name string) *UpdateBuilder
RemoveNamed adds SET column=column-? clauses to the query with a custom parameter name.
func (*UpdateBuilder) Set ¶
func (b *UpdateBuilder) Set(columns ...string) *UpdateBuilder
Set adds SET clauses to the query. To set a tuple column use SetTuple instead.
func (*UpdateBuilder) SetFunc ¶
func (b *UpdateBuilder) SetFunc(column string, fn *Func) *UpdateBuilder
SetFunc adds SET column=someFunc(?...) clause to the query.
func (*UpdateBuilder) SetLit ¶
func (b *UpdateBuilder) SetLit(column, literal string) *UpdateBuilder
SetLit adds SET column=literal clause to the query.
func (*UpdateBuilder) SetNamed ¶
func (b *UpdateBuilder) SetNamed(column, name string) *UpdateBuilder
SetNamed adds SET column=? clause to the query with a custom parameter name.
func (*UpdateBuilder) SetTuple ¶ added in v1.3.0
func (b *UpdateBuilder) SetTuple(column string, count int) *UpdateBuilder
SetTuple adds a SET clause for a tuple to the query.
func (*UpdateBuilder) TTL ¶
func (b *UpdateBuilder) TTL(d time.Duration) *UpdateBuilder
TTL adds USING TTL clause to the query.
func (*UpdateBuilder) TTLNamed ¶
func (b *UpdateBuilder) TTLNamed(name string) *UpdateBuilder
TTLNamed adds USING TTL clause to the query with a custom parameter name.
func (*UpdateBuilder) Table ¶
func (b *UpdateBuilder) Table(table string) *UpdateBuilder
Table sets the table to be updated.
func (*UpdateBuilder) Timestamp ¶
func (b *UpdateBuilder) Timestamp(t time.Time) *UpdateBuilder
Timestamp adds USING TIMESTAMP clause to the query.
func (*UpdateBuilder) TimestampNamed ¶
func (b *UpdateBuilder) TimestampNamed(name string) *UpdateBuilder
TimestampNamed adds a USING TIMESTAMP clause to the query with a custom parameter name.
func (*UpdateBuilder) ToCql ¶
func (b *UpdateBuilder) ToCql() (stmt string, names []string)
ToCql builds the query into a CQL string and named args.
func (*UpdateBuilder) Where ¶
func (b *UpdateBuilder) Where(w ...Cmp) *UpdateBuilder
Where adds an expression to the WHERE clause of the query. Expressions are ANDed together in the generated CQL.