diff --git a/.gitignore b/.gitignore
index 33d9741..8087edc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
output/
test/.fixtures/collections/input.go
test/collections.cql
+
+.idea
+vendor
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 675aff5..98bdf66 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,40 +1,47 @@
+sudo: required
language: go
-
-sudo: false
-
-cache:
- directories:
- - $HOME/.ccm/repository
+services:
+- docker
matrix:
fast_finish: true
env:
global:
+ # TODO: why need this?
- GOMAXPROCS=2
+ - DOCKER_COMPOSE_VERSION=1.22.0
matrix:
- - CASS=2.1.9
- CASS=2.2.1
+# - CASS=3.11
go:
- - 1.4
- - 1.5
+ - "1.10"
+# - "1.11"
+# - "tip"
before_install:
- - go get github.com/stretchr/testify/assert
- - go get github.com/jteeuwen/go-bindata/...
- - go get github.com/relops/csvb
- - go get github.com/cihub/seelog
- - export PATH=$PATH:/home/travis/gopath/bin
+ - sudo rm /usr/local/bin/docker-compose
+ - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
+ - chmod +x docker-compose
+ - sudo mv docker-compose /usr/local/bin
+ - curl -sSL https://github.com/Masterminds/glide/releases/download/v0.13.1/glide-v0.13.1-linux-amd64.tar.gz | tar -vxz -C ${GOPATH}/bin --strip=1
+# FIXME: workaround for gopath
+ - mkdir -p ${GOPATH}/src/github.com/relops/cqlc
+ - cp -r ./. ${GOPATH}/src/github.com/relops/cqlc
+ - cd ${GOPATH}/src/github.com/relops/cqlc
install:
- - pip install --user PyYAML six
- - git clone https://github.com/pcmanus/ccm.git
- - pushd ccm
- - ./setup.py install --user
- - popd
- - go get -v ./...
+# - pip install --user PyYAML six
+# - git clone https://github.com/pcmanus/ccm.git
+# - pushd ccm
+# - ./setup.py install --user
+# - popd
+ - glide install
+ - make install
script:
- - set -e
- - PATH=$PATH:$HOME/.local/bin bash -x integration.sh $CASS
+ - make test
+ # e2e
+ - make travis-test
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9532256
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,38 @@
+# Changelog
+
+NOTE: this file format is based on [gaocegege/maintainer](https://github.com/gaocegege/maintainer/blob/master/CHANGELOG.md)
+
+## Unreleased
+
+## 0.13.0 (2019-03-10)
+
+Was going to make it 0.12.2 but since it breaks both runtime and generated code, bump minor version number
+
+- support `IF` in `DELETE` [#13](https://github.com/pingginp/cqlc/issues/13)
+- in generated column bindings allow `Eq` on all columns, previously only primary key, index are allowed, which blocks using
+other columns in condition queries after `If`
+
+## 0.12.1 (2019-02-18)
+
+- previous release didn't update all the mapping in generator
+
+## 0.12.0 (2019-02-18)
+
+[Closed issues](https://github.com/pingginp/cqlc/issues?q=is%3Aissue+milestone%3A0.12.0+is%3Aclosed)
+
+Merged pull requests
+
+- [#12](https://github.com/pingginp/cqlc/pull/12) one line fix to support Cassandra 3
+
+## 0.11.0 (2018-09-15)
+
+[Closed issues](https://github.com/pingginp/cqlc/issues?q=is%3Aissue+is%3Aclosed+milestone%3A0.11.0)
+
+Merged pull requests
+
+- Reboot [#4](https://github.com/pingginp/cqlc/pull/4) the project now compiles and support set map value by key
+- [#9](https://github.com/pingginp/cqlc/pull/9) remove `log.Fatal` and use logrus
+
+## 0.10.5 (2015-09-10)
+
+The last commit in upstream https://github.com/relops/cqlc/commit/9427a2081fb4f4910b0af8fc80d09c109b4f9815
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 0610092..a4f5378 100644
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,58 @@
-CCM_NODE ?= node1
-CQLSH_CMD ?= ccm $(CCM_NODE) cqlsh
+VERSION = 0.13.0
+LDFLAGS = -X main.Version=$(VERSION)
+GO = CGO_ENABLED=0 go
+GO_LINUX = GOOS=linux GOARCH=amd64 $(GO)
+GO_MAC = GOOS=darwin GOARCH=amd64 $(GO)
+GO_WINDOWS = GOOS=windows GOARCH=amd64 $(GO)
-test/collections.cql: test/tmpl/schema.tmpl test/schema_generator.go
- cd test; go run schema_generator.go
+.PHONY: gen fmt build install test
-test/.fixtures/collections/input.go: test/tmpl/input.tmpl test/schema_generator.go
- cd test; go run schema_generator.go
+fmt:
+ gofmt -d -l -w cqlc generator e2e
-schema: test/collections.cql
- -$(CQLSH_CMD) -f test/keyspace.cql
- $(CQLSH_CMD) -k cqlc -f test/schema.cql
- $(CQLSH_CMD) -k cqlc -f test/collections.cql
- $(CQLSH_CMD) -k cqlc -f test/shared.cql
- $(CQLSH_CMD) -k cqlc2 -f test/shared.cql
+build:
+ $(GO) build -ldflags "$(LDFLAGS)" -o build/cqlc .
-cqlc/columns.go: cqlc/tmpl/columns.tmpl cqlc/column_generator.go
- cd cqlc; go run column_generator.go
+build-all: build-linux build-mac build-windows
+
+build-linux:
+ $(GO_LINUX) build -ldflags "$(LDFLAGS)" -o build/cqlc-linux .
+
+build-mac:
+ $(GO_MAC) build -ldflags "$(LDFLAGS)" -o build/cqlc-mac .
-columns: cqlc/columns.go
+build-windows:
+ $(GO_WINDOWS) build -ldflags "$(LDFLAGS)" -o build/cqlc-windows .
-bindata: generator/binding_tmpl.go
+install:
+ go install -ldflags "$(LDFLAGS)" .
-input: test/.fixtures/collections/input.go test/collections.cql
+# sync the version defined in runtime with Makefile
+update-ver:
+# NOTE: mac's default sed is not GNU sed https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux
+ sed -i .bak -E 's/const Version = "(.*)"/const Version = "$(VERSION)"/g' cqlc/ver.go
+
+release: update-ver build-all
+ cd build; rm -f *.zip
+ cd build; zip cqlc-$(VERSION)-linux.zip cqlc-linux
+ cd build; zip cqlc-$(VERSION)-mac.zip cqlc-mac
+ cd build; zip cqlc-$(VERSION)-windows.zip cqlc-windows
+
+# generate highly duplicated part in runtime
+gen:
+ cd cqlc; go run column_generator.go
-generator/binding_tmpl.go: generator/tmpl/binding.tmpl
- go-bindata -pkg=generator -o=generator/binding_tmpl.go generator/tmpl
+test: test-unit
-test: columns bindata schema test/.fixtures/collections/input.go
- go test -v ./...
+test-unit:
+ go test -v ./cqlc
-format:
- gofmt -w cqlc generator integration test
+travis-test: install
+ docker-compose -f e2e/docker-compose.yaml up -d c2
+ ./wait-on-c.sh
+ docker ps
+ sleep 5
+ go test -v ./e2e
-.PHONY: test columns bindata
\ No newline at end of file
+travis-tear:
+ cd e2e && make down
\ No newline at end of file
diff --git a/README.md b/README.md
index e0e7e74..7db8068 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,71 @@
-cqlc
-----
+# cqlc
-[](https://gitter.im/relops/cqlc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[](https://travis-ci.org/pingginp/cqlc)
-[](https://travis-ci.org/relops/cqlc)
-[](http://godoc.org/github.com/relops/cqlc/cqlc)
+This a fork of [relops/cqlc](https://github.com/relops/cqlc) the upstream is no longer maintained.
-`cqlc` generates Go code from your Cassandra schema so that you can write type safe CQL statements in Go with a natural query syntax.
+## Usage
-For more details please visit [http://relops.com/cqlc][cqlc]
+````bash
+# install the generator to $GOPATH/bin
+make install
+# generate table and column definition based on schema in keyspace cqlc
+cqlc --instance=127.0.0.1 --keyspace=cqlc --package=foo --output=foo.go --symbols
+````
-[cqlc]: http://relops.com/cqlc
+You need to change the repo path in `glide.yaml` to use this fork
+
+````yaml
+- package: github.com/relops/cqlc
+ version: master
+ repo: https://github.com/pingginp/cqlc.git
+````
+
+If you use `go mod`, add the following in your `go.mod`, [go mod wiki](https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive)
+
+````text
+replace github.com/relops/cqlc => github.com/pingginp/cqlc v0.12.0
+````
+
+## Dev
+
+- clone the repo to `$GOPATH/src/github.com/relops/cqlc`
+
+````bash
+# generate columns
+make cqlc/columns.go
+# e2e test
+# TODO: you need to run it twice if schema changed because first time it will generate package based on schema, which won't get compiled ...
+# this same as when using latex ... you do xelatex several times when there is bib ...
+make travis-test
+make travis-tear
+# release, update cqlc/ver.go, build and zip binary for all three platforms, only mac is tested
+make release
+````
+
+The code has two part, runtime and generator
+
+- [cqlc](cqlc) is the runtime, a query builder, don't get mislead by the [column_generator.go](cqlc/column_generator.go)
+it is mainly for generating runtime code that ships with the library
+- [generator](generator) generates table and column definition based on schema, NOTE: it now [supports Cassandra 3](https://github.com/pingginp/cqlc/issues/7)
+
+### Runtime
+
+The main modification to the runtime are listed below
+
+- [support update map value by key](doc/set-map-value-by-key.md), previously, cqlc can only update entire map. (This change only requires update runtime)
+- support `IF` in `DELETE` [#13](https://github.com/pingginp/cqlc/issues/13)
+
+### Generator
+
+The main modification to the generator are listed below
+
+- generator now compiles, caused by breaking change of constant name in gocql
+- support Cassandra 3 by adding a new literalType mapping for text -> string [#12](https://github.com/pingginp/cqlc/pull/12)
+- allow `Eq` on all columns to support `IF` in `DELETE`
+
+The overall generator logic is
+
+- get table meta using gocql
+- render the template defined in `tmpl.go` using template helper methods defined in `template.go`
+ - `valueType` is returning empty value for `text`, just add a new mapping in `literalTypes` fixed this [#7](https://github.com/pingginp/cqlc/issues/7)
\ No newline at end of file
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..07b8e15
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1,2 @@
+cqlc
+cqlc-*
\ No newline at end of file
diff --git a/cqlc/.gitignore b/cqlc/.gitignore
new file mode 100644
index 0000000..7664704
--- /dev/null
+++ b/cqlc/.gitignore
@@ -0,0 +1 @@
+*.bak
\ No newline at end of file
diff --git a/cqlc/column_generator.go b/cqlc/column_generator.go
index 4001ff8..27529a1 100644
--- a/cqlc/column_generator.go
+++ b/cqlc/column_generator.go
@@ -4,33 +4,12 @@ package main
import (
"bytes"
- "fmt"
- log "github.com/cihub/seelog"
+ "go/format"
"io/ioutil"
+ "log"
"text/template"
)
-var logConfig = `
-
-
-
-
-
-
-
-`
-
-func init() {
- logger, err := log.LoggerFromConfigAsString(logConfig)
-
- if err != nil {
- fmt.Printf("Could not load seelog configuration: %s\n", err)
- return
- }
-
- log.ReplaceLogger(logger)
-}
-
type TypeInfo struct {
Prefix string
Literal string
@@ -57,17 +36,26 @@ func main() {
t, err := template.New("columns.tmpl").ParseFiles("tmpl/columns.tmpl")
if err != nil {
- log.Errorf("Could not open template: %s", err)
+ log.Fatalf("Could not open template: %s", err)
+ return
+ }
+
+ var buf bytes.Buffer
+ if err := t.Execute(&buf, params); err != nil {
+ log.Fatalf("Could not render template: %s", err)
return
}
- var b bytes.Buffer
- t.Execute(&b, params)
+ b, err := format.Source(buf.Bytes())
+ if err != nil {
+ log.Fatalf("Could not format rendered template as go code: %s", err)
+ return
+ }
- if err := ioutil.WriteFile("columns.go", b.Bytes(), 0644); err != nil {
- log.Errorf("Could not write templated file: %s", err)
+ if err := ioutil.WriteFile("columns.go", b, 0644); err != nil {
+ log.Fatalf("Could not write templated file: %s", err)
return
}
- log.Info("Regenerated columns")
+ log.Println("Regenerated columns")
}
diff --git a/cqlc/columns.go b/cqlc/columns.go
index d9092c1..8d0f260 100755
--- a/cqlc/columns.go
+++ b/cqlc/columns.go
@@ -1,16 +1,15 @@
-// THIS FILE WAS AUTOGENERATED - ANY EDITS TO THIS WILL BE LOST WHEN IT IS REGENERATED
+// Code generated by column_generator.go from tmp/columns.tmpl DO NOT EDIT.
package cqlc
import (
- "github.com/gocql/gocql"
- "time"
"math/big"
+ "time"
+
+ "github.com/gocql/gocql"
"gopkg.in/inf.v0"
)
-
-
type StringColumn interface {
Column
To(value *string) ColumnBinding
@@ -45,8 +44,6 @@ type LastClusteredStringColumn interface {
In(value ...string) Condition
}
-
-
type Int32Column interface {
Column
To(value *int32) ColumnBinding
@@ -81,8 +78,6 @@ type LastClusteredInt32Column interface {
In(value ...int32) Condition
}
-
-
type Int64Column interface {
Column
To(value *int64) ColumnBinding
@@ -117,8 +112,6 @@ type LastClusteredInt64Column interface {
In(value ...int64) Condition
}
-
-
type Float32Column interface {
Column
To(value *float32) ColumnBinding
@@ -153,8 +146,6 @@ type LastClusteredFloat32Column interface {
In(value ...float32) Condition
}
-
-
type Float64Column interface {
Column
To(value *float64) ColumnBinding
@@ -189,8 +180,6 @@ type LastClusteredFloat64Column interface {
In(value ...float64) Condition
}
-
-
type TimestampColumn interface {
Column
To(value *time.Time) ColumnBinding
@@ -225,8 +214,6 @@ type LastClusteredTimestampColumn interface {
In(value ...time.Time) Condition
}
-
-
type TimeUUIDColumn interface {
Column
To(value *gocql.UUID) ColumnBinding
@@ -261,8 +248,6 @@ type LastClusteredTimeUUIDColumn interface {
In(value ...gocql.UUID) Condition
}
-
-
type UUIDColumn interface {
Column
To(value *gocql.UUID) ColumnBinding
@@ -297,8 +282,6 @@ type LastClusteredUUIDColumn interface {
In(value ...gocql.UUID) Condition
}
-
-
type BooleanColumn interface {
Column
To(value *bool) ColumnBinding
@@ -333,8 +316,6 @@ type LastClusteredBooleanColumn interface {
In(value ...bool) Condition
}
-
-
type DecimalColumn interface {
Column
To(value **inf.Dec) ColumnBinding
@@ -369,8 +350,6 @@ type LastClusteredDecimalColumn interface {
In(value ...*inf.Dec) Condition
}
-
-
type VarintColumn interface {
Column
To(value **big.Int) ColumnBinding
@@ -405,8 +384,6 @@ type LastClusteredVarintColumn interface {
In(value ...*big.Int) Condition
}
-
-
type BytesColumn interface {
Column
To(value *[]byte) ColumnBinding
@@ -441,9 +418,6 @@ type LastClusteredBytesColumn interface {
In(value ...[]byte) Condition
}
-
-
-
type StringSliceColumn interface {
ListColumn
To(value *[]string) ColumnBinding
@@ -504,2031 +478,2340 @@ type BytesSliceColumn interface {
To(value *[][]byte) ColumnBinding
}
-
-
-
-
-
-
-
type StringStringMapColumn interface {
Column
}
-
type StringInt32MapColumn interface {
Column
}
-
type StringInt64MapColumn interface {
Column
}
-
type StringFloat32MapColumn interface {
Column
}
-
type StringFloat64MapColumn interface {
Column
}
-
type StringTimestampMapColumn interface {
Column
}
-
type StringTimeUUIDMapColumn interface {
Column
}
-
type StringUUIDMapColumn interface {
Column
}
-
type StringBooleanMapColumn interface {
Column
}
-
type StringDecimalMapColumn interface {
Column
}
-
type StringVarintMapColumn interface {
Column
}
-
type StringBytesMapColumn interface {
Column
}
-
-
type Int32StringMapColumn interface {
Column
}
-
type Int32Int32MapColumn interface {
Column
}
-
type Int32Int64MapColumn interface {
Column
}
-
type Int32Float32MapColumn interface {
Column
}
-
type Int32Float64MapColumn interface {
Column
}
-
type Int32TimestampMapColumn interface {
Column
}
-
type Int32TimeUUIDMapColumn interface {
Column
}
-
type Int32UUIDMapColumn interface {
Column
}
-
type Int32BooleanMapColumn interface {
Column
}
-
type Int32DecimalMapColumn interface {
Column
}
-
type Int32VarintMapColumn interface {
Column
}
-
type Int32BytesMapColumn interface {
Column
}
-
-
type Int64StringMapColumn interface {
Column
}
-
type Int64Int32MapColumn interface {
Column
}
-
type Int64Int64MapColumn interface {
Column
}
-
type Int64Float32MapColumn interface {
Column
}
-
type Int64Float64MapColumn interface {
Column
}
-
type Int64TimestampMapColumn interface {
Column
}
-
type Int64TimeUUIDMapColumn interface {
Column
}
-
type Int64UUIDMapColumn interface {
Column
}
-
type Int64BooleanMapColumn interface {
Column
}
-
type Int64DecimalMapColumn interface {
Column
}
-
type Int64VarintMapColumn interface {
Column
}
-
type Int64BytesMapColumn interface {
Column
}
-
-
type Float32StringMapColumn interface {
Column
}
-
type Float32Int32MapColumn interface {
Column
}
-
type Float32Int64MapColumn interface {
Column
}
-
type Float32Float32MapColumn interface {
Column
}
-
type Float32Float64MapColumn interface {
Column
}
-
type Float32TimestampMapColumn interface {
Column
}
-
type Float32TimeUUIDMapColumn interface {
Column
}
-
type Float32UUIDMapColumn interface {
Column
}
-
type Float32BooleanMapColumn interface {
Column
}
-
type Float32DecimalMapColumn interface {
Column
}
-
type Float32VarintMapColumn interface {
Column
}
-
type Float32BytesMapColumn interface {
Column
}
-
-
type Float64StringMapColumn interface {
Column
}
-
type Float64Int32MapColumn interface {
Column
}
-
type Float64Int64MapColumn interface {
Column
}
-
type Float64Float32MapColumn interface {
Column
}
-
type Float64Float64MapColumn interface {
Column
}
-
type Float64TimestampMapColumn interface {
Column
}
-
type Float64TimeUUIDMapColumn interface {
Column
}
-
type Float64UUIDMapColumn interface {
Column
}
-
type Float64BooleanMapColumn interface {
Column
}
-
type Float64DecimalMapColumn interface {
Column
}
-
type Float64VarintMapColumn interface {
Column
}
-
type Float64BytesMapColumn interface {
Column
}
-
-
type TimestampStringMapColumn interface {
Column
}
-
type TimestampInt32MapColumn interface {
Column
}
-
type TimestampInt64MapColumn interface {
Column
}
-
type TimestampFloat32MapColumn interface {
Column
}
-
type TimestampFloat64MapColumn interface {
Column
}
-
type TimestampTimestampMapColumn interface {
Column
}
-
type TimestampTimeUUIDMapColumn interface {
Column
}
-
type TimestampUUIDMapColumn interface {
Column
}
-
type TimestampBooleanMapColumn interface {
Column
}
-
type TimestampDecimalMapColumn interface {
Column
}
-
type TimestampVarintMapColumn interface {
Column
}
-
type TimestampBytesMapColumn interface {
Column
}
-
-
type TimeUUIDStringMapColumn interface {
Column
}
-
type TimeUUIDInt32MapColumn interface {
Column
}
-
type TimeUUIDInt64MapColumn interface {
Column
}
-
type TimeUUIDFloat32MapColumn interface {
Column
}
-
type TimeUUIDFloat64MapColumn interface {
Column
}
-
type TimeUUIDTimestampMapColumn interface {
Column
}
-
type TimeUUIDTimeUUIDMapColumn interface {
Column
}
-
type TimeUUIDUUIDMapColumn interface {
Column
}
-
type TimeUUIDBooleanMapColumn interface {
Column
}
-
type TimeUUIDDecimalMapColumn interface {
Column
}
-
type TimeUUIDVarintMapColumn interface {
Column
}
-
type TimeUUIDBytesMapColumn interface {
Column
}
-
-
type UUIDStringMapColumn interface {
Column
}
-
type UUIDInt32MapColumn interface {
Column
}
-
type UUIDInt64MapColumn interface {
Column
}
-
type UUIDFloat32MapColumn interface {
Column
}
-
type UUIDFloat64MapColumn interface {
Column
}
-
type UUIDTimestampMapColumn interface {
Column
}
-
type UUIDTimeUUIDMapColumn interface {
Column
}
-
type UUIDUUIDMapColumn interface {
Column
}
-
type UUIDBooleanMapColumn interface {
Column
}
-
type UUIDDecimalMapColumn interface {
Column
}
-
type UUIDVarintMapColumn interface {
Column
}
-
type UUIDBytesMapColumn interface {
Column
}
-
-
type BooleanStringMapColumn interface {
Column
}
-
type BooleanInt32MapColumn interface {
Column
}
-
type BooleanInt64MapColumn interface {
Column
}
-
type BooleanFloat32MapColumn interface {
Column
}
-
type BooleanFloat64MapColumn interface {
Column
}
-
type BooleanTimestampMapColumn interface {
Column
}
-
type BooleanTimeUUIDMapColumn interface {
Column
}
-
type BooleanUUIDMapColumn interface {
Column
}
-
type BooleanBooleanMapColumn interface {
Column
}
-
type BooleanDecimalMapColumn interface {
Column
}
-
type BooleanVarintMapColumn interface {
Column
}
-
type BooleanBytesMapColumn interface {
Column
}
-
-
type DecimalStringMapColumn interface {
Column
}
-
type DecimalInt32MapColumn interface {
Column
}
-
type DecimalInt64MapColumn interface {
Column
}
-
type DecimalFloat32MapColumn interface {
Column
}
-
type DecimalFloat64MapColumn interface {
Column
}
-
type DecimalTimestampMapColumn interface {
Column
}
-
type DecimalTimeUUIDMapColumn interface {
Column
}
-
type DecimalUUIDMapColumn interface {
Column
}
-
type DecimalBooleanMapColumn interface {
Column
}
-
type DecimalDecimalMapColumn interface {
Column
}
-
type DecimalVarintMapColumn interface {
Column
}
-
type DecimalBytesMapColumn interface {
Column
}
-
-
type VarintStringMapColumn interface {
Column
}
-
type VarintInt32MapColumn interface {
Column
}
-
type VarintInt64MapColumn interface {
Column
}
-
type VarintFloat32MapColumn interface {
Column
}
-
type VarintFloat64MapColumn interface {
Column
}
-
type VarintTimestampMapColumn interface {
Column
}
-
type VarintTimeUUIDMapColumn interface {
Column
}
-
type VarintUUIDMapColumn interface {
Column
}
-
type VarintBooleanMapColumn interface {
Column
}
-
type VarintDecimalMapColumn interface {
Column
}
-
type VarintVarintMapColumn interface {
Column
}
-
type VarintBytesMapColumn interface {
Column
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
type SetValueStep interface {
Executable
SelectWhereStep
Apply(cols ...ColumnBinding) SetValueStep
IfExists(cols ...ColumnBinding) CompareAndSwap
-
SetString(col StringColumn, value string) SetValueStep
-
+
SetInt32(col Int32Column, value int32) SetValueStep
-
+
SetInt64(col Int64Column, value int64) SetValueStep
-
+
SetFloat32(col Float32Column, value float32) SetValueStep
-
+
SetFloat64(col Float64Column, value float64) SetValueStep
-
+
SetTimestamp(col TimestampColumn, value time.Time) SetValueStep
-
+
SetTimeUUID(col TimeUUIDColumn, value gocql.UUID) SetValueStep
-
+
SetUUID(col UUIDColumn, value gocql.UUID) SetValueStep
-
+
SetBoolean(col BooleanColumn, value bool) SetValueStep
-
+
SetDecimal(col DecimalColumn, value *inf.Dec) SetValueStep
-
+
SetVarint(col VarintColumn, value *big.Int) SetValueStep
-
+
SetBytes(col BytesColumn, value []byte) SetValueStep
-
-
-
-
SetStringStringMap(col StringStringMapColumn, value map[string]string) SetValueStep
-
-
+ SetStringStringMapValue(col StringStringMapColumn, key string, value string) SetValueStep
+
SetStringInt32Map(col StringInt32MapColumn, value map[string]int32) SetValueStep
-
-
+ SetStringInt32MapValue(col StringInt32MapColumn, key string, value int32) SetValueStep
+
SetStringInt64Map(col StringInt64MapColumn, value map[string]int64) SetValueStep
-
-
+ SetStringInt64MapValue(col StringInt64MapColumn, key string, value int64) SetValueStep
+
SetStringFloat32Map(col StringFloat32MapColumn, value map[string]float32) SetValueStep
-
-
+ SetStringFloat32MapValue(col StringFloat32MapColumn, key string, value float32) SetValueStep
+
SetStringFloat64Map(col StringFloat64MapColumn, value map[string]float64) SetValueStep
-
-
+ SetStringFloat64MapValue(col StringFloat64MapColumn, key string, value float64) SetValueStep
+
SetStringTimestampMap(col StringTimestampMapColumn, value map[string]time.Time) SetValueStep
-
-
+ SetStringTimestampMapValue(col StringTimestampMapColumn, key string, value time.Time) SetValueStep
+
SetStringTimeUUIDMap(col StringTimeUUIDMapColumn, value map[string]gocql.UUID) SetValueStep
-
-
+ SetStringTimeUUIDMapValue(col StringTimeUUIDMapColumn, key string, value gocql.UUID) SetValueStep
+
SetStringUUIDMap(col StringUUIDMapColumn, value map[string]gocql.UUID) SetValueStep
-
-
+ SetStringUUIDMapValue(col StringUUIDMapColumn, key string, value gocql.UUID) SetValueStep
+
SetStringBooleanMap(col StringBooleanMapColumn, value map[string]bool) SetValueStep
-
-
+ SetStringBooleanMapValue(col StringBooleanMapColumn, key string, value bool) SetValueStep
+
SetStringDecimalMap(col StringDecimalMapColumn, value map[string]*inf.Dec) SetValueStep
-
-
+ SetStringDecimalMapValue(col StringDecimalMapColumn, key string, value *inf.Dec) SetValueStep
+
SetStringVarintMap(col StringVarintMapColumn, value map[string]*big.Int) SetValueStep
-
-
+ SetStringVarintMapValue(col StringVarintMapColumn, key string, value *big.Int) SetValueStep
+
SetStringBytesMap(col StringBytesMapColumn, value map[string][]byte) SetValueStep
-
-
-
+ SetStringBytesMapValue(col StringBytesMapColumn, key string, value []byte) SetValueStep
+
SetInt32StringMap(col Int32StringMapColumn, value map[int32]string) SetValueStep
-
-
+ SetInt32StringMapValue(col Int32StringMapColumn, key int32, value string) SetValueStep
+
SetInt32Int32Map(col Int32Int32MapColumn, value map[int32]int32) SetValueStep
-
-
+ SetInt32Int32MapValue(col Int32Int32MapColumn, key int32, value int32) SetValueStep
+
SetInt32Int64Map(col Int32Int64MapColumn, value map[int32]int64) SetValueStep
-
-
+ SetInt32Int64MapValue(col Int32Int64MapColumn, key int32, value int64) SetValueStep
+
SetInt32Float32Map(col Int32Float32MapColumn, value map[int32]float32) SetValueStep
-
-
+ SetInt32Float32MapValue(col Int32Float32MapColumn, key int32, value float32) SetValueStep
+
SetInt32Float64Map(col Int32Float64MapColumn, value map[int32]float64) SetValueStep
-
-
+ SetInt32Float64MapValue(col Int32Float64MapColumn, key int32, value float64) SetValueStep
+
SetInt32TimestampMap(col Int32TimestampMapColumn, value map[int32]time.Time) SetValueStep
-
-
+ SetInt32TimestampMapValue(col Int32TimestampMapColumn, key int32, value time.Time) SetValueStep
+
SetInt32TimeUUIDMap(col Int32TimeUUIDMapColumn, value map[int32]gocql.UUID) SetValueStep
-
-
+ SetInt32TimeUUIDMapValue(col Int32TimeUUIDMapColumn, key int32, value gocql.UUID) SetValueStep
+
SetInt32UUIDMap(col Int32UUIDMapColumn, value map[int32]gocql.UUID) SetValueStep
-
-
+ SetInt32UUIDMapValue(col Int32UUIDMapColumn, key int32, value gocql.UUID) SetValueStep
+
SetInt32BooleanMap(col Int32BooleanMapColumn, value map[int32]bool) SetValueStep
-
-
+ SetInt32BooleanMapValue(col Int32BooleanMapColumn, key int32, value bool) SetValueStep
+
SetInt32DecimalMap(col Int32DecimalMapColumn, value map[int32]*inf.Dec) SetValueStep
-
-
+ SetInt32DecimalMapValue(col Int32DecimalMapColumn, key int32, value *inf.Dec) SetValueStep
+
SetInt32VarintMap(col Int32VarintMapColumn, value map[int32]*big.Int) SetValueStep
-
-
+ SetInt32VarintMapValue(col Int32VarintMapColumn, key int32, value *big.Int) SetValueStep
+
SetInt32BytesMap(col Int32BytesMapColumn, value map[int32][]byte) SetValueStep
-
-
-
+ SetInt32BytesMapValue(col Int32BytesMapColumn, key int32, value []byte) SetValueStep
+
SetInt64StringMap(col Int64StringMapColumn, value map[int64]string) SetValueStep
-
-
+ SetInt64StringMapValue(col Int64StringMapColumn, key int64, value string) SetValueStep
+
SetInt64Int32Map(col Int64Int32MapColumn, value map[int64]int32) SetValueStep
-
-
+ SetInt64Int32MapValue(col Int64Int32MapColumn, key int64, value int32) SetValueStep
+
SetInt64Int64Map(col Int64Int64MapColumn, value map[int64]int64) SetValueStep
-
-
+ SetInt64Int64MapValue(col Int64Int64MapColumn, key int64, value int64) SetValueStep
+
SetInt64Float32Map(col Int64Float32MapColumn, value map[int64]float32) SetValueStep
-
-
+ SetInt64Float32MapValue(col Int64Float32MapColumn, key int64, value float32) SetValueStep
+
SetInt64Float64Map(col Int64Float64MapColumn, value map[int64]float64) SetValueStep
-
-
+ SetInt64Float64MapValue(col Int64Float64MapColumn, key int64, value float64) SetValueStep
+
SetInt64TimestampMap(col Int64TimestampMapColumn, value map[int64]time.Time) SetValueStep
-
-
+ SetInt64TimestampMapValue(col Int64TimestampMapColumn, key int64, value time.Time) SetValueStep
+
SetInt64TimeUUIDMap(col Int64TimeUUIDMapColumn, value map[int64]gocql.UUID) SetValueStep
-
-
+ SetInt64TimeUUIDMapValue(col Int64TimeUUIDMapColumn, key int64, value gocql.UUID) SetValueStep
+
SetInt64UUIDMap(col Int64UUIDMapColumn, value map[int64]gocql.UUID) SetValueStep
-
-
+ SetInt64UUIDMapValue(col Int64UUIDMapColumn, key int64, value gocql.UUID) SetValueStep
+
SetInt64BooleanMap(col Int64BooleanMapColumn, value map[int64]bool) SetValueStep
-
-
+ SetInt64BooleanMapValue(col Int64BooleanMapColumn, key int64, value bool) SetValueStep
+
SetInt64DecimalMap(col Int64DecimalMapColumn, value map[int64]*inf.Dec) SetValueStep
-
-
+ SetInt64DecimalMapValue(col Int64DecimalMapColumn, key int64, value *inf.Dec) SetValueStep
+
SetInt64VarintMap(col Int64VarintMapColumn, value map[int64]*big.Int) SetValueStep
-
-
+ SetInt64VarintMapValue(col Int64VarintMapColumn, key int64, value *big.Int) SetValueStep
+
SetInt64BytesMap(col Int64BytesMapColumn, value map[int64][]byte) SetValueStep
-
-
-
+ SetInt64BytesMapValue(col Int64BytesMapColumn, key int64, value []byte) SetValueStep
+
SetFloat32StringMap(col Float32StringMapColumn, value map[float32]string) SetValueStep
-
-
+ SetFloat32StringMapValue(col Float32StringMapColumn, key float32, value string) SetValueStep
+
SetFloat32Int32Map(col Float32Int32MapColumn, value map[float32]int32) SetValueStep
-
-
+ SetFloat32Int32MapValue(col Float32Int32MapColumn, key float32, value int32) SetValueStep
+
SetFloat32Int64Map(col Float32Int64MapColumn, value map[float32]int64) SetValueStep
-
-
+ SetFloat32Int64MapValue(col Float32Int64MapColumn, key float32, value int64) SetValueStep
+
SetFloat32Float32Map(col Float32Float32MapColumn, value map[float32]float32) SetValueStep
-
-
+ SetFloat32Float32MapValue(col Float32Float32MapColumn, key float32, value float32) SetValueStep
+
SetFloat32Float64Map(col Float32Float64MapColumn, value map[float32]float64) SetValueStep
-
-
+ SetFloat32Float64MapValue(col Float32Float64MapColumn, key float32, value float64) SetValueStep
+
SetFloat32TimestampMap(col Float32TimestampMapColumn, value map[float32]time.Time) SetValueStep
-
-
+ SetFloat32TimestampMapValue(col Float32TimestampMapColumn, key float32, value time.Time) SetValueStep
+
SetFloat32TimeUUIDMap(col Float32TimeUUIDMapColumn, value map[float32]gocql.UUID) SetValueStep
-
-
+ SetFloat32TimeUUIDMapValue(col Float32TimeUUIDMapColumn, key float32, value gocql.UUID) SetValueStep
+
SetFloat32UUIDMap(col Float32UUIDMapColumn, value map[float32]gocql.UUID) SetValueStep
-
-
+ SetFloat32UUIDMapValue(col Float32UUIDMapColumn, key float32, value gocql.UUID) SetValueStep
+
SetFloat32BooleanMap(col Float32BooleanMapColumn, value map[float32]bool) SetValueStep
-
-
+ SetFloat32BooleanMapValue(col Float32BooleanMapColumn, key float32, value bool) SetValueStep
+
SetFloat32DecimalMap(col Float32DecimalMapColumn, value map[float32]*inf.Dec) SetValueStep
-
-
+ SetFloat32DecimalMapValue(col Float32DecimalMapColumn, key float32, value *inf.Dec) SetValueStep
+
SetFloat32VarintMap(col Float32VarintMapColumn, value map[float32]*big.Int) SetValueStep
-
-
+ SetFloat32VarintMapValue(col Float32VarintMapColumn, key float32, value *big.Int) SetValueStep
+
SetFloat32BytesMap(col Float32BytesMapColumn, value map[float32][]byte) SetValueStep
-
-
-
+ SetFloat32BytesMapValue(col Float32BytesMapColumn, key float32, value []byte) SetValueStep
+
SetFloat64StringMap(col Float64StringMapColumn, value map[float64]string) SetValueStep
-
-
+ SetFloat64StringMapValue(col Float64StringMapColumn, key float64, value string) SetValueStep
+
SetFloat64Int32Map(col Float64Int32MapColumn, value map[float64]int32) SetValueStep
-
-
+ SetFloat64Int32MapValue(col Float64Int32MapColumn, key float64, value int32) SetValueStep
+
SetFloat64Int64Map(col Float64Int64MapColumn, value map[float64]int64) SetValueStep
-
-
+ SetFloat64Int64MapValue(col Float64Int64MapColumn, key float64, value int64) SetValueStep
+
SetFloat64Float32Map(col Float64Float32MapColumn, value map[float64]float32) SetValueStep
-
-
+ SetFloat64Float32MapValue(col Float64Float32MapColumn, key float64, value float32) SetValueStep
+
SetFloat64Float64Map(col Float64Float64MapColumn, value map[float64]float64) SetValueStep
-
-
+ SetFloat64Float64MapValue(col Float64Float64MapColumn, key float64, value float64) SetValueStep
+
SetFloat64TimestampMap(col Float64TimestampMapColumn, value map[float64]time.Time) SetValueStep
-
-
+ SetFloat64TimestampMapValue(col Float64TimestampMapColumn, key float64, value time.Time) SetValueStep
+
SetFloat64TimeUUIDMap(col Float64TimeUUIDMapColumn, value map[float64]gocql.UUID) SetValueStep
-
-
+ SetFloat64TimeUUIDMapValue(col Float64TimeUUIDMapColumn, key float64, value gocql.UUID) SetValueStep
+
SetFloat64UUIDMap(col Float64UUIDMapColumn, value map[float64]gocql.UUID) SetValueStep
-
-
+ SetFloat64UUIDMapValue(col Float64UUIDMapColumn, key float64, value gocql.UUID) SetValueStep
+
SetFloat64BooleanMap(col Float64BooleanMapColumn, value map[float64]bool) SetValueStep
-
-
+ SetFloat64BooleanMapValue(col Float64BooleanMapColumn, key float64, value bool) SetValueStep
+
SetFloat64DecimalMap(col Float64DecimalMapColumn, value map[float64]*inf.Dec) SetValueStep
-
-
+ SetFloat64DecimalMapValue(col Float64DecimalMapColumn, key float64, value *inf.Dec) SetValueStep
+
SetFloat64VarintMap(col Float64VarintMapColumn, value map[float64]*big.Int) SetValueStep
-
-
+ SetFloat64VarintMapValue(col Float64VarintMapColumn, key float64, value *big.Int) SetValueStep
+
SetFloat64BytesMap(col Float64BytesMapColumn, value map[float64][]byte) SetValueStep
-
-
-
+ SetFloat64BytesMapValue(col Float64BytesMapColumn, key float64, value []byte) SetValueStep
+
SetTimestampStringMap(col TimestampStringMapColumn, value map[time.Time]string) SetValueStep
-
-
+ SetTimestampStringMapValue(col TimestampStringMapColumn, key time.Time, value string) SetValueStep
+
SetTimestampInt32Map(col TimestampInt32MapColumn, value map[time.Time]int32) SetValueStep
-
-
+ SetTimestampInt32MapValue(col TimestampInt32MapColumn, key time.Time, value int32) SetValueStep
+
SetTimestampInt64Map(col TimestampInt64MapColumn, value map[time.Time]int64) SetValueStep
-
-
+ SetTimestampInt64MapValue(col TimestampInt64MapColumn, key time.Time, value int64) SetValueStep
+
SetTimestampFloat32Map(col TimestampFloat32MapColumn, value map[time.Time]float32) SetValueStep
-
-
+ SetTimestampFloat32MapValue(col TimestampFloat32MapColumn, key time.Time, value float32) SetValueStep
+
SetTimestampFloat64Map(col TimestampFloat64MapColumn, value map[time.Time]float64) SetValueStep
-
-
+ SetTimestampFloat64MapValue(col TimestampFloat64MapColumn, key time.Time, value float64) SetValueStep
+
SetTimestampTimestampMap(col TimestampTimestampMapColumn, value map[time.Time]time.Time) SetValueStep
-
-
+ SetTimestampTimestampMapValue(col TimestampTimestampMapColumn, key time.Time, value time.Time) SetValueStep
+
SetTimestampTimeUUIDMap(col TimestampTimeUUIDMapColumn, value map[time.Time]gocql.UUID) SetValueStep
-
-
+ SetTimestampTimeUUIDMapValue(col TimestampTimeUUIDMapColumn, key time.Time, value gocql.UUID) SetValueStep
+
SetTimestampUUIDMap(col TimestampUUIDMapColumn, value map[time.Time]gocql.UUID) SetValueStep
-
-
+ SetTimestampUUIDMapValue(col TimestampUUIDMapColumn, key time.Time, value gocql.UUID) SetValueStep
+
SetTimestampBooleanMap(col TimestampBooleanMapColumn, value map[time.Time]bool) SetValueStep
-
-
+ SetTimestampBooleanMapValue(col TimestampBooleanMapColumn, key time.Time, value bool) SetValueStep
+
SetTimestampDecimalMap(col TimestampDecimalMapColumn, value map[time.Time]*inf.Dec) SetValueStep
-
-
+ SetTimestampDecimalMapValue(col TimestampDecimalMapColumn, key time.Time, value *inf.Dec) SetValueStep
+
SetTimestampVarintMap(col TimestampVarintMapColumn, value map[time.Time]*big.Int) SetValueStep
-
-
+ SetTimestampVarintMapValue(col TimestampVarintMapColumn, key time.Time, value *big.Int) SetValueStep
+
SetTimestampBytesMap(col TimestampBytesMapColumn, value map[time.Time][]byte) SetValueStep
-
-
-
+ SetTimestampBytesMapValue(col TimestampBytesMapColumn, key time.Time, value []byte) SetValueStep
+
SetTimeUUIDStringMap(col TimeUUIDStringMapColumn, value map[gocql.UUID]string) SetValueStep
-
-
+ SetTimeUUIDStringMapValue(col TimeUUIDStringMapColumn, key gocql.UUID, value string) SetValueStep
+
SetTimeUUIDInt32Map(col TimeUUIDInt32MapColumn, value map[gocql.UUID]int32) SetValueStep
-
-
+ SetTimeUUIDInt32MapValue(col TimeUUIDInt32MapColumn, key gocql.UUID, value int32) SetValueStep
+
SetTimeUUIDInt64Map(col TimeUUIDInt64MapColumn, value map[gocql.UUID]int64) SetValueStep
-
-
+ SetTimeUUIDInt64MapValue(col TimeUUIDInt64MapColumn, key gocql.UUID, value int64) SetValueStep
+
SetTimeUUIDFloat32Map(col TimeUUIDFloat32MapColumn, value map[gocql.UUID]float32) SetValueStep
-
-
+ SetTimeUUIDFloat32MapValue(col TimeUUIDFloat32MapColumn, key gocql.UUID, value float32) SetValueStep
+
SetTimeUUIDFloat64Map(col TimeUUIDFloat64MapColumn, value map[gocql.UUID]float64) SetValueStep
-
-
+ SetTimeUUIDFloat64MapValue(col TimeUUIDFloat64MapColumn, key gocql.UUID, value float64) SetValueStep
+
SetTimeUUIDTimestampMap(col TimeUUIDTimestampMapColumn, value map[gocql.UUID]time.Time) SetValueStep
-
-
+ SetTimeUUIDTimestampMapValue(col TimeUUIDTimestampMapColumn, key gocql.UUID, value time.Time) SetValueStep
+
SetTimeUUIDTimeUUIDMap(col TimeUUIDTimeUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep
-
-
+ SetTimeUUIDTimeUUIDMapValue(col TimeUUIDTimeUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep
+
SetTimeUUIDUUIDMap(col TimeUUIDUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep
-
-
+ SetTimeUUIDUUIDMapValue(col TimeUUIDUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep
+
SetTimeUUIDBooleanMap(col TimeUUIDBooleanMapColumn, value map[gocql.UUID]bool) SetValueStep
-
-
+ SetTimeUUIDBooleanMapValue(col TimeUUIDBooleanMapColumn, key gocql.UUID, value bool) SetValueStep
+
SetTimeUUIDDecimalMap(col TimeUUIDDecimalMapColumn, value map[gocql.UUID]*inf.Dec) SetValueStep
-
-
+ SetTimeUUIDDecimalMapValue(col TimeUUIDDecimalMapColumn, key gocql.UUID, value *inf.Dec) SetValueStep
+
SetTimeUUIDVarintMap(col TimeUUIDVarintMapColumn, value map[gocql.UUID]*big.Int) SetValueStep
-
-
+ SetTimeUUIDVarintMapValue(col TimeUUIDVarintMapColumn, key gocql.UUID, value *big.Int) SetValueStep
+
SetTimeUUIDBytesMap(col TimeUUIDBytesMapColumn, value map[gocql.UUID][]byte) SetValueStep
-
-
-
+ SetTimeUUIDBytesMapValue(col TimeUUIDBytesMapColumn, key gocql.UUID, value []byte) SetValueStep
+
SetUUIDStringMap(col UUIDStringMapColumn, value map[gocql.UUID]string) SetValueStep
-
-
+ SetUUIDStringMapValue(col UUIDStringMapColumn, key gocql.UUID, value string) SetValueStep
+
SetUUIDInt32Map(col UUIDInt32MapColumn, value map[gocql.UUID]int32) SetValueStep
-
-
+ SetUUIDInt32MapValue(col UUIDInt32MapColumn, key gocql.UUID, value int32) SetValueStep
+
SetUUIDInt64Map(col UUIDInt64MapColumn, value map[gocql.UUID]int64) SetValueStep
-
-
+ SetUUIDInt64MapValue(col UUIDInt64MapColumn, key gocql.UUID, value int64) SetValueStep
+
SetUUIDFloat32Map(col UUIDFloat32MapColumn, value map[gocql.UUID]float32) SetValueStep
-
-
+ SetUUIDFloat32MapValue(col UUIDFloat32MapColumn, key gocql.UUID, value float32) SetValueStep
+
SetUUIDFloat64Map(col UUIDFloat64MapColumn, value map[gocql.UUID]float64) SetValueStep
-
-
+ SetUUIDFloat64MapValue(col UUIDFloat64MapColumn, key gocql.UUID, value float64) SetValueStep
+
SetUUIDTimestampMap(col UUIDTimestampMapColumn, value map[gocql.UUID]time.Time) SetValueStep
-
-
+ SetUUIDTimestampMapValue(col UUIDTimestampMapColumn, key gocql.UUID, value time.Time) SetValueStep
+
SetUUIDTimeUUIDMap(col UUIDTimeUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep
-
-
+ SetUUIDTimeUUIDMapValue(col UUIDTimeUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep
+
SetUUIDUUIDMap(col UUIDUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep
-
-
+ SetUUIDUUIDMapValue(col UUIDUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep
+
SetUUIDBooleanMap(col UUIDBooleanMapColumn, value map[gocql.UUID]bool) SetValueStep
-
-
+ SetUUIDBooleanMapValue(col UUIDBooleanMapColumn, key gocql.UUID, value bool) SetValueStep
+
SetUUIDDecimalMap(col UUIDDecimalMapColumn, value map[gocql.UUID]*inf.Dec) SetValueStep
-
-
+ SetUUIDDecimalMapValue(col UUIDDecimalMapColumn, key gocql.UUID, value *inf.Dec) SetValueStep
+
SetUUIDVarintMap(col UUIDVarintMapColumn, value map[gocql.UUID]*big.Int) SetValueStep
-
-
+ SetUUIDVarintMapValue(col UUIDVarintMapColumn, key gocql.UUID, value *big.Int) SetValueStep
+
SetUUIDBytesMap(col UUIDBytesMapColumn, value map[gocql.UUID][]byte) SetValueStep
-
-
-
+ SetUUIDBytesMapValue(col UUIDBytesMapColumn, key gocql.UUID, value []byte) SetValueStep
+
SetBooleanStringMap(col BooleanStringMapColumn, value map[bool]string) SetValueStep
-
-
+ SetBooleanStringMapValue(col BooleanStringMapColumn, key bool, value string) SetValueStep
+
SetBooleanInt32Map(col BooleanInt32MapColumn, value map[bool]int32) SetValueStep
-
-
+ SetBooleanInt32MapValue(col BooleanInt32MapColumn, key bool, value int32) SetValueStep
+
SetBooleanInt64Map(col BooleanInt64MapColumn, value map[bool]int64) SetValueStep
-
-
+ SetBooleanInt64MapValue(col BooleanInt64MapColumn, key bool, value int64) SetValueStep
+
SetBooleanFloat32Map(col BooleanFloat32MapColumn, value map[bool]float32) SetValueStep
-
-
+ SetBooleanFloat32MapValue(col BooleanFloat32MapColumn, key bool, value float32) SetValueStep
+
SetBooleanFloat64Map(col BooleanFloat64MapColumn, value map[bool]float64) SetValueStep
-
-
+ SetBooleanFloat64MapValue(col BooleanFloat64MapColumn, key bool, value float64) SetValueStep
+
SetBooleanTimestampMap(col BooleanTimestampMapColumn, value map[bool]time.Time) SetValueStep
-
-
+ SetBooleanTimestampMapValue(col BooleanTimestampMapColumn, key bool, value time.Time) SetValueStep
+
SetBooleanTimeUUIDMap(col BooleanTimeUUIDMapColumn, value map[bool]gocql.UUID) SetValueStep
-
-
+ SetBooleanTimeUUIDMapValue(col BooleanTimeUUIDMapColumn, key bool, value gocql.UUID) SetValueStep
+
SetBooleanUUIDMap(col BooleanUUIDMapColumn, value map[bool]gocql.UUID) SetValueStep
-
-
+ SetBooleanUUIDMapValue(col BooleanUUIDMapColumn, key bool, value gocql.UUID) SetValueStep
+
SetBooleanBooleanMap(col BooleanBooleanMapColumn, value map[bool]bool) SetValueStep
-
-
+ SetBooleanBooleanMapValue(col BooleanBooleanMapColumn, key bool, value bool) SetValueStep
+
SetBooleanDecimalMap(col BooleanDecimalMapColumn, value map[bool]*inf.Dec) SetValueStep
-
-
+ SetBooleanDecimalMapValue(col BooleanDecimalMapColumn, key bool, value *inf.Dec) SetValueStep
+
SetBooleanVarintMap(col BooleanVarintMapColumn, value map[bool]*big.Int) SetValueStep
-
-
+ SetBooleanVarintMapValue(col BooleanVarintMapColumn, key bool, value *big.Int) SetValueStep
+
SetBooleanBytesMap(col BooleanBytesMapColumn, value map[bool][]byte) SetValueStep
-
-
-
+ SetBooleanBytesMapValue(col BooleanBytesMapColumn, key bool, value []byte) SetValueStep
+
SetDecimalStringMap(col DecimalStringMapColumn, value map[*inf.Dec]string) SetValueStep
-
-
+ SetDecimalStringMapValue(col DecimalStringMapColumn, key *inf.Dec, value string) SetValueStep
+
SetDecimalInt32Map(col DecimalInt32MapColumn, value map[*inf.Dec]int32) SetValueStep
-
-
+ SetDecimalInt32MapValue(col DecimalInt32MapColumn, key *inf.Dec, value int32) SetValueStep
+
SetDecimalInt64Map(col DecimalInt64MapColumn, value map[*inf.Dec]int64) SetValueStep
-
-
+ SetDecimalInt64MapValue(col DecimalInt64MapColumn, key *inf.Dec, value int64) SetValueStep
+
SetDecimalFloat32Map(col DecimalFloat32MapColumn, value map[*inf.Dec]float32) SetValueStep
-
-
+ SetDecimalFloat32MapValue(col DecimalFloat32MapColumn, key *inf.Dec, value float32) SetValueStep
+
SetDecimalFloat64Map(col DecimalFloat64MapColumn, value map[*inf.Dec]float64) SetValueStep
-
-
+ SetDecimalFloat64MapValue(col DecimalFloat64MapColumn, key *inf.Dec, value float64) SetValueStep
+
SetDecimalTimestampMap(col DecimalTimestampMapColumn, value map[*inf.Dec]time.Time) SetValueStep
-
-
+ SetDecimalTimestampMapValue(col DecimalTimestampMapColumn, key *inf.Dec, value time.Time) SetValueStep
+
SetDecimalTimeUUIDMap(col DecimalTimeUUIDMapColumn, value map[*inf.Dec]gocql.UUID) SetValueStep
-
-
+ SetDecimalTimeUUIDMapValue(col DecimalTimeUUIDMapColumn, key *inf.Dec, value gocql.UUID) SetValueStep
+
SetDecimalUUIDMap(col DecimalUUIDMapColumn, value map[*inf.Dec]gocql.UUID) SetValueStep
-
-
+ SetDecimalUUIDMapValue(col DecimalUUIDMapColumn, key *inf.Dec, value gocql.UUID) SetValueStep
+
SetDecimalBooleanMap(col DecimalBooleanMapColumn, value map[*inf.Dec]bool) SetValueStep
-
-
+ SetDecimalBooleanMapValue(col DecimalBooleanMapColumn, key *inf.Dec, value bool) SetValueStep
+
SetDecimalDecimalMap(col DecimalDecimalMapColumn, value map[*inf.Dec]*inf.Dec) SetValueStep
-
-
+ SetDecimalDecimalMapValue(col DecimalDecimalMapColumn, key *inf.Dec, value *inf.Dec) SetValueStep
+
SetDecimalVarintMap(col DecimalVarintMapColumn, value map[*inf.Dec]*big.Int) SetValueStep
-
-
+ SetDecimalVarintMapValue(col DecimalVarintMapColumn, key *inf.Dec, value *big.Int) SetValueStep
+
SetDecimalBytesMap(col DecimalBytesMapColumn, value map[*inf.Dec][]byte) SetValueStep
-
-
-
+ SetDecimalBytesMapValue(col DecimalBytesMapColumn, key *inf.Dec, value []byte) SetValueStep
+
SetVarintStringMap(col VarintStringMapColumn, value map[*big.Int]string) SetValueStep
-
-
+ SetVarintStringMapValue(col VarintStringMapColumn, key *big.Int, value string) SetValueStep
+
SetVarintInt32Map(col VarintInt32MapColumn, value map[*big.Int]int32) SetValueStep
-
-
+ SetVarintInt32MapValue(col VarintInt32MapColumn, key *big.Int, value int32) SetValueStep
+
SetVarintInt64Map(col VarintInt64MapColumn, value map[*big.Int]int64) SetValueStep
-
-
+ SetVarintInt64MapValue(col VarintInt64MapColumn, key *big.Int, value int64) SetValueStep
+
SetVarintFloat32Map(col VarintFloat32MapColumn, value map[*big.Int]float32) SetValueStep
-
-
+ SetVarintFloat32MapValue(col VarintFloat32MapColumn, key *big.Int, value float32) SetValueStep
+
SetVarintFloat64Map(col VarintFloat64MapColumn, value map[*big.Int]float64) SetValueStep
-
-
+ SetVarintFloat64MapValue(col VarintFloat64MapColumn, key *big.Int, value float64) SetValueStep
+
SetVarintTimestampMap(col VarintTimestampMapColumn, value map[*big.Int]time.Time) SetValueStep
-
-
+ SetVarintTimestampMapValue(col VarintTimestampMapColumn, key *big.Int, value time.Time) SetValueStep
+
SetVarintTimeUUIDMap(col VarintTimeUUIDMapColumn, value map[*big.Int]gocql.UUID) SetValueStep
-
-
+ SetVarintTimeUUIDMapValue(col VarintTimeUUIDMapColumn, key *big.Int, value gocql.UUID) SetValueStep
+
SetVarintUUIDMap(col VarintUUIDMapColumn, value map[*big.Int]gocql.UUID) SetValueStep
-
-
+ SetVarintUUIDMapValue(col VarintUUIDMapColumn, key *big.Int, value gocql.UUID) SetValueStep
+
SetVarintBooleanMap(col VarintBooleanMapColumn, value map[*big.Int]bool) SetValueStep
-
-
+ SetVarintBooleanMapValue(col VarintBooleanMapColumn, key *big.Int, value bool) SetValueStep
+
SetVarintDecimalMap(col VarintDecimalMapColumn, value map[*big.Int]*inf.Dec) SetValueStep
-
-
+ SetVarintDecimalMapValue(col VarintDecimalMapColumn, key *big.Int, value *inf.Dec) SetValueStep
+
SetVarintVarintMap(col VarintVarintMapColumn, value map[*big.Int]*big.Int) SetValueStep
-
-
+ SetVarintVarintMapValue(col VarintVarintMapColumn, key *big.Int, value *big.Int) SetValueStep
+
SetVarintBytesMap(col VarintBytesMapColumn, value map[*big.Int][]byte) SetValueStep
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ SetVarintBytesMapValue(col VarintBytesMapColumn, key *big.Int, value []byte) SetValueStep
+
SetStringSlice(col StringSliceColumn, value []string) SetValueStep
AppendStringSlice(col StringSliceColumn, values ...string) SetValueStep
PrependStringSlice(col StringSliceColumn, values ...string) SetValueStep
RemoveStringSlice(col StringSliceColumn, values ...string) SetValueStep
-
+
SetInt32Slice(col Int32SliceColumn, value []int32) SetValueStep
AppendInt32Slice(col Int32SliceColumn, values ...int32) SetValueStep
PrependInt32Slice(col Int32SliceColumn, values ...int32) SetValueStep
RemoveInt32Slice(col Int32SliceColumn, values ...int32) SetValueStep
-
+
SetInt64Slice(col Int64SliceColumn, value []int64) SetValueStep
AppendInt64Slice(col Int64SliceColumn, values ...int64) SetValueStep
PrependInt64Slice(col Int64SliceColumn, values ...int64) SetValueStep
RemoveInt64Slice(col Int64SliceColumn, values ...int64) SetValueStep
-
+
SetFloat32Slice(col Float32SliceColumn, value []float32) SetValueStep
AppendFloat32Slice(col Float32SliceColumn, values ...float32) SetValueStep
PrependFloat32Slice(col Float32SliceColumn, values ...float32) SetValueStep
RemoveFloat32Slice(col Float32SliceColumn, values ...float32) SetValueStep
-
+
SetFloat64Slice(col Float64SliceColumn, value []float64) SetValueStep
AppendFloat64Slice(col Float64SliceColumn, values ...float64) SetValueStep
PrependFloat64Slice(col Float64SliceColumn, values ...float64) SetValueStep
RemoveFloat64Slice(col Float64SliceColumn, values ...float64) SetValueStep
-
+
SetTimestampSlice(col TimestampSliceColumn, value []time.Time) SetValueStep
AppendTimestampSlice(col TimestampSliceColumn, values ...time.Time) SetValueStep
PrependTimestampSlice(col TimestampSliceColumn, values ...time.Time) SetValueStep
RemoveTimestampSlice(col TimestampSliceColumn, values ...time.Time) SetValueStep
-
+
SetTimeUUIDSlice(col TimeUUIDSliceColumn, value []gocql.UUID) SetValueStep
AppendTimeUUIDSlice(col TimeUUIDSliceColumn, values ...gocql.UUID) SetValueStep
PrependTimeUUIDSlice(col TimeUUIDSliceColumn, values ...gocql.UUID) SetValueStep
RemoveTimeUUIDSlice(col TimeUUIDSliceColumn, values ...gocql.UUID) SetValueStep
-
+
SetUUIDSlice(col UUIDSliceColumn, value []gocql.UUID) SetValueStep
AppendUUIDSlice(col UUIDSliceColumn, values ...gocql.UUID) SetValueStep
PrependUUIDSlice(col UUIDSliceColumn, values ...gocql.UUID) SetValueStep
RemoveUUIDSlice(col UUIDSliceColumn, values ...gocql.UUID) SetValueStep
-
+
SetBooleanSlice(col BooleanSliceColumn, value []bool) SetValueStep
AppendBooleanSlice(col BooleanSliceColumn, values ...bool) SetValueStep
PrependBooleanSlice(col BooleanSliceColumn, values ...bool) SetValueStep
RemoveBooleanSlice(col BooleanSliceColumn, values ...bool) SetValueStep
-
+
SetDecimalSlice(col DecimalSliceColumn, value []*inf.Dec) SetValueStep
AppendDecimalSlice(col DecimalSliceColumn, values ...*inf.Dec) SetValueStep
PrependDecimalSlice(col DecimalSliceColumn, values ...*inf.Dec) SetValueStep
RemoveDecimalSlice(col DecimalSliceColumn, values ...*inf.Dec) SetValueStep
-
+
SetVarintSlice(col VarintSliceColumn, value []*big.Int) SetValueStep
AppendVarintSlice(col VarintSliceColumn, values ...*big.Int) SetValueStep
PrependVarintSlice(col VarintSliceColumn, values ...*big.Int) SetValueStep
RemoveVarintSlice(col VarintSliceColumn, values ...*big.Int) SetValueStep
-
+
SetBytesSlice(col BytesSliceColumn, value [][]byte) SetValueStep
AppendBytesSlice(col BytesSliceColumn, values ...[]byte) SetValueStep
PrependBytesSlice(col BytesSliceColumn, values ...[]byte) SetValueStep
RemoveBytesSlice(col BytesSliceColumn, values ...[]byte) SetValueStep
-
}
-
-
-
func (c *Context) SetStringStringMap(col StringStringMapColumn, value map[string]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringInt32Map(col StringInt32MapColumn, value map[string]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringInt64Map(col StringInt64MapColumn, value map[string]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringFloat32Map(col StringFloat32MapColumn, value map[string]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringFloat64Map(col StringFloat64MapColumn, value map[string]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringTimestampMap(col StringTimestampMapColumn, value map[string]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringTimeUUIDMap(col StringTimeUUIDMapColumn, value map[string]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringUUIDMap(col StringUUIDMapColumn, value map[string]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringBooleanMap(col StringBooleanMapColumn, value map[string]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringDecimalMap(col StringDecimalMapColumn, value map[string]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringVarintMap(col StringVarintMapColumn, value map[string]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetStringBytesMap(col StringBytesMapColumn, value map[string][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetInt32StringMap(col Int32StringMapColumn, value map[int32]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32Int32Map(col Int32Int32MapColumn, value map[int32]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32Int64Map(col Int32Int64MapColumn, value map[int32]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32Float32Map(col Int32Float32MapColumn, value map[int32]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32Float64Map(col Int32Float64MapColumn, value map[int32]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32TimestampMap(col Int32TimestampMapColumn, value map[int32]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32TimeUUIDMap(col Int32TimeUUIDMapColumn, value map[int32]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32UUIDMap(col Int32UUIDMapColumn, value map[int32]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32BooleanMap(col Int32BooleanMapColumn, value map[int32]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32DecimalMap(col Int32DecimalMapColumn, value map[int32]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32VarintMap(col Int32VarintMapColumn, value map[int32]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt32BytesMap(col Int32BytesMapColumn, value map[int32][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetInt64StringMap(col Int64StringMapColumn, value map[int64]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64Int32Map(col Int64Int32MapColumn, value map[int64]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64Int64Map(col Int64Int64MapColumn, value map[int64]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64Float32Map(col Int64Float32MapColumn, value map[int64]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64Float64Map(col Int64Float64MapColumn, value map[int64]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64TimestampMap(col Int64TimestampMapColumn, value map[int64]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64TimeUUIDMap(col Int64TimeUUIDMapColumn, value map[int64]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64UUIDMap(col Int64UUIDMapColumn, value map[int64]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64BooleanMap(col Int64BooleanMapColumn, value map[int64]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64DecimalMap(col Int64DecimalMapColumn, value map[int64]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64VarintMap(col Int64VarintMapColumn, value map[int64]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetInt64BytesMap(col Int64BytesMapColumn, value map[int64][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetFloat32StringMap(col Float32StringMapColumn, value map[float32]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32Int32Map(col Float32Int32MapColumn, value map[float32]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32Int64Map(col Float32Int64MapColumn, value map[float32]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32Float32Map(col Float32Float32MapColumn, value map[float32]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32Float64Map(col Float32Float64MapColumn, value map[float32]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32TimestampMap(col Float32TimestampMapColumn, value map[float32]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32TimeUUIDMap(col Float32TimeUUIDMapColumn, value map[float32]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32UUIDMap(col Float32UUIDMapColumn, value map[float32]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32BooleanMap(col Float32BooleanMapColumn, value map[float32]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32DecimalMap(col Float32DecimalMapColumn, value map[float32]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32VarintMap(col Float32VarintMapColumn, value map[float32]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat32BytesMap(col Float32BytesMapColumn, value map[float32][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetFloat64StringMap(col Float64StringMapColumn, value map[float64]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64Int32Map(col Float64Int32MapColumn, value map[float64]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64Int64Map(col Float64Int64MapColumn, value map[float64]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64Float32Map(col Float64Float32MapColumn, value map[float64]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64Float64Map(col Float64Float64MapColumn, value map[float64]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64TimestampMap(col Float64TimestampMapColumn, value map[float64]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64TimeUUIDMap(col Float64TimeUUIDMapColumn, value map[float64]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64UUIDMap(col Float64UUIDMapColumn, value map[float64]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64BooleanMap(col Float64BooleanMapColumn, value map[float64]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64DecimalMap(col Float64DecimalMapColumn, value map[float64]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64VarintMap(col Float64VarintMapColumn, value map[float64]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetFloat64BytesMap(col Float64BytesMapColumn, value map[float64][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetTimestampStringMap(col TimestampStringMapColumn, value map[time.Time]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampInt32Map(col TimestampInt32MapColumn, value map[time.Time]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampInt64Map(col TimestampInt64MapColumn, value map[time.Time]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampFloat32Map(col TimestampFloat32MapColumn, value map[time.Time]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampFloat64Map(col TimestampFloat64MapColumn, value map[time.Time]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampTimestampMap(col TimestampTimestampMapColumn, value map[time.Time]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampTimeUUIDMap(col TimestampTimeUUIDMapColumn, value map[time.Time]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampUUIDMap(col TimestampUUIDMapColumn, value map[time.Time]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampBooleanMap(col TimestampBooleanMapColumn, value map[time.Time]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampDecimalMap(col TimestampDecimalMapColumn, value map[time.Time]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampVarintMap(col TimestampVarintMapColumn, value map[time.Time]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimestampBytesMap(col TimestampBytesMapColumn, value map[time.Time][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetTimeUUIDStringMap(col TimeUUIDStringMapColumn, value map[gocql.UUID]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDInt32Map(col TimeUUIDInt32MapColumn, value map[gocql.UUID]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDInt64Map(col TimeUUIDInt64MapColumn, value map[gocql.UUID]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDFloat32Map(col TimeUUIDFloat32MapColumn, value map[gocql.UUID]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDFloat64Map(col TimeUUIDFloat64MapColumn, value map[gocql.UUID]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDTimestampMap(col TimeUUIDTimestampMapColumn, value map[gocql.UUID]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDTimeUUIDMap(col TimeUUIDTimeUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDUUIDMap(col TimeUUIDUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDBooleanMap(col TimeUUIDBooleanMapColumn, value map[gocql.UUID]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDDecimalMap(col TimeUUIDDecimalMapColumn, value map[gocql.UUID]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDVarintMap(col TimeUUIDVarintMapColumn, value map[gocql.UUID]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetTimeUUIDBytesMap(col TimeUUIDBytesMapColumn, value map[gocql.UUID][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetUUIDStringMap(col UUIDStringMapColumn, value map[gocql.UUID]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDInt32Map(col UUIDInt32MapColumn, value map[gocql.UUID]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDInt64Map(col UUIDInt64MapColumn, value map[gocql.UUID]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDFloat32Map(col UUIDFloat32MapColumn, value map[gocql.UUID]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDFloat64Map(col UUIDFloat64MapColumn, value map[gocql.UUID]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDTimestampMap(col UUIDTimestampMapColumn, value map[gocql.UUID]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDTimeUUIDMap(col UUIDTimeUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDUUIDMap(col UUIDUUIDMapColumn, value map[gocql.UUID]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDBooleanMap(col UUIDBooleanMapColumn, value map[gocql.UUID]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDDecimalMap(col UUIDDecimalMapColumn, value map[gocql.UUID]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDVarintMap(col UUIDVarintMapColumn, value map[gocql.UUID]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetUUIDBytesMap(col UUIDBytesMapColumn, value map[gocql.UUID][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetBooleanStringMap(col BooleanStringMapColumn, value map[bool]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanInt32Map(col BooleanInt32MapColumn, value map[bool]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanInt64Map(col BooleanInt64MapColumn, value map[bool]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanFloat32Map(col BooleanFloat32MapColumn, value map[bool]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanFloat64Map(col BooleanFloat64MapColumn, value map[bool]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanTimestampMap(col BooleanTimestampMapColumn, value map[bool]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanTimeUUIDMap(col BooleanTimeUUIDMapColumn, value map[bool]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanUUIDMap(col BooleanUUIDMapColumn, value map[bool]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanBooleanMap(col BooleanBooleanMapColumn, value map[bool]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanDecimalMap(col BooleanDecimalMapColumn, value map[bool]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanVarintMap(col BooleanVarintMapColumn, value map[bool]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetBooleanBytesMap(col BooleanBytesMapColumn, value map[bool][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetDecimalStringMap(col DecimalStringMapColumn, value map[*inf.Dec]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalInt32Map(col DecimalInt32MapColumn, value map[*inf.Dec]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalInt64Map(col DecimalInt64MapColumn, value map[*inf.Dec]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalFloat32Map(col DecimalFloat32MapColumn, value map[*inf.Dec]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalFloat64Map(col DecimalFloat64MapColumn, value map[*inf.Dec]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalTimestampMap(col DecimalTimestampMapColumn, value map[*inf.Dec]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalTimeUUIDMap(col DecimalTimeUUIDMapColumn, value map[*inf.Dec]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalUUIDMap(col DecimalUUIDMapColumn, value map[*inf.Dec]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalBooleanMap(col DecimalBooleanMapColumn, value map[*inf.Dec]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalDecimalMap(col DecimalDecimalMapColumn, value map[*inf.Dec]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalVarintMap(col DecimalVarintMapColumn, value map[*inf.Dec]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetDecimalBytesMap(col DecimalBytesMapColumn, value map[*inf.Dec][]byte) SetValueStep {
set(c, col, value)
return c
}
-
-
func (c *Context) SetVarintStringMap(col VarintStringMapColumn, value map[*big.Int]string) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintInt32Map(col VarintInt32MapColumn, value map[*big.Int]int32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintInt64Map(col VarintInt64MapColumn, value map[*big.Int]int64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintFloat32Map(col VarintFloat32MapColumn, value map[*big.Int]float32) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintFloat64Map(col VarintFloat64MapColumn, value map[*big.Int]float64) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintTimestampMap(col VarintTimestampMapColumn, value map[*big.Int]time.Time) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintTimeUUIDMap(col VarintTimeUUIDMapColumn, value map[*big.Int]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintUUIDMap(col VarintUUIDMapColumn, value map[*big.Int]gocql.UUID) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintBooleanMap(col VarintBooleanMapColumn, value map[*big.Int]bool) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintDecimalMap(col VarintDecimalMapColumn, value map[*big.Int]*inf.Dec) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintVarintMap(col VarintVarintMapColumn, value map[*big.Int]*big.Int) SetValueStep {
set(c, col, value)
return c
}
-
func (c *Context) SetVarintBytesMap(col VarintBytesMapColumn, value map[*big.Int][]byte) SetValueStep {
set(c, col, value)
return c
}
+func (c *Context) SetStringStringMapValue(col StringStringMapColumn, key string, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringInt32MapValue(col StringInt32MapColumn, key string, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringInt64MapValue(col StringInt64MapColumn, key string, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringFloat32MapValue(col StringFloat32MapColumn, key string, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringFloat64MapValue(col StringFloat64MapColumn, key string, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringTimestampMapValue(col StringTimestampMapColumn, key string, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringTimeUUIDMapValue(col StringTimeUUIDMapColumn, key string, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringUUIDMapValue(col StringUUIDMapColumn, key string, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringBooleanMapValue(col StringBooleanMapColumn, key string, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringDecimalMapValue(col StringDecimalMapColumn, key string, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetStringVarintMapValue(col StringVarintMapColumn, key string, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetStringBytesMapValue(col StringBytesMapColumn, key string, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32StringMapValue(col Int32StringMapColumn, key int32, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32Int32MapValue(col Int32Int32MapColumn, key int32, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32Int64MapValue(col Int32Int64MapColumn, key int32, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32Float32MapValue(col Int32Float32MapColumn, key int32, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32Float64MapValue(col Int32Float64MapColumn, key int32, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32TimestampMapValue(col Int32TimestampMapColumn, key int32, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32TimeUUIDMapValue(col Int32TimeUUIDMapColumn, key int32, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32UUIDMapValue(col Int32UUIDMapColumn, key int32, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32BooleanMapValue(col Int32BooleanMapColumn, key int32, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32DecimalMapValue(col Int32DecimalMapColumn, key int32, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32VarintMapValue(col Int32VarintMapColumn, key int32, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt32BytesMapValue(col Int32BytesMapColumn, key int32, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64StringMapValue(col Int64StringMapColumn, key int64, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64Int32MapValue(col Int64Int32MapColumn, key int64, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64Int64MapValue(col Int64Int64MapColumn, key int64, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64Float32MapValue(col Int64Float32MapColumn, key int64, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64Float64MapValue(col Int64Float64MapColumn, key int64, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64TimestampMapValue(col Int64TimestampMapColumn, key int64, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64TimeUUIDMapValue(col Int64TimeUUIDMapColumn, key int64, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64UUIDMapValue(col Int64UUIDMapColumn, key int64, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64BooleanMapValue(col Int64BooleanMapColumn, key int64, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64DecimalMapValue(col Int64DecimalMapColumn, key int64, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64VarintMapValue(col Int64VarintMapColumn, key int64, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetInt64BytesMapValue(col Int64BytesMapColumn, key int64, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32StringMapValue(col Float32StringMapColumn, key float32, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32Int32MapValue(col Float32Int32MapColumn, key float32, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32Int64MapValue(col Float32Int64MapColumn, key float32, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32Float32MapValue(col Float32Float32MapColumn, key float32, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32Float64MapValue(col Float32Float64MapColumn, key float32, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32TimestampMapValue(col Float32TimestampMapColumn, key float32, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32TimeUUIDMapValue(col Float32TimeUUIDMapColumn, key float32, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32UUIDMapValue(col Float32UUIDMapColumn, key float32, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32BooleanMapValue(col Float32BooleanMapColumn, key float32, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32DecimalMapValue(col Float32DecimalMapColumn, key float32, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32VarintMapValue(col Float32VarintMapColumn, key float32, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat32BytesMapValue(col Float32BytesMapColumn, key float32, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64StringMapValue(col Float64StringMapColumn, key float64, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64Int32MapValue(col Float64Int32MapColumn, key float64, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64Int64MapValue(col Float64Int64MapColumn, key float64, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64Float32MapValue(col Float64Float32MapColumn, key float64, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64Float64MapValue(col Float64Float64MapColumn, key float64, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64TimestampMapValue(col Float64TimestampMapColumn, key float64, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64TimeUUIDMapValue(col Float64TimeUUIDMapColumn, key float64, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64UUIDMapValue(col Float64UUIDMapColumn, key float64, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64BooleanMapValue(col Float64BooleanMapColumn, key float64, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64DecimalMapValue(col Float64DecimalMapColumn, key float64, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64VarintMapValue(col Float64VarintMapColumn, key float64, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetFloat64BytesMapValue(col Float64BytesMapColumn, key float64, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampStringMapValue(col TimestampStringMapColumn, key time.Time, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampInt32MapValue(col TimestampInt32MapColumn, key time.Time, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampInt64MapValue(col TimestampInt64MapColumn, key time.Time, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampFloat32MapValue(col TimestampFloat32MapColumn, key time.Time, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampFloat64MapValue(col TimestampFloat64MapColumn, key time.Time, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampTimestampMapValue(col TimestampTimestampMapColumn, key time.Time, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampTimeUUIDMapValue(col TimestampTimeUUIDMapColumn, key time.Time, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampUUIDMapValue(col TimestampUUIDMapColumn, key time.Time, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampBooleanMapValue(col TimestampBooleanMapColumn, key time.Time, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampDecimalMapValue(col TimestampDecimalMapColumn, key time.Time, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimestampVarintMapValue(col TimestampVarintMapColumn, key time.Time, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetTimestampBytesMapValue(col TimestampBytesMapColumn, key time.Time, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDStringMapValue(col TimeUUIDStringMapColumn, key gocql.UUID, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDInt32MapValue(col TimeUUIDInt32MapColumn, key gocql.UUID, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDInt64MapValue(col TimeUUIDInt64MapColumn, key gocql.UUID, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDFloat32MapValue(col TimeUUIDFloat32MapColumn, key gocql.UUID, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDFloat64MapValue(col TimeUUIDFloat64MapColumn, key gocql.UUID, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDTimestampMapValue(col TimeUUIDTimestampMapColumn, key gocql.UUID, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDTimeUUIDMapValue(col TimeUUIDTimeUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDUUIDMapValue(col TimeUUIDUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDBooleanMapValue(col TimeUUIDBooleanMapColumn, key gocql.UUID, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDDecimalMapValue(col TimeUUIDDecimalMapColumn, key gocql.UUID, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDVarintMapValue(col TimeUUIDVarintMapColumn, key gocql.UUID, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetTimeUUIDBytesMapValue(col TimeUUIDBytesMapColumn, key gocql.UUID, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDStringMapValue(col UUIDStringMapColumn, key gocql.UUID, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDInt32MapValue(col UUIDInt32MapColumn, key gocql.UUID, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDInt64MapValue(col UUIDInt64MapColumn, key gocql.UUID, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDFloat32MapValue(col UUIDFloat32MapColumn, key gocql.UUID, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDFloat64MapValue(col UUIDFloat64MapColumn, key gocql.UUID, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDTimestampMapValue(col UUIDTimestampMapColumn, key gocql.UUID, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDTimeUUIDMapValue(col UUIDTimeUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDUUIDMapValue(col UUIDUUIDMapColumn, key gocql.UUID, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDBooleanMapValue(col UUIDBooleanMapColumn, key gocql.UUID, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDDecimalMapValue(col UUIDDecimalMapColumn, key gocql.UUID, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDVarintMapValue(col UUIDVarintMapColumn, key gocql.UUID, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetUUIDBytesMapValue(col UUIDBytesMapColumn, key gocql.UUID, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanStringMapValue(col BooleanStringMapColumn, key bool, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanInt32MapValue(col BooleanInt32MapColumn, key bool, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanInt64MapValue(col BooleanInt64MapColumn, key bool, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanFloat32MapValue(col BooleanFloat32MapColumn, key bool, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanFloat64MapValue(col BooleanFloat64MapColumn, key bool, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanTimestampMapValue(col BooleanTimestampMapColumn, key bool, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanTimeUUIDMapValue(col BooleanTimeUUIDMapColumn, key bool, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanUUIDMapValue(col BooleanUUIDMapColumn, key bool, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanBooleanMapValue(col BooleanBooleanMapColumn, key bool, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanDecimalMapValue(col BooleanDecimalMapColumn, key bool, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanVarintMapValue(col BooleanVarintMapColumn, key bool, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetBooleanBytesMapValue(col BooleanBytesMapColumn, key bool, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalStringMapValue(col DecimalStringMapColumn, key *inf.Dec, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalInt32MapValue(col DecimalInt32MapColumn, key *inf.Dec, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalInt64MapValue(col DecimalInt64MapColumn, key *inf.Dec, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalFloat32MapValue(col DecimalFloat32MapColumn, key *inf.Dec, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetDecimalFloat64MapValue(col DecimalFloat64MapColumn, key *inf.Dec, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetDecimalTimestampMapValue(col DecimalTimestampMapColumn, key *inf.Dec, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+func (c *Context) SetDecimalTimeUUIDMapValue(col DecimalTimeUUIDMapColumn, key *inf.Dec, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalUUIDMapValue(col DecimalUUIDMapColumn, key *inf.Dec, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalBooleanMapValue(col DecimalBooleanMapColumn, key *inf.Dec, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalDecimalMapValue(col DecimalDecimalMapColumn, key *inf.Dec, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalVarintMapValue(col DecimalVarintMapColumn, key *inf.Dec, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetDecimalBytesMapValue(col DecimalBytesMapColumn, key *inf.Dec, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintStringMapValue(col VarintStringMapColumn, key *big.Int, value string) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintInt32MapValue(col VarintInt32MapColumn, key *big.Int, value int32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintInt64MapValue(col VarintInt64MapColumn, key *big.Int, value int64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintFloat32MapValue(col VarintFloat32MapColumn, key *big.Int, value float32) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintFloat64MapValue(col VarintFloat64MapColumn, key *big.Int, value float64) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintTimestampMapValue(col VarintTimestampMapColumn, key *big.Int, value time.Time) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintTimeUUIDMapValue(col VarintTimeUUIDMapColumn, key *big.Int, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintUUIDMapValue(col VarintUUIDMapColumn, key *big.Int, value gocql.UUID) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintBooleanMapValue(col VarintBooleanMapColumn, key *big.Int, value bool) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintDecimalMapValue(col VarintDecimalMapColumn, key *big.Int, value *inf.Dec) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintVarintMapValue(col VarintVarintMapColumn, key *big.Int, value *big.Int) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+
+func (c *Context) SetVarintBytesMapValue(col VarintBytesMapColumn, key *big.Int, value []byte) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
func (c *Context) SetString(col StringColumn, value string) SetValueStep {
set(c, col, value)
@@ -2590,8 +2873,6 @@ func (c *Context) SetBytes(col BytesColumn, value []byte) SetValueStep {
return c
}
-
-
func (c *Context) SetStringSlice(col StringSliceColumn, value []string) SetValueStep {
set(c, col, value)
return c
@@ -2795,4 +3076,3 @@ func (c *Context) RemoveBytesSlice(col BytesSliceColumn, values ...[]byte) SetVa
removeList(c, col, values)
return c
}
-
diff --git a/cqlc/cqlc.go b/cqlc/cqlc.go
index 055873d..5c3f82a 100644
--- a/cqlc/cqlc.go
+++ b/cqlc/cqlc.go
@@ -15,12 +15,14 @@ package cqlc
import (
"bytes"
- "errors"
"fmt"
- "github.com/gocql/gocql"
"log"
+ "os"
"reflect"
"strings"
+
+ "github.com/gocql/gocql"
+ "github.com/pkg/errors"
)
type OperationType int
@@ -57,6 +59,8 @@ const (
Append
Prepend
RemoveByValue
+ RemoveByKey
+ SetByKey
)
var (
@@ -76,12 +80,15 @@ type ReadOptions struct {
// Context represents the state of the CQL statement that is being built by the application.
type Context struct {
- Operation OperationType
- Table Table
- Columns []Column
- Bindings []ColumnBinding
- CASBindings []ColumnBinding
- Conditions []Condition
+ Operation OperationType
+ Table Table
+ Columns []Column
+ Bindings []ColumnBinding
+ CASBindings []ColumnBinding
+ // Conditions is used by WHERE to locate primary key
+ Conditions []Condition
+ // IfConditions is used by IF which is put after WHERE to restrict non primary key columns
+ IfConditions []Condition
ResultBindings map[string]ColumnBinding
// Debug flag will cause all CQL statements to get logged
Debug bool
@@ -90,16 +97,34 @@ type Context struct {
Keyspace string
// Setting StaticKeyspace to true will cause the generated CQL to be qualified by the keyspace the code was generated against.
StaticKeyspace bool
+ logger Logger
+}
+
+type Logger interface {
+ Printf(format string, args ...interface{})
}
func defaultReadOptions() *ReadOptions {
return &ReadOptions{Distinct: false}
}
-// NewContext creates a fresh Context instance.
+// NewContext creates a fresh Context instance using standard logger and logs to stderr with cqlc prefix
// If you want statement debugging, set the Debug property to true
func NewContext() *Context {
- return &Context{Debug: false, ReadOptions: defaultReadOptions()}
+ stdLogger := log.New(os.Stderr, "cqlc: ", log.Lshortfile|log.Ldate)
+ return NewContextWithLogger(stdLogger)
+}
+
+// NewContextWithLogger creates a fresh Context with custom logger
+func NewContextWithLogger(logger Logger) *Context {
+ return &Context{Debug: false, ReadOptions: defaultReadOptions(), logger: logger}
+}
+
+// NewDebugContext creates a fresh Context with debug turned on
+func NewDebugContext() *Context {
+ c := NewContext()
+ c.Debug = true
+ return c
}
type Executable interface {
@@ -124,6 +149,11 @@ type UniqueFetchable interface {
FetchOne(*gocql.Session) (bool, error)
}
+type IfQueryStep interface {
+ If(conditions ...Condition) Query
+ Query
+}
+
type Query interface {
Executable
Fetchable
@@ -133,7 +163,7 @@ type Query interface {
type SelectWhereStep interface {
Fetchable
- Where(conditions ...Condition) Query
+ Where(conditions ...Condition) IfQueryStep
}
type SelectFromStep interface {
@@ -219,6 +249,12 @@ type ColumnBinding struct {
CollectionOperationType CollectionOperationType
}
+// KeyValue is used for bind map value by key
+type KeyValue struct {
+ Key interface{}
+ Value interface{}
+}
+
type TableBinding struct {
Table Table
Columns []ColumnBinding
@@ -249,19 +285,18 @@ func (c *Context) Limit(lim int) Fetchable {
}
func (c *Context) OrderBy(cols ...ClusteredColumn) Fetchable {
-
spec := make([]OrderSpec, len(cols))
for i, c := range cols {
spec[i] = OrderSpec{Col: c.ClusterWith(), Desc: c.IsDescending()}
}
c.ReadOptions.Ordering = spec
-
return c
}
func (c *Context) From(t Table) SelectWhereStep {
c.Table = t
+ //c.logger = c.logger.WithField("table", t.TableName())
return c
}
@@ -290,6 +325,7 @@ func (c *Context) Having(cond ...Condition) Executable {
func (c *Context) Upsert(u Upsertable) SetValueStep {
c.Table = u
c.Operation = WriteOperation
+ //c.logger = c.logger.WithField("table", u.TableName())
return c
}
@@ -342,14 +378,19 @@ func (c *Context) Apply(cols ...ColumnBinding) SetValueStep {
return c
}
-// Adds column bindings whose values will nbe populated if a CAS operation
+// Adds column bindings whose values will be populated if a CAS operation
// is applied.
func (c *Context) IfExists(cols ...ColumnBinding) CompareAndSwap {
c.CASBindings = cols
return c
}
-func (c *Context) Where(cond ...Condition) Query {
+func (c *Context) If(cond ...Condition) Query {
+ c.IfConditions = cond
+ return c
+}
+
+func (c *Context) Where(cond ...Condition) IfQueryStep {
c.Conditions = cond
return c
}
@@ -382,7 +423,7 @@ func (c *Context) FetchOne(s *gocql.Session) (bool, error) {
if !ok {
row[i] = cols[i].TypeInfo.New()
if c.Debug && row[i] == nil {
- log.Printf("Could not map type info: %+v", cols[i].TypeInfo.Type)
+ log.Printf("Could not map type info: %+v", cols[i].TypeInfo.Type())
}
} else {
row[i] = binding.Value
@@ -407,6 +448,8 @@ func (c *Context) Fetch(s *gocql.Session) (*gocql.Iter, error) {
return q.Iter(), nil
}
+// Prepare is used in Select, it only has where condition binding
+// Prepare is only called by Fetch
func (c *Context) Prepare(s *gocql.Session) (*gocql.Query, error) {
stmt, err := c.RenderCQL()
@@ -426,35 +469,31 @@ func (c *Context) Prepare(s *gocql.Session) (*gocql.Query, error) {
switch reflect.TypeOf(v).Kind() {
case reflect.Slice:
- {
- s := reflect.ValueOf(v)
- for i := 0; i < s.Len(); i++ {
- placeHolders = append(placeHolders, s.Index(i).Interface())
- }
+ s := reflect.ValueOf(v)
+ for i := 0; i < s.Len(); i++ {
+ placeHolders = append(placeHolders, s.Index(i).Interface())
}
case reflect.Array:
- {
- // Not really happy about having to special case UUIDs
- // but this works for now
+ // Not really happy about having to special case UUIDs
+ // but this works for now
- if val, ok := v.(gocql.UUID); ok {
- placeHolders = append(placeHolders, val.Bytes())
- } else {
- return nil, bindingErrorf("Cannot bind component: %+v (type: %s)", v, reflect.TypeOf(v))
- }
+ if val, ok := v.(gocql.UUID); ok {
+ placeHolders = append(placeHolders, val.Bytes())
+ } else {
+ return nil, bindingErrorf("Cannot bind component: %+v (type: %s)", v, reflect.TypeOf(v))
}
default:
- {
- placeHolders = append(placeHolders, &v)
- }
+ // TODO: (pingginp) why it took address of interface and it worked ...
+ //placeHolders = append(placeHolders, &v)
+ placeHolders = append(placeHolders, v)
}
}
c.Dispose()
if c.Debug {
- debugStmt(stmt, placeHolders)
+ debugStmt(c.logger, stmt, placeHolders)
}
return s.Query(stmt, placeHolders...), nil
@@ -468,7 +507,7 @@ func (c *Context) Exec(s *gocql.Session) error {
}
if c.Debug {
- debugStmt(stmt, placeHolders)
+ debugStmt(c.logger, stmt, placeHolders)
}
return s.Query(stmt, placeHolders...).Exec()
@@ -503,7 +542,7 @@ func (c *Context) Batch(b *gocql.Batch) error {
}
if c.Debug {
- debugStmt(stmt, placeHolders)
+ debugStmt(c.logger, stmt, placeHolders)
}
b.Query(stmt, placeHolders...)
@@ -511,39 +550,79 @@ func (c *Context) Batch(b *gocql.Batch) error {
return nil
}
-func debugStmt(stmt string, placeHolders []interface{}) {
+func debugStmt(logger Logger, stmt string, placeHolders []interface{}) {
infused := strings.Replace(stmt, "?", " %+v", -1)
var buffer bytes.Buffer
buffer.WriteString("CQL: ")
buffer.WriteString(infused)
- buffer.WriteString("\n")
- fmt.Printf(buffer.String(), placeHolders...)
+ logger.Printf(buffer.String(), placeHolders...)
+ //panic("debugStmt")
}
+// BuildStatement is the new BuildStatement based on Prepare to support set map value by key
+// BuildStatement is used in update, thus it has binding and where condition binding
+// BuildStatement is called by Exec, Batch, Swap
func BuildStatement(c *Context) (stmt string, placeHolders []interface{}, err error) {
- // TODO Does this function need to get exported?
stmt, err = c.RenderCQL()
if err != nil {
- return stmt, nil, err
+ return "", nil, errors.Wrap(err, "error render CQL")
}
- bindings := len(c.Bindings) // TODO check whether this is nil
- conditions := 0
-
- if c.Conditions != nil {
- conditions = len(c.Conditions)
+ // placeHolders are the bindings that will be passed to gocql
+ placeHolders = make([]interface{}, 0)
+
+ // NOTE: for all binding we need to expand value due to multiple placeholders in one binding
+ // in bindings we have foo[?] = ?
+ // in where bindings we have where foo in (?, ?, ?)
+
+ for _, bind := range c.Bindings {
+ v := bind.Value
+ switch bind.CollectionType {
+ case MapType:
+ switch bind.CollectionOperationType {
+ case SetByKey:
+ kv, ok := v.(KeyValue)
+ if !ok {
+ return "", nil, errors.Errorf("map set by key requires KeyValue binding on column %s", bind.Column.ColumnName())
+ }
+ placeHolders = append(placeHolders, kv.Key, kv.Value)
+ }
+ default:
+ placeHolders = append(placeHolders, v)
+ }
}
- placeHolders = make([]interface{}, bindings+conditions)
+ bindCondition := func(conditions []Condition) error {
+ for _, cond := range conditions {
+ v := cond.Binding.Value
+ switch reflect.TypeOf(v).Kind() {
+ case reflect.Slice:
+ s := reflect.ValueOf(v)
+ for i := 0; i < s.Len(); i++ {
+ placeHolders = append(placeHolders, s.Index(i).Interface())
+ }
+ case reflect.Array:
- for i, bind := range c.Bindings {
- placeHolders[i] = bind.Value
- }
+ // Not really happy about having to special case UUIDs
+ // but this works for now
- if c.Conditions != nil {
- for i, cond := range c.Conditions {
- placeHolders[i+bindings] = cond.Binding.Value
+ if val, ok := v.(gocql.UUID); ok {
+ placeHolders = append(placeHolders, val.Bytes())
+ } else {
+ return bindingErrorf("Cannot bind component: %+v (type: %s)", v, reflect.TypeOf(v))
+ }
+ default:
+ placeHolders = append(placeHolders, v)
+ }
}
+ return nil
+ }
+
+ if err := bindCondition(c.Conditions); err != nil {
+ return "", nil, err
+ }
+ if err := bindCondition(c.IfConditions); err != nil {
+ return "", nil, err
}
c.Dispose()
@@ -556,7 +635,6 @@ func (c *Context) RenderCQL() (string, error) {
var buf bytes.Buffer
- // TODO This should be a switch
switch c.Operation {
case ReadOperation:
{
@@ -581,7 +659,7 @@ func (c *Context) RenderCQL() (string, error) {
renderDelete(c, &buf)
}
default:
- return "", fmt.Errorf("Unknown operation type: %s", c.Operation)
+ return "", fmt.Errorf("Unknown operation type: %v", c.Operation)
}
return buf.String(), nil
@@ -593,6 +671,7 @@ func (c *Context) Dispose() {
c.Table = nil
c.Bindings = nil
c.Conditions = nil
+ c.IfConditions = nil
c.CASBindings = nil
}
@@ -605,6 +684,11 @@ func set(c *Context, col Column, value interface{}) {
c.Bindings = append(c.Bindings, ColumnBinding{Column: col, Value: value})
}
+func setMap(c *Context, col Column, key interface{}, value interface{}) {
+ b := ColumnBinding{Column: col, Value: KeyValue{Key: key, Value: value}, CollectionType: MapType, CollectionOperationType: SetByKey}
+ c.Bindings = append(c.Bindings, b)
+}
+
func appendList(c *Context, col ListColumn, values interface{}) {
b := ColumnBinding{Column: col, Value: values, Incremental: true, CollectionType: ListType, CollectionOperationType: Append}
c.Bindings = append(c.Bindings, b)
diff --git a/cqlc/cqlc_test.go b/cqlc/cqlc_test.go
index 461b3eb..0343b4a 100644
--- a/cqlc/cqlc_test.go
+++ b/cqlc/cqlc_test.go
@@ -286,6 +286,16 @@ func (s *CqlTestSuite) TestUpdate() {
cql, err := c.RenderCQL()
assert.NoError(s.T(), err)
assert.Equal(s.T(), cql, "UPDATE foo SET bar = ?, quux = ? WHERE id = ?")
+
+ // set string map value by key, not entire map
+ c = NewContext()
+ c.Upsert(s.table).
+ SetStringStringMapValue(barCol, "dz1", `{"json":"string"}`).
+ SetInt32(quuxCol, 10).
+ Where(idCol.Eq("x"))
+ cql, err = c.RenderCQL()
+ assert.NoError(s.T(), err)
+ assert.Equal(s.T(), cql, "UPDATE foo SET bar[?] = ?, quux = ? WHERE id = ?")
}
func (s *CqlTestSuite) TestCounter() {
@@ -307,6 +317,16 @@ func (s *CqlTestSuite) TestDeleteRow() {
assert.Equal(s.T(), cql, "DELETE FROM foo WHERE id = ?")
}
+func (s *CqlTestSuite) TestDeleteRowIf() {
+ idCol := &MockAsciiColumn{name: "id"}
+ ageCol := &MockInt32Column{name: "age"}
+ c := NewContext()
+ c.Delete().From(s.table).Where(idCol.Eq("x")).If(ageCol.Eq(28))
+ cql, err := c.RenderCQL()
+ assert.NoError(s.T(), err)
+ assert.Equal(s.T(), cql, "DELETE FROM foo WHERE id = ? IF age = ?")
+}
+
func (s *CqlTestSuite) TestDeleteColumn() {
idCol := &MockAsciiColumn{name: "id"}
barCol := &MockAsciiColumn{name: "bar"}
diff --git a/cqlc/render.go b/cqlc/render.go
index b6b2778..6d86b1d 100644
--- a/cqlc/render.go
+++ b/cqlc/render.go
@@ -134,6 +134,20 @@ func renderUpdate(ctx *Context, buf *bytes.Buffer, counterTable bool) {
case RemoveByValue:
setFragments[i] = fmt.Sprintf("%s = %s - ?", col, col)
}
+ case MapType:
+ switch binding.CollectionOperationType {
+ case SetByKey:
+ setFragments[i] = fmt.Sprintf("%s[?] = ?", col)
+ // TODO: it seems in C*2 and C*3 the + has different semantic
+ // https://docs.datastax.com/en/cql/3.1/cql/cql_using/use_map_t.html
+ // https://docs.datastax.com/en/cql/3.3/cql/cql_using/useInsertMap.html
+ //case Append:
+ // setFragments[i] = fmt.Sprintf("%s = %s + ?", col, col)
+ //case RemoveByKey:
+ // setFragments[i] = fmt.Sprintf("%s = %s - ?", col, col)
+ default:
+ panic(fmt.Sprintf("unsupported Map CollectionOperationType %d", binding.CollectionOperationType))
+ }
default:
setFragments[i] = fmt.Sprintf("%s = ?", col)
}
@@ -170,13 +184,25 @@ func renderDelete(ctx *Context, buf *bytes.Buffer) {
}
renderWhereClause(ctx, buf)
+
+ if len(ctx.IfConditions) > 0 {
+ renderIfClause(ctx, buf)
+ }
}
func renderWhereClause(ctx *Context, buf *bytes.Buffer) {
fmt.Fprint(buf, "WHERE ")
+ renderCondition(buf, ctx.Conditions)
+}
+
+func renderIfClause(ctx *Context, buf *bytes.Buffer) {
+ fmt.Fprint(buf, " IF ")
+ renderCondition(buf, ctx.IfConditions)
+}
- whereFragments := make([]string, len(ctx.Conditions))
- for i, condition := range ctx.Conditions {
+func renderCondition(buf *bytes.Buffer, conditions []Condition) {
+ whereFragments := make([]string, len(conditions))
+ for i, condition := range conditions {
col := condition.Binding.Column.ColumnName()
pred := condition.Predicate
diff --git a/cqlc/tmpl/columns.tmpl b/cqlc/tmpl/columns.tmpl
index f042861..6780087 100644
--- a/cqlc/tmpl/columns.tmpl
+++ b/cqlc/tmpl/columns.tmpl
@@ -1,16 +1,16 @@
-// THIS FILE WAS AUTOGENERATED - ANY EDITS TO THIS WILL BE LOST WHEN IT IS REGENERATED
+// Code generated by column_generator.go from tmp/columns.tmpl DO NOT EDIT.
package cqlc
import (
- "github.com/gocql/gocql"
"time"
"math/big"
+
"gopkg.in/inf.v0"
+ "github.com/gocql/gocql"
)
{{ range $_, $t := .types }}
-
type {{ $t.Prefix }}Column interface {
Column
To(value *{{ $t.Literal }}) ColumnBinding
@@ -44,7 +44,6 @@ type LastClustered{{ $t.Prefix }}Column interface {
Clustered{{ $t.Prefix }}Column
In(value ...{{ $t.Literal }}) Condition
}
-
{{ end }}
{{ range $_, $t := .types }}
@@ -79,6 +78,7 @@ type SetValueStep interface {
{{ range $_, $it := $inner }}
{{ if ne $ot.Prefix "Bytes" }}
Set{{ $ot.Prefix }}{{ $it.Prefix }}Map(col {{ $ot.Prefix }}{{ $it.Prefix }}MapColumn, value map[{{ $ot.Literal }}]{{ $it.Literal }}) SetValueStep
+ Set{{ $ot.Prefix }}{{ $it.Prefix }}MapValue(col {{ $ot.Prefix }}{{ $it.Prefix }}MapColumn, key {{ $ot.Literal }}, value {{ $it.Literal }}) SetValueStep
{{ end }}{{ end }}{{ end }}
{{ range $_, $t := .types }}
@@ -98,6 +98,15 @@ func (c *Context) Set{{ $ot.Prefix }}{{ $it.Prefix }}Map(col {{ $ot.Prefix }}{{
}
{{ end }}{{ end }}{{ end }}
+{{ range $_, $ot := $outer }}
+{{ range $_, $it := $inner }}
+{{ if ne $ot.Prefix "Bytes" }}
+func (c *Context) Set{{ $ot.Prefix }}{{ $it.Prefix }}MapValue(col {{ $ot.Prefix }}{{ $it.Prefix }}MapColumn, key {{ $ot.Literal }}, value {{ $it.Literal }}) SetValueStep {
+ setMap(c, col, key, value)
+ return c
+}
+{{ end }}{{ end }}{{ end }}
+
{{ range $_, $t := .types }}
func (c *Context) Set{{ $t.Prefix }}(col {{ $t.Prefix }}Column, value {{ $t.Literal }}) SetValueStep {
set(c, col, value)
diff --git a/cqlc/ver.go b/cqlc/ver.go
new file mode 100644
index 0000000..8ec8bb1
--- /dev/null
+++ b/cqlc/ver.go
@@ -0,0 +1,4 @@
+package cqlc
+
+// Version is the runtime version of cqlc, run make update-ver to sync it
+const Version = "0.13.0"
diff --git a/doc/set-map-value-by-key.md b/doc/set-map-value-by-key.md
new file mode 100644
index 0000000..87091c4
--- /dev/null
+++ b/doc/set-map-value-by-key.md
@@ -0,0 +1,108 @@
+# Set map value by key instead of entire map
+
+This doc describes https://github.com/pingginp/cqlc/issues/2
+
+- in `tmpl/columns.tmpl`
+ - in `SetStepValue` interface, add `Set{{Type1}}{{Type2}}MapValue(col, key {{type1}}, value {{type2}}`
+ - in `Context` methods, add the impl method with same name and call `setMap`
+- run `make cqlc/columns.go` to generate using `column_generator.go`
+- add `setMap` and use `[]interface{}{key, value}` as `Value` for binding, set type to MapType and op to `SetByKey`
+- in `renderUpdate`, use `%s[?] = ?` where `%s` is from col
+- `BuildStatement`, flatten binding, (copy from Prepare), former is used by Exec (update & insert) and latter is used by Fetch (select)
+ - NOTE: we added new struct `KeyValue` to avoid flatten slice value that should be kept as slice
+ - [ ] in old code, they were using `&v` for placeholder, it's pointer to interface, I don't know why it didn't trigger error, because gocql traverse ptr until it's a value?
+
+````go
+// KeyValue is used for bind map value by key
+type KeyValue struct {
+ Key interface{}
+ Value interface{}
+}
+
+
+// Prepare is used in Select, it only has where condition binding
+// Prepare is only called by Fetch
+func (c *Context) Prepare(s *gocql.Session) (*gocql.Query, error) {
+ stmt, err := c.RenderCQL()
+
+ // nothing is changed for update map
+}
+
+// BuildStatement is the new BuildStatement based on Prepare to support set map value by key
+// BuildStatement is used in update, thus it has binding and where condition binding
+// BuildStatement is called by Exec, Batch, Swap
+func BuildStatement(c *Context) (stmt string, placeHolders []interface{}, err error) {
+ stmt, err = c.RenderCQL()
+
+ // placeHolders are the bindings that will be passed to gocql
+ placeHolders = make([]interface{}, 0)
+
+ for _, bind := range c.Bindings {
+ v := bind.Value
+ switch bind.CollectionType {
+ case MapType:
+ switch bind.CollectionOperationType {
+ case SetByKey:
+ kv, ok := v.(KeyValue)
+ if !ok {
+ return "", nil, errors.Errorf("map set by key requires KeyValue binding on column %s", bind.Column.ColumnName())
+ }
+ placeHolders = append(placeHolders, kv.Key, kv.Value)
+ }
+ default:
+ placeHolders = append(placeHolders, v)
+ }
+ }
+
+}
+
+// cqlc.go
+func (c *Context) RenderCQL() (string, error) {
+ switch c.Operation {
+ case ReadOperation:
+ renderSelect(c, &buf)
+ case WriteOperation:
+ if c.hasConditions() {
+ renderUpdate(c, &buf, false)
+ } else {
+ renderInsert(c, &buf)
+ }
+ renderCAS(c, &buf)
+ case CounterOperation:
+ renderUpdate(c, &buf, true)
+ case DeleteOperation:
+ renderDelete(c, &buf)
+ default:
+ return "", fmt.Errorf("Unknown operation type: %v", c.Operation)
+ }
+}
+
+// render.go
+func renderUpdate(ctx *Context, buf *bytes.Buffer, counterTable bool) {
+ for i, binding := range ctx.Bindings {
+ col := binding.Column.ColumnName()
+ if counterTable {
+ setFragments[i] = fmt.Sprintf("%s = %s + ?", col, col)
+ } else {
+ switch binding.CollectionType {
+ case ListType:
+ switch binding.CollectionOperationType {
+ case Append:
+ setFragments[i] = fmt.Sprintf("%s = %s + ?", col, col)
+ case Prepend:
+ setFragments[i] = fmt.Sprintf("%s = ? + %s", col, col)
+ case RemoveByValue:
+ setFragments[i] = fmt.Sprintf("%s = %s - ?", col, col)
+ }
+ case MapType:
+ switch binding.CollectionOperationType {
+ case SetByKey:
+ setFragments[i] = fmt.Sprintf("%s[?] = ?", col)
+ }
+ default:
+ setFragments[i] = fmt.Sprintf("%s = ?", col)
+ }
+ }
+ }
+}
+````
\ No newline at end of file
diff --git a/e2e/Makefile b/e2e/Makefile
new file mode 100644
index 0000000..479fda4
--- /dev/null
+++ b/e2e/Makefile
@@ -0,0 +1,12 @@
+.PHONY: run-c2 run-c3 shell-c2 shell-c3 down
+
+run-c2:
+ docker-compose up c2
+run-c3:
+ docker-compose up c3
+shell-c2:
+ docker-compose exec c2 /bin/bash
+shell-c3:
+ docker-compose exec c3 /bin/bash
+down:
+ docker-compose down
diff --git a/e2e/README.md b/e2e/README.md
new file mode 100644
index 0000000..c4a8567
--- /dev/null
+++ b/e2e/README.md
@@ -0,0 +1,4 @@
+# e2e
+
+This is a small e2e test because I couldn't figure out how to run existing integration test properly and I want to use
+docker instead of ccm
\ No newline at end of file
diff --git a/e2e/c3_broken.go.log b/e2e/c3_broken.go.log
new file mode 100644
index 0000000..9a6549c
--- /dev/null
+++ b/e2e/c3_broken.go.log
@@ -0,0 +1,375 @@
+// THIS FILE WAS AUTOGENERATED - ANY EDITS TO THIS WILL BE LOST WHEN IT IS REGENERATED
+// GENERATED USING KEYSPACE cqlc
+// AT 2018-09-15 01:39:27.314369 -0700 PDT m=+0.059257435 USING cqlc VERSION 0.10.5
+// AGAINST HOST ID 7276c9e8-28dc-4032-90a1-53aa078997ff (SERVER VERSION 3.1.1)
+// CLIENT NEGOTIATED CQL VERSION 3.0.0 (SERVER SUPPORTS UP TO 3.3.1)
+
+
+
+
+package foo
+
+import (
+
+ "github.com/gocql/gocql"
+
+ "log"
+
+ "time"
+
+ "github.com/relops/cqlc/cqlc"
+
+)
+
+const (
+ CQLC_VERSION = "0.10.5"
+)
+
+
+
+
+
+
+
+
+ type T1IdColumn struct{
+
+ }
+
+ func (b * T1IdColumn ) ColumnName() string {
+ return "id"
+ }
+
+
+
+ func (b * T1IdColumn ) To(value *) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+ }
+
+
+
+
+
+
+ func (b * T1IdColumn ) Eq(value ) cqlc.Condition {
+ column := &T1IdColumn{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.EqPredicate}
+ }
+
+ func (b * T1IdColumn ) PartitionBy() cqlc.Column {
+ return b
+ }
+
+ func (b * T1IdColumn ) In(value ...) cqlc.Condition {
+ column := &T1IdColumn{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.InPredicate}
+ }
+
+
+
+
+
+
+
+
+ type T1StringListColumn struct{
+
+ }
+
+ func (b * T1StringListColumn ) ColumnName() string {
+ return "string_list"
+ }
+
+
+
+ func (b * T1StringListColumn ) ListType() cqlc.Column {
+ return &T1StringListColumn{}
+ }
+
+
+
+ func (b * T1StringListColumn ) To(value *[]) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+ }
+
+
+
+
+
+
+
+
+
+
+
+ type T1StringMapColumn struct{
+
+ }
+
+ func (b * T1StringMapColumn ) ColumnName() string {
+ return "string_map"
+ }
+
+
+
+ func (b * T1StringMapColumn ) To(value *map[]) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+ }
+
+
+
+
+
+
+
+
+
+
+
+ type T1TsColumn struct{
+
+ }
+
+ func (b * T1TsColumn ) ColumnName() string {
+ return "ts"
+ }
+
+
+
+ func (b * T1TsColumn ) To(value *time.Time) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+ }
+
+
+
+
+
+
+
+
+
+
+ type T1 struct {
+
+ Id
+
+ StringList []
+
+ StringMap map[]
+
+ Ts time.Time
+
+ }
+
+
+ func (s * T1) IdValue() {
+ return s.Id
+ }
+
+ func (s * T1) StringListValue() [] {
+ return s.StringList
+ }
+
+ func (s * T1) StringMapValue() map[] {
+ return s.StringMap
+ }
+
+ func (s * T1) TsValue() time.Time {
+ return s.Ts
+ }
+
+
+ type T1Def struct {
+
+ ID
+
+ STRING_LIST
+
+ STRING_MAP
+
+ TS cqlc.TimestampColumn
+
+ }
+
+ func BindT1(iter *gocql.Iter) ([]T1, error) {
+ array := make([]T1, 0)
+ err := MapT1(iter, func(t T1) (bool, error) {
+ array = append(array, t)
+ return true, nil
+ })
+ return array, err
+ }
+
+ func MapT1(iter *gocql.Iter, callback func(t T1) (bool, error)) error {
+ columns := iter.Columns()
+ row := make([]interface{}, len(columns))
+
+ for {
+ t := T1{}
+
+ for i := 0; i < len(columns); i++ {
+ switch columns[i].Name {
+
+ case "id": row[i] = &t.Id
+
+ case "string_list": row[i] = &t.StringList
+
+ case "string_map": row[i] = &t.StringMap
+
+ case "ts": row[i] = &t.Ts
+
+ default:
+ log.Fatal("unhandled column: ", columns[i].Name)
+ }
+ }
+ if !iter.Scan(row...) {
+ break
+ }
+
+ readNext, err := callback(t)
+ if err != nil {
+ return err
+ }
+ if !readNext {
+ return nil
+ }
+ }
+
+ return nil
+ }
+
+
+ func (s * T1Def ) SupportsUpsert() bool {
+ return true
+ }
+
+
+ func (s * T1Def ) TableName() string {
+ return "t1"
+ }
+
+ func (s * T1Def ) Keyspace() string {
+ return "cqlc"
+ }
+
+ func (s * T1Def ) Bind(v T1) cqlc.TableBinding {
+ cols := []cqlc.ColumnBinding{
+
+
+
+ cqlc.ColumnBinding{Column: &T1IdColumn{}, Value: v.Id},
+
+
+
+ cqlc.ColumnBinding{Column: &T1StringListColumn{}, Value: v.StringList},
+
+
+
+ cqlc.ColumnBinding{Column: &T1StringMapColumn{}, Value: v.StringMap},
+
+
+
+ cqlc.ColumnBinding{Column: &T1TsColumn{}, Value: v.Ts},
+
+ }
+ return cqlc.TableBinding{Table: &T1Def{}, Columns: cols}
+ }
+
+ func (s * T1Def ) To(v *T1) cqlc.TableBinding {
+ cols := []cqlc.ColumnBinding{
+
+
+
+ cqlc.ColumnBinding{Column: &T1IdColumn{}, Value: &v.Id},
+
+
+
+ cqlc.ColumnBinding{Column: &T1StringListColumn{}, Value: &v.StringList},
+
+
+
+ cqlc.ColumnBinding{Column: &T1StringMapColumn{}, Value: &v.StringMap},
+
+
+
+ cqlc.ColumnBinding{Column: &T1TsColumn{}, Value: &v.Ts},
+
+ }
+ return cqlc.TableBinding{Table: &T1Def{}, Columns: cols}
+ }
+
+ func (s * T1Def ) ColumnDefinitions() []cqlc.Column {
+ return []cqlc.Column{
+
+
+
+ &T1IdColumn{},
+
+
+
+ &T1StringListColumn{},
+
+
+
+ &T1StringMapColumn{},
+
+
+
+ &T1TsColumn{},
+
+ }
+ }
+
+ func T1TableDef() *T1Def {
+ return &T1Def{
+
+
+
+ ID : &T1IdColumn{},
+
+
+
+ STRING_LIST : &T1StringListColumn{},
+
+
+
+ STRING_MAP : &T1StringMapColumn{},
+
+
+
+ TS : &T1TsColumn{},
+
+ }
+ }
+
+
+
+
+
+
+ func (s *T1Def) IdColumn() {
+ return &T1IdColumn{}
+ }
+
+
+
+ func (s *T1Def) StringListColumn() {
+ return &T1StringListColumn{}
+ }
+
+
+
+ func (s *T1Def) StringMapColumn() {
+ return &T1StringMapColumn{}
+ }
+
+
+
+ func (s *T1Def) TsColumn() cqlc.TimestampColumn {
+ return &T1TsColumn{}
+ }
+
+
+
diff --git a/e2e/create_schema_test.go b/e2e/create_schema_test.go
new file mode 100644
index 0000000..7653b37
--- /dev/null
+++ b/e2e/create_schema_test.go
@@ -0,0 +1,162 @@
+package e2e
+
+import (
+ "fmt"
+ "log"
+ "os"
+ "os/exec"
+ "testing"
+
+ "github.com/gocql/gocql"
+ asst "github.com/stretchr/testify/assert"
+ requir "github.com/stretchr/testify/require"
+
+ "github.com/relops/cqlc/cqlc"
+ "github.com/relops/cqlc/e2e/g1"
+)
+
+const (
+ cqlcKs = "cqlc"
+ gocqlKs = "gocql"
+)
+
+func TestCreateKeyspace(t *testing.T) {
+ require := requir.New(t)
+
+ // create two ks, one for cqlc, one for gocql, so table for gocql won't get dumped by cqlc generator
+ for _, ks := range []string{cqlcKs, gocqlKs} {
+ createKeyspace := fmt.Sprintf(`CREATE KEYSPACE %s WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };`, ks)
+
+ cluster := gocql.NewCluster("127.0.0.1")
+ cluster.Keyspace = "system"
+ sess, err := cluster.CreateSession()
+ require.Nil(err, "connect to cassandra using system keyspace for create new keyspace"+ks)
+ err = sess.Query(createKeyspace).Exec()
+ require.Nil(err, "create keyspace")
+ log.Printf("created keyspace %s", ks)
+ }
+}
+
+const tblStringMap = `
+CREATE TABLE %s (
+ id text PRIMARY KEY,
+ ssm map
+)
+`
+
+const tblMapSlice = `
+CREATE TABLE %s (
+ id text PRIMARY KEY,
+ ssm map,
+ sl list
+)
+`
+
+// for each ddl, we create two table, one for gocql, one for cqlc
+func TestCreateTable(t *testing.T) {
+ require := requir.New(t)
+
+ for _, ks := range []string{cqlcKs, gocqlKs} {
+ cluster := gocql.NewCluster("127.0.0.1")
+ cluster.Keyspace = ks
+ sess, err := cluster.CreateSession()
+ require.Nil(err, "connect to cassandra using cqlc keyspace for create new table")
+
+ ddls := []string{tblStringMap, tblMapSlice}
+ tbs := []string{"tbl_string_map", "tbl_map_slice"}
+ for i := 0; i < len(tbs); i++ {
+ err = sess.Query(fmt.Sprintf(ddls[i], tbs[i])).Exec()
+ require.Nil(err, "create table "+tbs[i])
+ log.Printf("created %s.%s", ks, tbs[i])
+ }
+ }
+}
+
+func TestGenerate(t *testing.T) {
+ // cqlc --instance=127.0.0.1 --keyspace=cqlc --package=g1 --output=g1/cqlc_generated.go --verbose --symbols
+ runCqlc(t, cqlcKs, "g1")
+}
+
+func TestUpdate(t *testing.T) {
+ require := requir.New(t)
+ assert := asst.New(t)
+
+ sf := func(ks string) *gocql.Session {
+ cluster := gocql.NewCluster("127.0.0.1")
+ cluster.Keyspace = ks
+ sess, err := cluster.CreateSession()
+ require.Nil(err, "connect to cassandra using cqlc keyspace for create new table")
+ return sess
+ }
+
+ sGocql := sf(gocqlKs)
+ sCqlc := sf(cqlcKs)
+
+ t.Run("insert", func(t *testing.T) {
+ err := sGocql.Query("INSERT INTO tbl_string_map (id, ssm) VALUES (?,?)", "1", map[string]string{"k1": "v1"}).Exec()
+ require.Nil(err)
+
+ c := cqlc.NewContext()
+ c.Debug = true
+ err = c.Upsert(g1.TblStringMapTableDef()).SetString(g1.TBL_STRING_MAP.ID, "1").
+ SetStringStringMap(g1.TBL_STRING_MAP.SSM, map[string]string{"k1": "v1"}).Exec(sCqlc)
+ require.Nil(err)
+ })
+
+ t.Run("update", func(t *testing.T) {
+ err := sGocql.Query("UPDATE tbl_string_map SET ssm[?] = ? WHERE id = ?", "k1", "v2", "1").Exec()
+ require.Nil(err)
+
+ c := cqlc.NewContext()
+ c.Debug = true
+ err = c.Upsert(g1.TblStringMapTableDef()).
+ SetStringStringMapValue(g1.TBL_STRING_MAP.SSM, "k1", "v2").
+ Where(g1.TBL_STRING_MAP.ID.Eq("1")).Exec(sCqlc)
+ require.Nil(err)
+
+ })
+
+ t.Run("query", func(t *testing.T) {
+ iter := sGocql.Query("SELECT id, ssm FROM tbl_string_map WHERE id = ?", "1").Iter()
+ var id string
+ var m = map[string]string{}
+ scanned := iter.Scan(&id, &m)
+ assert.True(scanned)
+ require.Nil(iter.Close())
+ require.Equal("1", id)
+ require.Equal("v2", m["k1"])
+
+ c := cqlc.NewContext()
+ c.Debug = true
+ var row g1.TblStringMap
+ ok, err := c.Select(g1.TBL_STRING_MAP.ID, g1.TBL_STRING_MAP.SSM).From(g1.TblStringMapTableDef()).
+ Where(g1.TBL_STRING_MAP.ID.Eq("1")).Into(g1.TBL_STRING_MAP.To(&row)).FetchOne(sCqlc)
+ require.Nil(err)
+ assert.True(ok)
+ require.Equal("1", row.Id)
+ require.Equal("v2", row.Ssm["k1"])
+ })
+}
+
+func runCqlc(t *testing.T, ks string, pkg string) {
+ // cqlc --instance=127.0.0.1 --keyspace=cqlc --package=t1gen --output=t1gen/generated.go --verbose --symbols
+ cmd := exec.Command("cqlc",
+ "--instance=127.0.0.1",
+ "--keyspace="+ks,
+ "--package="+pkg,
+ "--output="+pkg+"/cqlc_generated.go",
+ "--symbols",
+ "--verbose",
+ )
+ cmd.Stdin = os.Stdin
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ if err := cmd.Run(); err != nil {
+ t.Fatal(err)
+ }
+ log.Printf("cqlc generate ks %s to %s", ks, pkg)
+}
+
+func init() {
+ log.SetFlags(log.Lshortfile)
+}
diff --git a/e2e/docker-compose.yaml b/e2e/docker-compose.yaml
new file mode 100644
index 0000000..a42e7d4
--- /dev/null
+++ b/e2e/docker-compose.yaml
@@ -0,0 +1,18 @@
+version: '3.3'
+services:
+ c2:
+ image: 'cassandra:2.1'
+ environment:
+ - CASSANDRA_BROADCAST_ADDRESS=127.0.0.1
+ ports:
+ - target: 9042
+ published: 9042
+ protocol: tcp
+ c3:
+ image: 'cassandra:3.1'
+ environment:
+ - CASSANDRA_BROADCAST_ADDRESS=127.0.0.1
+ ports:
+ - target: 9042
+ published: 9042
+ protocol: tcp
\ No newline at end of file
diff --git a/e2e/g1/cqlc_generated.go b/e2e/g1/cqlc_generated.go
new file mode 100644
index 0000000..e35e421
--- /dev/null
+++ b/e2e/g1/cqlc_generated.go
@@ -0,0 +1,375 @@
+// Code generated by https://github.com/pingginp/cqlc DO NOT EDIT.
+// GENERATED USING KEYSPACE cqlc
+// AT 2018-09-15 17:48:05.653436 -0700 PDT m=+0.071792159 USING cqlc VERSION 0.11.0
+// AGAINST HOST ID 099d1b1c-5ebe-4c29-951b-81df44232180 (SERVER VERSION 2.1.20)
+// CLIENT NEGOTIATED CQL VERSION 3.0.0 (SERVER SUPPORTS UP TO 3.2.1)
+
+package g1
+
+import (
+ "github.com/gocql/gocql"
+ "github.com/pkg/errors"
+ "github.com/relops/cqlc/cqlc"
+)
+
+const (
+ CQLC_VERSION = "0.11.0"
+)
+
+type TblMapSliceIdColumn struct {
+}
+
+func (b *TblMapSliceIdColumn) ColumnName() string {
+ return "id"
+}
+
+func (b *TblMapSliceIdColumn) To(value *string) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+}
+
+func (b *TblMapSliceIdColumn) Eq(value string) cqlc.Condition {
+ column := &TblMapSliceIdColumn{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.EqPredicate}
+}
+
+func (b *TblMapSliceIdColumn) PartitionBy() cqlc.Column {
+ return b
+}
+
+func (b *TblMapSliceIdColumn) In(value ...string) cqlc.Condition {
+ column := &TblMapSliceIdColumn{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.InPredicate}
+}
+
+type TblMapSliceSlColumn struct {
+}
+
+func (b *TblMapSliceSlColumn) ColumnName() string {
+ return "sl"
+}
+
+func (b *TblMapSliceSlColumn) ListType() cqlc.Column {
+ return &TblMapSliceSlColumn{}
+}
+
+func (b *TblMapSliceSlColumn) To(value *[]string) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+}
+
+type TblMapSliceSsmColumn struct {
+}
+
+func (b *TblMapSliceSsmColumn) ColumnName() string {
+ return "ssm"
+}
+
+func (b *TblMapSliceSsmColumn) To(value *map[string]string) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+}
+
+type TblMapSlice struct {
+ Id string
+ Sl []string
+ Ssm map[string]string
+}
+
+func (s *TblMapSlice) IdValue() string {
+ return s.Id
+}
+
+func (s *TblMapSlice) SlValue() []string {
+ return s.Sl
+}
+
+func (s *TblMapSlice) SsmValue() map[string]string {
+ return s.Ssm
+}
+
+type TblMapSliceDef struct {
+ ID cqlc.LastPartitionedStringColumn
+ SL cqlc.StringSliceColumn
+ SSM cqlc.StringStringMapColumn
+}
+
+func BindTblMapSlice(iter *gocql.Iter) ([]TblMapSlice, error) {
+ array := make([]TblMapSlice, 0)
+ err := MapTblMapSlice(iter, func(t TblMapSlice) (bool, error) {
+ array = append(array, t)
+ return true, nil
+ })
+ return array, err
+}
+
+func MapTblMapSlice(iter *gocql.Iter, callback func(t TblMapSlice) (bool, error)) error {
+ columns := iter.Columns()
+ row := make([]interface{}, len(columns))
+
+ for {
+ t := TblMapSlice{}
+
+ for i := 0; i < len(columns); i++ {
+ switch columns[i].Name {
+
+ case "id":
+ row[i] = &t.Id
+
+ case "sl":
+ row[i] = &t.Sl
+
+ case "ssm":
+ row[i] = &t.Ssm
+
+ default:
+ return errors.Errorf("cqlc: unhandled column: %s", columns[i].Name)
+ }
+ }
+ if !iter.Scan(row...) {
+ break
+ }
+
+ readNext, err := callback(t)
+ if err != nil {
+ return err
+ }
+ if !readNext {
+ return nil
+ }
+ }
+
+ return nil
+}
+
+func (s *TblMapSliceDef) SupportsUpsert() bool {
+ return true
+}
+
+func (s *TblMapSliceDef) TableName() string {
+ return "tbl_map_slice"
+}
+
+func (s *TblMapSliceDef) Keyspace() string {
+ return "cqlc"
+}
+
+func (s *TblMapSliceDef) Bind(v TblMapSlice) cqlc.TableBinding {
+ cols := []cqlc.ColumnBinding{
+
+ {Column: &TblMapSliceIdColumn{}, Value: v.Id},
+
+ {Column: &TblMapSliceSlColumn{}, Value: v.Sl},
+
+ {Column: &TblMapSliceSsmColumn{}, Value: v.Ssm},
+ }
+ return cqlc.TableBinding{Table: &TblMapSliceDef{}, Columns: cols}
+}
+
+func (s *TblMapSliceDef) To(v *TblMapSlice) cqlc.TableBinding {
+ cols := []cqlc.ColumnBinding{
+
+ {Column: &TblMapSliceIdColumn{}, Value: &v.Id},
+
+ {Column: &TblMapSliceSlColumn{}, Value: &v.Sl},
+
+ {Column: &TblMapSliceSsmColumn{}, Value: &v.Ssm},
+ }
+ return cqlc.TableBinding{Table: &TblMapSliceDef{}, Columns: cols}
+}
+
+func (s *TblMapSliceDef) ColumnDefinitions() []cqlc.Column {
+ return []cqlc.Column{
+
+ &TblMapSliceIdColumn{},
+
+ &TblMapSliceSlColumn{},
+
+ &TblMapSliceSsmColumn{},
+ }
+}
+
+func TblMapSliceTableDef() *TblMapSliceDef {
+ return &TblMapSliceDef{
+
+ ID: &TblMapSliceIdColumn{},
+
+ SL: &TblMapSliceSlColumn{},
+
+ SSM: &TblMapSliceSsmColumn{},
+ }
+}
+
+var TBL_MAP_SLICE = TblMapSliceTableDef()
+
+func (s *TblMapSliceDef) IdColumn() cqlc.LastPartitionedStringColumn {
+ return &TblMapSliceIdColumn{}
+}
+
+func (s *TblMapSliceDef) SlColumn() cqlc.StringSliceColumn {
+ return &TblMapSliceSlColumn{}
+}
+
+func (s *TblMapSliceDef) SsmColumn() cqlc.StringStringMapColumn {
+ return &TblMapSliceSsmColumn{}
+}
+
+type TblStringMapIdColumn struct {
+}
+
+func (b *TblStringMapIdColumn) ColumnName() string {
+ return "id"
+}
+
+func (b *TblStringMapIdColumn) To(value *string) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+}
+
+func (b *TblStringMapIdColumn) Eq(value string) cqlc.Condition {
+ column := &TblStringMapIdColumn{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.EqPredicate}
+}
+
+func (b *TblStringMapIdColumn) PartitionBy() cqlc.Column {
+ return b
+}
+
+func (b *TblStringMapIdColumn) In(value ...string) cqlc.Condition {
+ column := &TblStringMapIdColumn{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.InPredicate}
+}
+
+type TblStringMapSsmColumn struct {
+}
+
+func (b *TblStringMapSsmColumn) ColumnName() string {
+ return "ssm"
+}
+
+func (b *TblStringMapSsmColumn) To(value *map[string]string) cqlc.ColumnBinding {
+ return cqlc.ColumnBinding{Column: b, Value: value}
+}
+
+type TblStringMap struct {
+ Id string
+ Ssm map[string]string
+}
+
+func (s *TblStringMap) IdValue() string {
+ return s.Id
+}
+
+func (s *TblStringMap) SsmValue() map[string]string {
+ return s.Ssm
+}
+
+type TblStringMapDef struct {
+ ID cqlc.LastPartitionedStringColumn
+ SSM cqlc.StringStringMapColumn
+}
+
+func BindTblStringMap(iter *gocql.Iter) ([]TblStringMap, error) {
+ array := make([]TblStringMap, 0)
+ err := MapTblStringMap(iter, func(t TblStringMap) (bool, error) {
+ array = append(array, t)
+ return true, nil
+ })
+ return array, err
+}
+
+func MapTblStringMap(iter *gocql.Iter, callback func(t TblStringMap) (bool, error)) error {
+ columns := iter.Columns()
+ row := make([]interface{}, len(columns))
+
+ for {
+ t := TblStringMap{}
+
+ for i := 0; i < len(columns); i++ {
+ switch columns[i].Name {
+
+ case "id":
+ row[i] = &t.Id
+
+ case "ssm":
+ row[i] = &t.Ssm
+
+ default:
+ return errors.Errorf("cqlc: unhandled column: %s", columns[i].Name)
+ }
+ }
+ if !iter.Scan(row...) {
+ break
+ }
+
+ readNext, err := callback(t)
+ if err != nil {
+ return err
+ }
+ if !readNext {
+ return nil
+ }
+ }
+
+ return nil
+}
+
+func (s *TblStringMapDef) SupportsUpsert() bool {
+ return true
+}
+
+func (s *TblStringMapDef) TableName() string {
+ return "tbl_string_map"
+}
+
+func (s *TblStringMapDef) Keyspace() string {
+ return "cqlc"
+}
+
+func (s *TblStringMapDef) Bind(v TblStringMap) cqlc.TableBinding {
+ cols := []cqlc.ColumnBinding{
+
+ {Column: &TblStringMapIdColumn{}, Value: v.Id},
+
+ {Column: &TblStringMapSsmColumn{}, Value: v.Ssm},
+ }
+ return cqlc.TableBinding{Table: &TblStringMapDef{}, Columns: cols}
+}
+
+func (s *TblStringMapDef) To(v *TblStringMap) cqlc.TableBinding {
+ cols := []cqlc.ColumnBinding{
+
+ {Column: &TblStringMapIdColumn{}, Value: &v.Id},
+
+ {Column: &TblStringMapSsmColumn{}, Value: &v.Ssm},
+ }
+ return cqlc.TableBinding{Table: &TblStringMapDef{}, Columns: cols}
+}
+
+func (s *TblStringMapDef) ColumnDefinitions() []cqlc.Column {
+ return []cqlc.Column{
+
+ &TblStringMapIdColumn{},
+
+ &TblStringMapSsmColumn{},
+ }
+}
+
+func TblStringMapTableDef() *TblStringMapDef {
+ return &TblStringMapDef{
+
+ ID: &TblStringMapIdColumn{},
+
+ SSM: &TblStringMapSsmColumn{},
+ }
+}
+
+var TBL_STRING_MAP = TblStringMapTableDef()
+
+func (s *TblStringMapDef) IdColumn() cqlc.LastPartitionedStringColumn {
+ return &TblStringMapIdColumn{}
+}
+
+func (s *TblStringMapDef) SsmColumn() cqlc.StringStringMapColumn {
+ return &TblStringMapSsmColumn{}
+}
diff --git a/generator/binding_tmpl.go b/generator/binding_tmpl.go
deleted file mode 100644
index bfbfb5b..0000000
--- a/generator/binding_tmpl.go
+++ /dev/null
@@ -1,248 +0,0 @@
-package generator
-
-import (
- "bytes"
- "compress/gzip"
- "fmt"
- "io"
- "strings"
-)
-
-func bindata_read(data []byte, name string) ([]byte, error) {
- gz, err := gzip.NewReader(bytes.NewBuffer(data))
- if err != nil {
- return nil, fmt.Errorf("Read %q: %v", name, err)
- }
-
- var buf bytes.Buffer
- _, err = io.Copy(&buf, gz)
- gz.Close()
-
- if err != nil {
- return nil, fmt.Errorf("Read %q: %v", name, err)
- }
-
- return buf.Bytes(), nil
-}
-
-func generator_tmpl_binding_tmpl() ([]byte, error) {
- return bindata_read([]byte{
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xec, 0x5a,
- 0xdf, 0x6f, 0xda, 0xba, 0x17, 0x7f, 0xe7, 0xaf, 0xf0, 0xaa, 0xaa, 0x0a,
- 0x1d, 0x5f, 0xb6, 0x67, 0xbe, 0xb7, 0x0f, 0x8c, 0x66, 0x6d, 0x34, 0x2e,
- 0xb0, 0x26, 0x5d, 0x35, 0x4d, 0xd3, 0x64, 0x82, 0x69, 0xa3, 0x86, 0x84,
- 0x25, 0xa6, 0x1b, 0x8a, 0xf8, 0xdf, 0xef, 0xb1, 0x63, 0x13, 0xc7, 0x71,
- 0x28, 0x14, 0x2a, 0xdd, 0x5d, 0xe1, 0x97, 0x86, 0xe4, 0xf8, 0xfc, 0xf8,
- 0x9c, 0x8f, 0x7f, 0x1d, 0xf7, 0xdd, 0x3b, 0xe4, 0x5d, 0x3b, 0x2e, 0xfa,
- 0xe8, 0xf4, 0x6d, 0x74, 0xd7, 0x75, 0x51, 0xf7, 0xd6, 0x1b, 0x5e, 0xd9,
- 0x03, 0xfb, 0xa6, 0xeb, 0xd9, 0x97, 0xe8, 0x7f, 0xa8, 0x3b, 0xf8, 0x8a,
- 0xec, 0x4b, 0xc7, 0x73, 0x91, 0x37, 0xcc, 0x45, 0xef, 0x9c, 0x7e, 0x1f,
- 0x7d, 0xb0, 0x51, 0x7f, 0xe8, 0x7a, 0xe8, 0xee, 0xda, 0x1e, 0x20, 0xc7,
- 0x43, 0xf0, 0xfe, 0xc6, 0x5e, 0xf7, 0x6b, 0x80, 0xda, 0x42, 0xc9, 0xad,
- 0xeb, 0x0c, 0xae, 0xd0, 0x27, 0xfb, 0xab, 0x3b, 0xea, 0xf6, 0x6c, 0x94,
- 0x65, 0xa8, 0x3d, 0x4a, 0xe2, 0x27, 0x12, 0xe1, 0xc8, 0x27, 0xed, 0x4f,
- 0x64, 0x99, 0xce, 0xb1, 0x4f, 0xd0, 0x6a, 0xc5, 0xba, 0x75, 0x3d, 0x5d,
- 0xc0, 0x0b, 0x66, 0x24, 0xa5, 0x78, 0x36, 0x07, 0x09, 0xa1, 0xcb, 0xff,
- 0x19, 0xfa, 0xe8, 0x8b, 0x7d, 0xe3, 0x3a, 0xc3, 0x81, 0x2e, 0xfe, 0x85,
- 0x24, 0x69, 0x10, 0x47, 0x52, 0xdd, 0x55, 0xd7, 0x19, 0x80, 0x9f, 0xd7,
- 0xcc, 0x59, 0xe7, 0x52, 0x17, 0xbe, 0x8e, 0x53, 0xea, 0x4c, 0x98, 0x62,
- 0xcb, 0xb5, 0x6f, 0x40, 0x63, 0x9d, 0x56, 0x97, 0x24, 0x4f, 0x24, 0xb9,
- 0x21, 0x21, 0xc1, 0x29, 0x73, 0xb5, 0xc9, 0x94, 0xf7, 0xfa, 0x8e, 0x3d,
- 0xf0, 0xd0, 0xc0, 0xbe, 0x1a, 0x7a, 0x0e, 0x0f, 0xb5, 0xf7, 0xb9, 0x5f,
- 0xa7, 0x61, 0x40, 0xee, 0x63, 0x1a, 0x60, 0x4a, 0x26, 0x4c, 0x48, 0xb1,
- 0xe8, 0xde, 0x8e, 0x46, 0xc3, 0x1b, 0x00, 0xf8, 0x76, 0xc4, 0x30, 0x36,
- 0x1a, 0xce, 0xbb, 0x34, 0x1b, 0x0d, 0xf8, 0x7a, 0x9a, 0x2e, 0x67, 0xe3,
- 0x38, 0x4c, 0x51, 0xe7, 0x02, 0xb5, 0x87, 0x73, 0x0a, 0xc1, 0xa6, 0x6d,
- 0x57, 0xbc, 0x83, 0xa8, 0x99, 0xc8, 0xa3, 0x04, 0x95, 0xc9, 0xd4, 0x80,
- 0xdd, 0x80, 0x87, 0x47, 0x7c, 0x4f, 0xb8, 0x45, 0xa9, 0x67, 0x24, 0xde,
- 0xb1, 0xef, 0xc1, 0x6c, 0x1e, 0x27, 0x14, 0x59, 0x0d, 0x04, 0x2d, 0xcb,
- 0x12, 0x1c, 0xc1, 0x87, 0xd3, 0x1f, 0x2d, 0x74, 0x3a, 0xc7, 0xf4, 0x81,
- 0xab, 0x76, 0xb8, 0x48, 0x0a, 0xd2, 0x48, 0xb4, 0x93, 0x2c, 0xe3, 0x9f,
- 0x57, 0xab, 0x13, 0xd1, 0x8f, 0x44, 0x13, 0xf8, 0x0e, 0xbe, 0xfb, 0x60,
- 0x40, 0xaa, 0x83, 0x80, 0x7a, 0x3f, 0x24, 0x52, 0x17, 0xac, 0x57, 0x4d,
- 0x12, 0x4f, 0x1a, 0x3c, 0x6a, 0xc5, 0xb8, 0x3f, 0xe5, 0xa6, 0x3d, 0x3c,
- 0x0e, 0x09, 0xb3, 0x2c, 0xcc, 0xa0, 0x53, 0x97, 0x26, 0x0b, 0x9f, 0x7a,
- 0xcb, 0x39, 0x0f, 0x3b, 0x8d, 0xf0, 0x23, 0xf1, 0xe2, 0x1e, 0x9e, 0x91,
- 0x90, 0x75, 0x6a, 0x0f, 0xe0, 0x09, 0x15, 0xf2, 0xaa, 0xc6, 0x38, 0x64,
- 0x3d, 0x98, 0x50, 0x2f, 0x0e, 0x17, 0xb3, 0x48, 0x0d, 0x88, 0x69, 0x86,
- 0xb7, 0x1b, 0x95, 0xc7, 0xe1, 0x5a, 0xbb, 0xda, 0xed, 0xf3, 0x02, 0x87,
- 0xc1, 0x34, 0x80, 0x8c, 0x57, 0xfa, 0xcf, 0x93, 0x20, 0xa2, 0x25, 0x97,
- 0x35, 0x23, 0x8a, 0x2a, 0xca, 0x7e, 0x03, 0xac, 0x66, 0x75, 0xab, 0x55,
- 0xee, 0x33, 0x4a, 0xf9, 0xab, 0x6c, 0xdd, 0x4d, 0x78, 0x11, 0x4c, 0x51,
- 0xba, 0x98, 0xf3, 0x34, 0xf5, 0xc2, 0x45, 0x4a, 0x09, 0x58, 0xbe, 0xcf,
- 0x63, 0x56, 0x6c, 0xb0, 0x36, 0x21, 0xa9, 0x8f, 0xc6, 0x71, 0x1c, 0xea,
- 0x2a, 0x20, 0x83, 0xaa, 0xac, 0x80, 0x90, 0xb5, 0xe9, 0x22, 0xf2, 0x91,
- 0x35, 0x46, 0xe7, 0x5b, 0xf8, 0xd7, 0x44, 0xf9, 0x03, 0x43, 0xca, 0x6a,
- 0x32, 0x77, 0x99, 0x23, 0x65, 0x7f, 0x13, 0x42, 0x17, 0x49, 0xc4, 0x49,
- 0x24, 0x41, 0x95, 0x44, 0xd2, 0x2c, 0xe7, 0x91, 0x05, 0x69, 0x3f, 0x48,
- 0x05, 0x7e, 0x22, 0xa2, 0x92, 0xbe, 0xdd, 0xfc, 0x93, 0xba, 0xc0, 0x3b,
- 0x36, 0xc3, 0x08, 0x32, 0x68, 0x2e, 0x2a, 0x6e, 0x9e, 0x6d, 0x48, 0xb2,
- 0x54, 0x9b, 0x95, 0x31, 0x2e, 0x47, 0x20, 0x80, 0x7d, 0x21, 0x9c, 0x5e,
- 0x6c, 0x3d, 0xe1, 0x70, 0x41, 0xd0, 0x79, 0x96, 0xf1, 0x87, 0x35, 0x0e,
- 0x30, 0x55, 0xa8, 0x11, 0x7c, 0x08, 0xa2, 0x49, 0x2d, 0xd6, 0x55, 0xb9,
- 0x2c, 0xff, 0xd5, 0x41, 0xe3, 0x16, 0xfa, 0xc2, 0xf4, 0x76, 0x10, 0x57,
- 0x6f, 0x64, 0x40, 0x9e, 0x87, 0x07, 0x9c, 0xba, 0x04, 0xc6, 0xf7, 0x04,
- 0x27, 0x4b, 0x27, 0x9a, 0x90, 0xdf, 0x46, 0x82, 0xed, 0x16, 0x9e, 0xfd,
- 0x53, 0x84, 0xb7, 0x21, 0x3a, 0xf0, 0x97, 0xcd, 0x5b, 0x86, 0x14, 0xf9,
- 0xb9, 0x1a, 0x18, 0x6b, 0x67, 0xcf, 0x1a, 0xd3, 0x72, 0xc4, 0xda, 0x58,
- 0x40, 0x06, 0xfd, 0x37, 0x00, 0x94, 0x1b, 0xa9, 0x43, 0xc9, 0x0c, 0xb4,
- 0x70, 0x39, 0x13, 0xba, 0x3a, 0xd2, 0x54, 0x0b, 0x8d, 0x12, 0x32, 0x09,
- 0x7c, 0x58, 0x21, 0x3a, 0xb9, 0xac, 0xfd, 0x73, 0xfd, 0x46, 0x27, 0xd1,
- 0x06, 0x0e, 0xc9, 0x81, 0xd1, 0x8b, 0x17, 0x11, 0x0c, 0x76, 0x01, 0xe7,
- 0xfe, 0xe9, 0xe8, 0xe1, 0xc8, 0x89, 0xfc, 0x84, 0xcc, 0x48, 0x44, 0x61,
- 0x80, 0xb0, 0x79, 0xa2, 0x7e, 0x64, 0x80, 0x02, 0xb2, 0xc1, 0xe5, 0x30,
- 0x25, 0xba, 0x33, 0xe5, 0x99, 0x6a, 0x84, 0x13, 0xca, 0x61, 0xaa, 0x9b,
- 0xab, 0x8a, 0x2e, 0x51, 0x0c, 0x6b, 0x8a, 0x99, 0x7f, 0x4d, 0x53, 0xaf,
- 0xdd, 0x23, 0xdf, 0x8f, 0x88, 0xb2, 0xed, 0x49, 0x48, 0xd9, 0x0e, 0x49,
- 0x4c, 0x2d, 0x69, 0x87, 0x23, 0xa8, 0x6c, 0xc6, 0x9c, 0x69, 0xab, 0xc9,
- 0xcb, 0x72, 0xb2, 0x26, 0xc8, 0x87, 0xe5, 0xb3, 0xb3, 0xb5, 0x12, 0xe2,
- 0xb8, 0xf2, 0xb1, 0x8e, 0x56, 0xb0, 0xb2, 0xe0, 0x94, 0xf6, 0x62, 0xd8,
- 0xe0, 0x44, 0x84, 0x2d, 0xd5, 0x8c, 0x84, 0x6c, 0xef, 0x71, 0x10, 0x4a,
- 0x39, 0x91, 0xa0, 0x54, 0xbb, 0xdd, 0x3e, 0xb2, 0xaa, 0xcc, 0x2a, 0x27,
- 0x3a, 0x10, 0xab, 0x6a, 0xdf, 0x6e, 0xde, 0x12, 0xed, 0xc9, 0x4c, 0xa1,
- 0xf1, 0x2e, 0xa0, 0x0f, 0x75, 0xbb, 0x1c, 0x0d, 0xa1, 0x71, 0x5b, 0xdd,
- 0x18, 0x19, 0x18, 0xba, 0xa7, 0x47, 0x97, 0xb0, 0xaf, 0x5b, 0x0f, 0x92,
- 0xdc, 0x3b, 0x2e, 0xfc, 0xec, 0x68, 0xd9, 0x82, 0x52, 0x6c, 0xcf, 0xd8,
- 0xe1, 0xd3, 0x7d, 0x35, 0x2b, 0x7b, 0x3b, 0xee, 0xa4, 0xcc, 0x75, 0xc2,
- 0x79, 0x52, 0xbf, 0xe4, 0x94, 0x90, 0x64, 0xfe, 0x6c, 0xe3, 0xc8, 0x71,
- 0xed, 0xf8, 0x93, 0xd7, 0x8e, 0xe3, 0x9c, 0x8d, 0xfe, 0x5d, 0xd9, 0x3c,
- 0xd8, 0x9c, 0xbd, 0x7b, 0x5a, 0xae, 0xe8, 0xbe, 0x23, 0xec, 0x00, 0xf9,
- 0x38, 0x74, 0x2e, 0x5e, 0x9a, 0x87, 0x2b, 0xba, 0x21, 0x0f, 0x7b, 0x23,
- 0x4d, 0x8e, 0x48, 0x17, 0x48, 0x93, 0x57, 0x44, 0xba, 0x7f, 0xe4, 0x74,
- 0x81, 0x74, 0xff, 0x35, 0x39, 0xdd, 0x3f, 0x72, 0x5a, 0x41, 0x7a, 0x7b,
- 0x4e, 0x57, 0x67, 0x6f, 0x6d, 0x75, 0x96, 0x75, 0x5f, 0xfe, 0x43, 0x56,
- 0x30, 0x55, 0x44, 0x44, 0xbd, 0x52, 0x41, 0x75, 0xfb, 0x9a, 0x6c, 0x2e,
- 0x6d, 0x2e, 0xc2, 0x82, 0xe6, 0x6a, 0x2e, 0x15, 0x1b, 0xb9, 0x5b, 0x79,
- 0x44, 0x3b, 0x96, 0x82, 0x73, 0x6a, 0xa5, 0x39, 0xb5, 0xd4, 0x58, 0x9a,
- 0x1b, 0xbc, 0xe1, 0xe9, 0xb2, 0x9a, 0x06, 0xa7, 0xcc, 0xf5, 0xb8, 0xb4,
- 0x5d, 0xaf, 0xab, 0x51, 0x4e, 0xc6, 0xb3, 0x18, 0x5f, 0x92, 0xe9, 0xfe,
- 0x30, 0xd3, 0xf8, 0x76, 0x3e, 0x27, 0x89, 0x86, 0x70, 0xce, 0xc6, 0xa2,
- 0xf2, 0xaa, 0x6d, 0xb3, 0x0c, 0x38, 0x73, 0xf4, 0x18, 0x09, 0x35, 0x27,
- 0xad, 0x00, 0x0e, 0x24, 0xe8, 0xfc, 0x3e, 0x06, 0x0e, 0xb6, 0x1d, 0x78,
- 0x6e, 0x22, 0xeb, 0xdb, 0x77, 0x4d, 0xa8, 0x85, 0x48, 0x92, 0xc4, 0xf0,
- 0xa9, 0x88, 0x03, 0x27, 0x09, 0x5e, 0x32, 0xe7, 0x67, 0x00, 0x96, 0xa9,
- 0xc7, 0xfb, 0xe2, 0x2c, 0x05, 0x9d, 0x99, 0xe4, 0xdf, 0x78, 0x6e, 0x32,
- 0xde, 0xe2, 0xbe, 0x59, 0xb4, 0x9a, 0x56, 0x8b, 0x9d, 0x39, 0x0c, 0xb6,
- 0x0b, 0xfb, 0x17, 0x08, 0x03, 0x3a, 0xd1, 0xc4, 0xe2, 0x3f, 0x5b, 0x88,
- 0x36, 0x4d, 0x49, 0x65, 0x07, 0xa4, 0x16, 0x8a, 0x82, 0xa2, 0xb4, 0xbe,
- 0x2a, 0xe4, 0x84, 0x8c, 0x50, 0x00, 0xb6, 0x2a, 0xa8, 0xd5, 0xf8, 0xad,
- 0x82, 0xd6, 0x42, 0x3e, 0x0e, 0xc3, 0x31, 0xf6, 0x1f, 0xb7, 0x0b, 0xa6,
- 0x99, 0xff, 0x55, 0x62, 0xca, 0x33, 0xca, 0xaf, 0x95, 0x98, 0x72, 0xc9,
- 0x07, 0xe5, 0x44, 0x9a, 0xc4, 0xbf, 0x14, 0xbc, 0x03, 0x56, 0x5e, 0x9c,
- 0x62, 0x9f, 0x64, 0x80, 0x75, 0x48, 0x22, 0x4b, 0x28, 0x68, 0x36, 0x95,
- 0x82, 0x76, 0xc9, 0x02, 0xa7, 0x29, 0xd3, 0xa0, 0xb9, 0x96, 0xe9, 0x55,
- 0x7b, 0xe8, 0x15, 0x30, 0xb9, 0xf7, 0xff, 0x87, 0xbf, 0x7f, 0x95, 0x94,
- 0xc3, 0x9b, 0xb7, 0x6f, 0x0d, 0x53, 0x71, 0xfa, 0x2b, 0xa0, 0xfe, 0x83,
- 0x0c, 0xe2, 0x5b, 0xf0, 0x3d, 0xbf, 0x91, 0xa9, 0x0a, 0xee, 0x46, 0xff,
- 0x35, 0x38, 0xec, 0xda, 0x4f, 0xbb, 0x96, 0xe8, 0x30, 0x40, 0xc0, 0x12,
- 0x70, 0xe0, 0x8c, 0x6e, 0x33, 0x6a, 0x0b, 0x17, 0x8a, 0xc1, 0xa1, 0xb6,
- 0x09, 0x99, 0xe2, 0x45, 0x48, 0x3b, 0x46, 0x0f, 0xc2, 0xf8, 0xbe, 0xfd,
- 0x11, 0x53, 0x1c, 0x5a, 0x27, 0x8b, 0xe8, 0x01, 0x47, 0x93, 0x90, 0x4c,
- 0x44, 0xb8, 0x1d, 0x74, 0xd2, 0xd2, 0x23, 0x37, 0xd5, 0x11, 0xea, 0x7f,
- 0xc1, 0xe1, 0xe9, 0x0d, 0x4f, 0xba, 0xeb, 0xe3, 0xc8, 0x82, 0xb0, 0xe0,
- 0x8c, 0xa3, 0xf3, 0x9d, 0xb5, 0x71, 0x42, 0xf0, 0x63, 0xdd, 0x85, 0x06,
- 0x6b, 0xf0, 0x7d, 0x32, 0x20, 0xbf, 0x69, 0x4b, 0x0e, 0x39, 0xc9, 0x4a,
- 0x4b, 0x1b, 0x18, 0x60, 0x91, 0x49, 0xbc, 0xb9, 0x60, 0xa3, 0xa2, 0xbe,
- 0x90, 0x2c, 0x47, 0x43, 0xbd, 0xdb, 0xd2, 0x62, 0xbd, 0x0e, 0x75, 0xd8,
- 0x95, 0x75, 0x28, 0xce, 0x6b, 0xb2, 0xc5, 0xb5, 0x62, 0xb5, 0x98, 0xfe,
- 0x11, 0xcf, 0x82, 0x70, 0xa9, 0xcf, 0x78, 0xb5, 0x8b, 0x03, 0x9b, 0x84,
- 0x59, 0x2d, 0x43, 0xe8, 0xe0, 0xf7, 0x96, 0xe6, 0x6a, 0x86, 0xa9, 0x78,
- 0x2e, 0x67, 0x7a, 0x5e, 0x34, 0xdf, 0xde, 0x9c, 0x2b, 0xea, 0x5b, 0xb7,
- 0xf3, 0x94, 0x24, 0x35, 0xf5, 0xfa, 0xcd, 0xe6, 0x94, 0xb5, 0xfc, 0x19,
- 0x5b, 0x3c, 0xa2, 0xba, 0x5b, 0x3d, 0xf5, 0x46, 0x6f, 0x5a, 0xba, 0xd0,
- 0xdb, 0x4e, 0xb9, 0xbc, 0xb1, 0x7e, 0x46, 0xb7, 0xbc, 0xf0, 0xde, 0x4d,
- 0x39, 0x5b, 0x8d, 0xac, 0xa7, 0xea, 0x4c, 0xc9, 0x77, 0x43, 0x3c, 0xac,
- 0xea, 0xd5, 0x99, 0x2f, 0xae, 0xde, 0xbf, 0x7d, 0x37, 0xec, 0xd5, 0x5e,
- 0xbc, 0xc8, 0xbe, 0xe8, 0x8e, 0x59, 0x76, 0x3d, 0xd0, 0x3d, 0x33, 0x8f,
- 0xae, 0x7e, 0xff, 0xb9, 0xdd, 0x6d, 0x67, 0xb1, 0x3f, 0xdd, 0x30, 0x23,
- 0xae, 0x5a, 0xc6, 0x8d, 0x42, 0x41, 0x40, 0x25, 0xbb, 0x95, 0x5c, 0x64,
- 0xfc, 0x07, 0xf7, 0x47, 0x4f, 0x29, 0x33, 0x2f, 0x10, 0xe6, 0xfb, 0xe5,
- 0xb4, 0xba, 0x01, 0xd9, 0x40, 0xe3, 0x18, 0xa8, 0x70, 0x7e, 0xe4, 0xc2,
- 0x2b, 0x70, 0xe1, 0xec, 0x8f, 0x23, 0x43, 0xde, 0x11, 0x9e, 0x83, 0x88,
- 0x9f, 0x9e, 0x60, 0x1b, 0x54, 0xce, 0x72, 0x75, 0x1a, 0x2a, 0x7d, 0xd6,
- 0xff, 0x0d, 0x63, 0xd7, 0x3d, 0xc7, 0x1e, 0x2c, 0x78, 0x05, 0x26, 0xb0,
- 0xb6, 0x65, 0xca, 0xb5, 0xb8, 0x4d, 0xf9, 0x54, 0x33, 0xa0, 0x81, 0xcf,
- 0xb3, 0x09, 0xa8, 0x03, 0xda, 0xfa, 0x48, 0x64, 0x79, 0xa9, 0x60, 0x6e,
- 0x4a, 0xfb, 0x7f, 0x0e, 0x79, 0xf3, 0x11, 0x6c, 0xeb, 0x41, 0xb8, 0x7d,
- 0x46, 0xf2, 0xdd, 0xce, 0xfa, 0xff, 0xcb, 0x14, 0xb1, 0x27, 0x9c, 0x94,
- 0xdc, 0x90, 0x2b, 0x39, 0xaa, 0xec, 0xe5, 0x8b, 0x0c, 0x9a, 0x76, 0x12,
- 0x7f, 0xd2, 0xbf, 0x5d, 0xad, 0x67, 0x88, 0x2a, 0xc7, 0x9a, 0x06, 0xf7,
- 0x24, 0xe2, 0xfc, 0xa8, 0x6f, 0x3e, 0x1d, 0x9b, 0xf7, 0x5f, 0x3b, 0xfe,
- 0x17, 0x91, 0x76, 0xf4, 0x17, 0x0f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff,
- 0x96, 0x1d, 0x87, 0x6d, 0xc8, 0x29, 0x00, 0x00,
- },
- "generator/tmpl/binding.tmpl",
- )
-}
-
-// Asset loads and returns the asset for the given name.
-// It returns an error if the asset could not be found or
-// could not be loaded.
-func Asset(name string) ([]byte, error) {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- if f, ok := _bindata[cannonicalName]; ok {
- return f()
- }
- return nil, fmt.Errorf("Asset %s not found", name)
-}
-
-// AssetNames returns the names of the assets.
-func AssetNames() []string {
- names := make([]string, 0, len(_bindata))
- for name := range _bindata {
- names = append(names, name)
- }
- return names
-}
-
-// _bindata is a table, holding each asset generator, mapped to its name.
-var _bindata = map[string]func() ([]byte, error){
- "generator/tmpl/binding.tmpl": generator_tmpl_binding_tmpl,
-}
-// AssetDir returns the file names below a certain
-// directory embedded in the file by go-bindata.
-// For example if you run go-bindata on data/... and data contains the
-// following hierarchy:
-// data/
-// foo.txt
-// img/
-// a.png
-// b.png
-// then AssetDir("data") would return []string{"foo.txt", "img"}
-// AssetDir("data/img") would return []string{"a.png", "b.png"}
-// AssetDir("foo.txt") and AssetDir("notexist") would return an error
-// AssetDir("") will return []string{"data"}.
-func AssetDir(name string) ([]string, error) {
- node := _bintree
- if len(name) != 0 {
- cannonicalName := strings.Replace(name, "\\", "/", -1)
- pathList := strings.Split(cannonicalName, "/")
- for _, p := range pathList {
- node = node.Children[p]
- if node == nil {
- return nil, fmt.Errorf("Asset %s not found", name)
- }
- }
- }
- if node.Func != nil {
- return nil, fmt.Errorf("Asset %s not found", name)
- }
- rv := make([]string, 0, len(node.Children))
- for name := range node.Children {
- rv = append(rv, name)
- }
- return rv, nil
-}
-
-type _bintree_t struct {
- Func func() ([]byte, error)
- Children map[string]*_bintree_t
-}
-var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
- "generator": &_bintree_t{nil, map[string]*_bintree_t{
- "tmpl": &_bintree_t{nil, map[string]*_bintree_t{
- "binding.tmpl": &_bintree_t{generator_tmpl_binding_tmpl, map[string]*_bintree_t{
- }},
- }},
- }},
-}}
diff --git a/generator/generator.go b/generator/generator.go
index 0980189..cb3306b 100644
--- a/generator/generator.go
+++ b/generator/generator.go
@@ -2,17 +2,18 @@ package generator
import (
"bytes"
- "errors"
- "fmt"
- "github.com/gocql/gocql"
"go/format"
"io"
"io/ioutil"
+ "log"
"os"
"path/filepath"
"strconv"
"strings"
"time"
+
+ "github.com/gocql/gocql"
+ "github.com/pkg/errors"
)
var (
@@ -47,6 +48,7 @@ func Generate(opts *Options, version string) error {
if err != nil {
return err
}
+ log.Println("valid options")
var b bytes.Buffer
if err = generateBinding(opts, version, &b); err != nil {
@@ -80,12 +82,12 @@ func coalesceImports(md *gocql.KeyspaceMetadata) []string {
set[path] = true
}
- set["github.com/relops/cqlc/cqlc"] = true
set["github.com/gocql/gocql"] = true
- set["log"] = true
+ set["github.com/pkg/errors"] = true
+ set["github.com/relops/cqlc/cqlc"] = true
paths := make([]string, 0)
- for path, _ := range set {
+ for path := range set {
paths = append(paths, path)
}
@@ -106,9 +108,11 @@ func generateBinding(opts *Options, version string, w io.Writer) error {
s, err := cluster.CreateSession()
if err != nil {
- return fmt.Errorf("Connect error", err)
+ return errors.Errorf("Connect error %s", err)
}
+ log.Println("connected")
+
defer s.Close()
var protoString, release, cqlVersion string
@@ -116,12 +120,12 @@ func generateBinding(opts *Options, version string, w io.Writer) error {
err = s.Query(`SELECT native_protocol_version, release_version, cql_version, host_id
FROM system.local`).Scan(&protoString, &release, &cqlVersion, &hostId)
if err != nil {
- return fmt.Errorf("System metadata error", err)
+ return errors.Errorf("System metadata error %s", err)
}
proto, err := strconv.Atoi(protoString)
if err != nil {
- return fmt.Errorf("Could not parse protocol version", err)
+ return errors.Errorf("Could not parse protocol version %s", err)
}
if proto > 3 {
@@ -130,7 +134,7 @@ func generateBinding(opts *Options, version string, w io.Writer) error {
s, err = cluster.CreateSession()
if err != nil {
- return fmt.Errorf("Re-connect error", err)
+ return errors.Errorf("Re-connect error %s", err)
}
}
@@ -140,6 +144,8 @@ func generateBinding(opts *Options, version string, w io.Writer) error {
return err
}
+ log.Printf("keyspace meta %v", md)
+
provenance := Provenance{
Keyspace: opts.Keyspace,
Version: version,
@@ -161,19 +167,30 @@ func generateBinding(opts *Options, version string, w io.Writer) error {
return err
}
+ //ioutil.WriteFile("testdata/tmp.go", b.Bytes(), 0664)
+
+ log.Println("template rendered")
+
+ // FIXME: got error when formatting source https://github.com/pingginp/cqlc/issues/7
bfmt, err := format.Source(b.Bytes())
if err != nil {
return err
}
+ log.Println("formatted rendered code")
+
if _, err := w.Write(bfmt); err != nil {
return err
}
+ log.Println("generateBinding finished")
+
return nil
}
func importPaths(md *gocql.KeyspaceMetadata) (imports []string) {
+ log.Println("importPaths called")
+
// Ideally need to use a set
paths := make(map[string]bool)
@@ -190,15 +207,24 @@ func importPaths(md *gocql.KeyspaceMetadata) (imports []string) {
switch t.Type() {
case gocql.TypeList, gocql.TypeSet:
// TODO should probably not swallow this
- ct, _ := t.(gocql.CollectionType)
+ ct, ok := t.(gocql.CollectionType)
+ if !ok {
+ panic("list set")
+ }
f(ct.Elem)
case gocql.TypeMap:
// TODO should probably not swallow this
- ct, _ := t.(gocql.CollectionType)
+ ct, ok := t.(gocql.CollectionType)
+ if !ok {
+ panic("map")
+ }
f(ct.Key)
f(ct.Elem)
default:
- nt, _ := t.(gocql.NativeType)
+ nt, ok := t.(gocql.NativeType)
+ if !ok {
+ panic("native")
+ }
f(nt)
}
}
@@ -216,3 +242,7 @@ func importPaths(md *gocql.KeyspaceMetadata) (imports []string) {
return imports
}
+
+func init() {
+ log.SetFlags(log.Lshortfile)
+}
diff --git a/generator/schema.go b/generator/schema.go
index 4b55d61..6340b59 100644
--- a/generator/schema.go
+++ b/generator/schema.go
@@ -12,6 +12,7 @@ var (
var literalTypes = map[gocql.Type]string{
gocql.TypeAscii: "string",
gocql.TypeVarchar: "string",
+ gocql.TypeText: "string", // the only fix needed for support C*3 ...
gocql.TypeInt: "int32",
gocql.TypeBigInt: "int64",
gocql.TypeFloat: "float32",
@@ -35,6 +36,7 @@ var customImportPaths = map[string]string{
var columnTypes = map[gocql.Type]string{
gocql.TypeAscii: "cqlc.String_Column",
gocql.TypeVarchar: "cqlc.String_Column",
+ gocql.TypeText: "cqlc.String_Column", // the ~~only~~ second fix needed for support C*3 ...
gocql.TypeInt: "cqlc.Int32_Column",
gocql.TypeBigInt: "cqlc.Int64_Column",
gocql.TypeFloat: "cqlc.Float32_Column",
diff --git a/generator/template.go b/generator/template.go
index a98ee5e..2477313 100644
--- a/generator/template.go
+++ b/generator/template.go
@@ -3,10 +3,11 @@ package generator
import (
"bytes"
"fmt"
- "github.com/gocql/gocql"
"regexp"
"strings"
"text/template"
+
+ "github.com/gocql/gocql"
)
var bindingTemplate *template.Template
@@ -27,8 +28,7 @@ func init() {
"isLastComponent": isLastComponent,
"isCounterColumnFamily": isCounterColumnFamily,
}
- temp, _ := generator_tmpl_binding_tmpl()
- bindingTemplate = template.Must(template.New("binding.tmpl").Funcs(m).Parse(string(temp)))
+ bindingTemplate = template.Must(template.New("binding.tmpl").Funcs(m).Parse(Tmpl))
}
// TODO This is metadata specific to the column family that should be cached at compilation
@@ -47,19 +47,19 @@ func isCounterColumn(c gocql.ColumnMetadata) bool {
}
func supportsClustering(c gocql.ColumnMetadata) bool {
- return c.Kind == gocql.CLUSTERING_KEY
+ return c.Kind == gocql.ColumnClusteringKey
}
func supportsPartitioning(c gocql.ColumnMetadata) bool {
- return c.Kind == gocql.PARTITION_KEY
+ return c.Kind == gocql.ColumnPartitionKey
}
func isLastComponent(c gocql.ColumnMetadata, t *gocql.TableMetadata) bool {
switch c.Kind {
- case gocql.PARTITION_KEY:
+ case gocql.ColumnPartitionKey:
lastPartitionKeyColumn := t.PartitionKey[len(t.PartitionKey)-1]
return c.Name == lastPartitionKeyColumn.Name
- case gocql.CLUSTERING_KEY:
+ case gocql.ColumnClusteringKey:
lastClusteringColumn := t.ClusteringColumns[len(t.ClusteringColumns)-1]
return c.Name == lastClusteringColumn.Name
default:
@@ -82,19 +82,22 @@ func columnType(c gocql.ColumnMetadata, table *gocql.TableMetadata) string {
baseType := columnTypes[t.Type()]
// TODO The Kind field should be an enum, not a string
- if c.Kind == gocql.CLUSTERING_KEY {
+ if c.Kind == gocql.ColumnClusteringKey {
replacement := ".Clustered"
if isLastComponent(c, table) {
replacement = ".LastClustered"
}
baseType = strings.Replace(baseType, ".", replacement, 1)
- } else if c.Kind == gocql.PARTITION_KEY {
+ } else if c.Kind == gocql.ColumnPartitionKey {
replacement := ".Partitioned"
if isLastComponent(c, table) {
replacement = ".LastPartitioned"
}
baseType = strings.Replace(baseType, ".", replacement, 1)
- } else if c.Index.Name != "" {
+ //} else if c.Index.Name != "" {
+ } else {
+ // NOTE: this is changed to allow Eq on all columns to use DELETE ... WHERE ... IF ...
+ // see https://github.com/pingginp/cqlc/issues/13
replacement := ".Equality"
baseType = strings.Replace(baseType, ".", replacement, 1)
}
@@ -132,19 +135,26 @@ func columnType(c gocql.ColumnMetadata, table *gocql.TableMetadata) string {
return baseType
}
-func valueType(c gocql.ColumnMetadata) string {
+func valueType(c gocql.ColumnMetadata) (res string) {
+ //defer func() {
+ // log.Printf("col %s %s %s", c.Name, c.Type, res)
+ //}()
t := c.Type
switch t.Type() {
case gocql.TypeList, gocql.TypeSet:
- // TODO should probably not swallow this
- ct, _ := t.(gocql.CollectionType)
+ ct, ok := t.(gocql.CollectionType)
+ if !ok {
+ panic("valueType list, set not collection")
+ }
literal := literalTypes[ct.Elem.Type()]
return fmt.Sprintf("[]%s", literal)
case gocql.TypeMap:
- // TODO should probably not swallow this
- ct, _ := t.(gocql.CollectionType)
+ ct, ok := t.(gocql.CollectionType)
+ if !ok {
+ panic("valueType map not collection")
+ }
key := literalTypes[ct.Key.Type()]
elem := literalTypes[ct.Elem.Type()]
return fmt.Sprintf("map[%s]%s", key, elem)
diff --git a/generator/tmpl/binding.tmpl b/generator/tmpl.go
similarity index 89%
rename from generator/tmpl/binding.tmpl
rename to generator/tmpl.go
index 2666562..9c24784 100644
--- a/generator/tmpl/binding.tmpl
+++ b/generator/tmpl.go
@@ -1,4 +1,6 @@
-// THIS FILE WAS AUTOGENERATED - ANY EDITS TO THIS WILL BE LOST WHEN IT IS REGENERATED
+package generator
+
+const Tmpl = `// Code generated by https://github.com/pingginp/cqlc DO NOT EDIT.
// GENERATED USING KEYSPACE {{ .Provenance.Keyspace }}
// AT {{ .Provenance.Timestamp }} USING cqlc VERSION {{ .Provenance.Version }}
// AGAINST HOST ID {{ .Provenance.HostId }} (SERVER VERSION {{ .Provenance.ServerRelease }})
@@ -11,8 +13,8 @@ package {{ .Options.Package }}
import (
{{range $_, $path := .Imports}}
- "{{$path}}"
- {{end}}
+ "{{$path -}}"
+ {{- end}}
)
const (
@@ -79,8 +81,7 @@ const (
return cqlc.Condition{Binding: binding, Predicate: cqlc.InPredicate}
}
{{ end }}
- {{ end }}
- {{ if supportsClustering $col }}
+ {{ else if supportsClustering $col }}
func (b * {{$QualifiedColStructType}}Column ) ClusterWith() string {
return b.ColumnName()
@@ -129,6 +130,14 @@ const (
binding := cqlc.ColumnBinding{Column: column, Value: value}
return cqlc.Condition{Binding: binding, Predicate: cqlc.LePredicate}
}
+ {{ else }}
+// Eq is used in DELETE IF statement to filter on non primary key columns,
+// introduced in https://github.com/pingginp/cqlc/issues/13
+ func (b * {{$QualifiedColStructType}}Column ) Eq(value {{valueType $col}}) cqlc.Condition {
+ column := &{{$QualifiedColStructType}}Column{}
+ binding := cqlc.ColumnBinding{Column: column, Value: value}
+ return cqlc.Condition{Binding: binding, Predicate: cqlc.EqPredicate}
+ }
{{ end }}
{{ end }}
@@ -136,8 +145,8 @@ const (
type {{$StructType}} struct {
{{range $_, $col := $cf.Columns}}
- {{snakeToCamel $col.Name}} {{valueType $col}}
- {{end}}
+ {{snakeToCamel $col.Name}} {{valueType $col -}}
+ {{- end}}
}
{{range $_, $col := $cf.Columns}}
@@ -148,8 +157,8 @@ const (
type {{$StructType}}Def struct {
{{range $_, $col := $cf.Columns}}
- {{toUpper $col.Name}} {{columnType $col $cf }}
- {{end}}
+ {{toUpper $col.Name}} {{columnType $col $cf -}}
+ {{- end}}
}
func Bind{{$StructType}}(iter *gocql.Iter) ([]{{$StructType}}, error) {
@@ -174,7 +183,7 @@ const (
case "{{$col.Name}}": row[i] = &t.{{snakeToCamel $col.Name}}
{{end}}
default:
- log.Fatal("unhandled column: ", columns[i].Name)
+ return errors.Errorf("cqlc: unhandled column: %s", columns[i].Name)
}
}
if !iter.Scan(row...) {
@@ -216,8 +225,8 @@ const (
{{range $_, $col := $cf.Columns}}
{{ $ColStructType := snakeToCamel $col.Name }}
{{ $QualifiedColStructType := sprint $StructType $ColStructType }}
- cqlc.ColumnBinding{Column: &{{ $QualifiedColStructType }}Column{}, Value: v.{{snakeToCamel $col.Name}}},
- {{end}}
+ {Column: &{{ $QualifiedColStructType }}Column{}, Value: v.{{snakeToCamel $col.Name}}},
+ {{- end}}
}
return cqlc.TableBinding{Table: &{{$StructType}}Def{}, Columns: cols}
}
@@ -227,8 +236,8 @@ const (
{{range $_, $col := $cf.Columns}}
{{ $ColStructType := snakeToCamel $col.Name }}
{{ $QualifiedColStructType := sprint $StructType $ColStructType }}
- cqlc.ColumnBinding{Column: &{{ $QualifiedColStructType }}Column{}, Value: &v.{{snakeToCamel $col.Name}}},
- {{end}}
+ {Column: &{{ $QualifiedColStructType }}Column{}, Value: &v.{{snakeToCamel $col.Name}}},
+ {{- end}}
}
return cqlc.TableBinding{Table: &{{$StructType}}Def{}, Columns: cols}
}
@@ -239,7 +248,7 @@ const (
{{ $ColStructType := snakeToCamel $col.Name }}
{{ $QualifiedColStructType := sprint $StructType $ColStructType }}
&{{ $QualifiedColStructType }}Column{},
- {{end}}
+ {{- end}}
}
}
@@ -265,4 +274,5 @@ const (
}
{{end}}
-{{end}}
\ No newline at end of file
+{{end}}
+`
diff --git a/glide.lock b/glide.lock
new file mode 100644
index 0000000..d69bdef
--- /dev/null
+++ b/glide.lock
@@ -0,0 +1,34 @@
+hash: d4bb692c7281da9ad8d3c490e1125de6946522c7d0243f0f0b603b1e1e3e7b6d
+updated: 2019-02-18T15:22:23.586062-08:00
+imports:
+- name: github.com/gocql/gocql
+ version: 5a139e8dcc59d560335dbda641b9f42085e59b0a
+ subpackages:
+ - internal/lru
+ - internal/murmur
+ - internal/streams
+- name: github.com/golang/snappy
+ version: 2e65f85255dbc3072edf28d6b5b8efc472979f5a
+- name: github.com/hailocab/go-hostpool
+ version: e80d13ce29ede4452c43dea11e79b9bc8a15b478
+- name: github.com/jessevdk/go-flags
+ version: c6ca198ec95c841fdb89fc0de7496fed11ab854e
+- name: github.com/pkg/errors
+ version: c059e472caf75dbe73903f6521a20abac245b17f
+- name: gopkg.in/inf.v0
+ version: d2d2541c53f18d2a059457998ce2876cc8e67cbf
+testImports:
+- name: github.com/davecgh/go-spew
+ version: d8f796af33cc11cb798c1aaeb27a4ebc5099927d
+ subpackages:
+ - spew
+- name: github.com/pmezard/go-difflib
+ version: 792786c7400a136282c1664665ae0a8db921c6c2
+ subpackages:
+ - difflib
+- name: github.com/stretchr/testify
+ version: ffdc059bfe9ce6a4e144ba849dbedead332c6053
+ subpackages:
+ - assert
+ - require
+ - suite
diff --git a/glide.yaml b/glide.yaml
new file mode 100644
index 0000000..d7570e1
--- /dev/null
+++ b/glide.yaml
@@ -0,0 +1,14 @@
+package: github.com/relops/cqlc
+import:
+- package: github.com/gocql/gocql
+- package: github.com/pkg/errors
+- package: github.com/jessevdk/go-flags
+ version: ^1.4.0
+- package: gopkg.in/inf.v0
+ version: ^0.9.1
+testImport:
+- package: github.com/stretchr/testify
+ version: ^1.2.2
+ subpackages:
+ - assert
+ - suite
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..05acd83
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,13 @@
+module github.com/relops/cqlc
+
+require (
+ github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
+ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
+ github.com/gocql/gocql v0.0.0-20180913162544-5a139e8dcc59
+ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
+ github.com/jessevdk/go-flags v1.4.0
+ github.com/kr/pretty v0.1.0 // indirect
+ github.com/pkg/errors v0.0.0-20180911062113-c059e472caf7
+ github.com/stretchr/testify v1.3.0
+ gopkg.in/inf.v0 v0.9.1
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..67c07ec
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,29 @@
+github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY=
+github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
+github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
+github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/gocql/gocql v0.0.0-20180913162544-5a139e8dcc59 h1:+5Ep1OCcZzu0NIxG2/RJ3Nk827wqmFereTaU+xImRPM=
+github.com/gocql/gocql v0.0.0-20180913162544-5a139e8dcc59/go.mod h1:4Fw1eo5iaEhDUs8XyuhSVCVy52Jq3L+/3GJgYkwc+/0=
+github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
+github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
+github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
+github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=
+github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/pkg/errors v0.0.0-20180911062113-c059e472caf7 h1:FBnmUJV+O80F5xekiALhCgT0/QvrSw9JgidANHTm4Cw=
+github.com/pkg/errors v0.0.0-20180911062113-c059e472caf7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
+gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
diff --git a/integration.sh b/integration.sh
deleted file mode 100644
index edc53a1..0000000
--- a/integration.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-set -e
-
-function run_tests() {
- local clusterSize=1
- local version=$1
-
- local conf=(
- "concurrent_reads: 2"
- "concurrent_writes: 2"
- "rpc_server_type: sync"
- "rpc_min_threads: 2"
- "rpc_max_threads: 2"
- "write_request_timeout_in_ms: 5000"
- "read_request_timeout_in_ms: 5000"
- )
-
- ccm remove test || true
-
- ccm create test -v binary:$version -n $clusterSize -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
- ccm updateconf "${conf[@]}"
-
- ccm start -v
- ccm status
- ccm node1 nodetool status
-
- make test
-
- ccm remove
-}
-
-run_tests $1
diff --git a/main.go b/main.go
index 4e85b07..a587082 100644
--- a/main.go
+++ b/main.go
@@ -1,17 +1,17 @@
package main
import (
- "fmt"
- "github.com/jessevdk/go-flags"
- "github.com/relops/cqlc/generator"
"log"
"os"
+
+ "github.com/jessevdk/go-flags"
+ "github.com/relops/cqlc/generator"
)
var opts generator.Options
var parser = flags.NewParser(&opts, flags.Default)
-var VERSION string = "0.10.5"
+var Version string
func init() {
opts.Version = printVersionAndExit
@@ -23,7 +23,7 @@ func main() {
os.Exit(1)
}
- if err := generator.Generate(&opts, VERSION); err != nil {
+ if err := generator.Generate(&opts, Version); err != nil {
if err == generator.ErrInvalidOptions {
parser.WriteHelp(os.Stderr)
os.Exit(1)
@@ -34,6 +34,6 @@ func main() {
}
func printVersionAndExit() {
- fmt.Fprintf(os.Stderr, "%s %s\n", "cqlc", VERSION)
+ os.Stdout.Write([]byte(Version + "\n"))
os.Exit(0)
}
diff --git a/test/.fixtures/sensor/sensor.go b/test/.fixtures/sensor/sensor.go
index 3851c73..dc3fe99 100644
--- a/test/.fixtures/sensor/sensor.go
+++ b/test/.fixtures/sensor/sensor.go
@@ -29,8 +29,8 @@ func main() {
iter, err := ctx.Select().
From(EVENTS).
Where(
- EVENTS.SENSOR.Eq(sensorId),
- EVENTS.TIMESTAMP.Lt(gocql.TimeUUID())).
+ EVENTS.SENSOR.Eq(sensorId),
+ EVENTS.TIMESTAMP.Lt(gocql.TimeUUID())).
Fetch(session)
if err != nil {
diff --git a/test/schema_generator.go b/test/schema_generator.go
index b896941..52140d4 100644
--- a/test/schema_generator.go
+++ b/test/schema_generator.go
@@ -5,32 +5,11 @@ package main
import (
"bytes"
"fmt"
- log "github.com/cihub/seelog"
"io/ioutil"
+ "log"
"text/template"
)
-var logConfig = `
-
-
-
-
-
-
-
-`
-
-func init() {
- logger, err := log.LoggerFromConfigAsString(logConfig)
-
- if err != nil {
- fmt.Printf("Could not load seelog configuration: %s\n", err)
- return
- }
-
- log.ReplaceLogger(logger)
-}
-
type TypeInfo struct {
Pre string
Cql string
diff --git a/wait-on-c.sh b/wait-on-c.sh
new file mode 100755
index 0000000..b5d3cf3
--- /dev/null
+++ b/wait-on-c.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+echo "wait on cassandra"
+
+while ! nc -z localhost 9042; do
+ sleep 5
+done
+
+echo "cassandra started"