pingginp / cqlc Goto Github PK
View Code? Open in Web Editor NEWThis project forked from relops/cqlc
A fork of relops/cqlc that compiles and supports Cassandra 3
License: Other
This project forked from relops/cqlc
A fork of relops/cqlc that compiles and supports Cassandra 3
License: Other
In code generated from schema, in some switch statement log.Fatal
is used, should just return error
func Map{{$StructType}}(iter *gocql.Iter, callback func(t {{$StructType}}) (bool, error)) error {
columns := iter.Columns()
row := make([]interface{}, len(columns))
for {
t := {{$StructType}}{}
for i := 0; i < len(columns); i++ {
switch columns[i].Name {
{{range $_, $col := $cf.Columns}}
case "{{$col.Name}}": row[i] = &t.{{snakeToCamel $col.Name}}
{{end}}
default:
log.Fatal("unhandled column: ", columns[i].Name)
}
}
}
Got error when formatting, it silents all the error when inspect type .... C*2 does work
User should not be forced to use logrus for using the cqlc runtime, there are two ways
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlDelete.html
DELETE FROM cycling.cyclist_name
WHERE id =e7ae5cf3-d358-4d99-b900-85902fda9bb0
if firstname='Alex' and lastname='Smith';
Since the upstream has stopped for 3 years and I still have to use it ... just open issue directly in my fork.
Need to lock the version of dependencies, might just use glide ...
Expected nil, but got: &errors.errorString{s:"gocql: unable to create session: unable to discover protocol version: EOF"}
Just write a go file to define the template .... no need to use bindata to ship some small text with binary ....
bindata: generator/binding_tmpl.go
input: test/.fixtures/collections/input.go test/collections.cql
generator/binding_tmpl.go: generator/tmpl/binding.tmpl
go-bindata -pkg=generator -o=generator/binding_tmpl.go generator/tmpl
Follow on relops#39
AppendSlice is the base point to follow
const (
NoCollectionType CollectionType = iota
ListType
SetType
MapType
)
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)
}
func prependList(c *Context, col ListColumn, values interface{}) {
b := ColumnBinding{Column: col, Value: values, Incremental: true, CollectionType: ListType, CollectionOperationType: Prepend}
c.Bindings = append(c.Bindings, b)
}
func removeList(c *Context, col ListColumn, values interface{}) {
b := ColumnBinding{Column: col, Value: values, Incremental: true, CollectionType: ListType, CollectionOperationType: RemoveByValue}
c.Bindings = append(c.Bindings, b)
}
func renderUpdate(ctx *Context, buf *bytes.Buffer, counterTable bool) {
// ....
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)
}
default:
setFragments[i] = fmt.Sprintf("%s = ?", col)
}
}
It was using https://github.com/riptano/ccm to setup local cassandra cluster .... might switch to using docker, which could be cleaner (though there might be issue setting Cassandra user name and password, the official docker image didn't include that ...)
Now it is using glide, should be easy to switch to since it's still v1 and don't have the v2 import path problem
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.