cqlc generates Go code from your Cassandra schema so that you can write type safe CQL statements in Go with a natural query syntax.

Cassandra

Go

cqlsh:test> select BAR from FOO 
        ... where BAZ = 'x';

 bar
-----
   1

(1 rows)
var FOO = FooTableDef()
var bar int

err := ctx.Select(FOO.BAR).
           From(FOO).
           Where(FOO.BAZ.Eq("x")).
           Bind(FOO.BAR.To(&bar)).
           FetchOne(session)

cqlc is a toolchain comprising a source code generator and a runtime library providing a fluent builder API.

cqlc provides a type safe layer on top of the underlying gocql Cassandra driver.

How it works

  1. Install the cqlc command line tool
  2. Point cqlc at your Cassandra schema and have it generate bindings for Go
  3. Use the generated Go code in your app source tree

Motivation