qb: tuple support

This commit is contained in:
Henrik Johansson
2019-05-13 11:30:19 +02:00
committed by Michal Matczuk
parent 31ae81aba6
commit 219bceab51
9 changed files with 238 additions and 0 deletions

View File

@@ -22,6 +22,23 @@ func (p param) writeCql(cql *bytes.Buffer) (names []string) {
return []string{string(p)}
}
// param is a named CQL tuple '?' parameter.
type tupleParam struct {
param param
count int
}
func (t tupleParam) writeCql(cql *bytes.Buffer) (names []string) {
cql.WriteByte('(')
for i := 0; i < t.count-1; i++ {
cql.WriteByte('?')
cql.WriteByte(',')
}
cql.WriteByte('?')
cql.WriteByte(')')
return []string{string(t.param)}
}
// lit is a literal CQL value.
type lit string