This a fork of relops/cqlc the upstream is no longer maintained.
# 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
You need to change the repo path in glide.yaml
to use this fork
- 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
replace github.com/relops/cqlc => github.com/pingginp/cqlc v0.12.0
- clone the repo to
$GOPATH/src/github.com/relops/cqlc
# 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 is the runtime, a query builder, don't get mislead by the column_generator.go it is mainly for generating runtime code that ships with the library
- generator generates table and column definition based on schema, NOTE: it now supports Cassandra 3
The main modification to the runtime are listed below
- support update map value by key, previously, cqlc can only update entire map. (This change only requires update runtime)
- support
IF
inDELETE
#13
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
- allow
Eq
on all columns to supportIF
inDELETE
The overall generator logic is
- get table meta using gocql
- render the template defined in
tmpl.go
using template helper methods defined intemplate.go
valueType
is returning empty value fortext
, just add a new mapping inliteralTypes
fixed this #7