cqlc generates Go code from your Cassandra schema so that you can write type safe CQL statements in Go with a natural query syntax.
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
- Install the
cqlccommand line tool
cqlcat your Cassandra schema and have it generate bindings for Go
- Use the generated Go code in your app source tree
- Ensure your code is in sync with your schema
- Compile time checks for CQL statement placeholders to avoid mismatched bind parameters that ordinarily are only detected at runtime
- Leverage the speed of the Go compiler
- Reduce boilerplate code when binding query results
- Improve the factoring of your code using composeable CQL binding code
- Avoid marshalling errors by using type safe bindings
- Keep your code compliant with Cassandra partitioning and clustering key constraints
- Make sure your application is consistent with any secondary indexes applied to the schema
- Increase developer productivity when working with