Files
gocqlx/qb/utils.go

34 lines
602 B
Go
Raw Normal View History

2017-09-21 21:43:27 +02:00
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
2017-07-26 13:57:10 +02:00
package qb
import (
"bytes"
2017-07-26 13:57:10 +02:00
)
// placeholders returns a string with count ? placeholders joined with commas.
func placeholders(cql *bytes.Buffer, count int) {
2017-07-26 13:57:10 +02:00
if count < 1 {
return
2017-07-26 13:57:10 +02:00
}
for i := 0; i < count-1; i++ {
cql.WriteByte('?')
cql.WriteByte(',')
}
cql.WriteByte('?')
2017-07-26 13:57:10 +02:00
}
2017-08-01 12:44:10 +02:00
2018-05-25 13:06:43 +02:00
type columns []string
2017-08-01 12:44:10 +02:00
2018-05-25 13:06:43 +02:00
func (cols columns) writeCql(cql *bytes.Buffer) {
for i, c := range cols {
cql.WriteString(c)
if i < len(cols)-1 {
cql.WriteByte(',')
}
}
2017-08-01 12:44:10 +02:00
}