Giter Site home page Giter Site logo

cqlc's People

Contributors

0x6e6562 avatar aackerman avatar gitter-badger avatar nsd20463 avatar philipsoutham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cqlc's Issues

Struct tags for json/cql marshalling/unmarshalling

First off thanks to all developers for making this library. It is really useful. I would request you to generate struct tags for easier json or gocql conversion/usage.

Before using cqlc I used my own structs like the following:

type user struct {
    Username string `json:"username" cql:"username"`
}

This would be very helpful for using mentioned libraries.

Store() method should not accept counter table at compile time

Right now, both the Store() and Add() methods accept a cqlc.TableBinding as an argument. If you pass a TableBinding instance for a counter table to the Store() method, there is no compile time check. Instead, you get the following run time error from Cassandra:

INSERT statement are not allowed on counter tables, use UPDATE instead

"ORDER BY" clause in schema breaks code generation

Unmapped data type: org.apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.TimeUUIDType)
Unmapped data type: org.apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.TimeUUIDType)
2014/03/25 22:33:32 61:55: expected type, found ')' (and 3 more errors)
make: *** [generated_schema.go] Error 1

Secondary index on composite partition key breaks code generation

I'm not too sure how practical this example is, but the following construct will break the code generator:

create table t (
   x int,
   y int,
   z int,
   primary key ((x,y),z)
);

create index t_by_y on t(y)
generated_schema.go:17490: (*TYColumn).Eq redeclared in this block
    previous declaration at generated_schema.go:17484

frozen collections inside collections generate error

steps to reproduce:

CREATE TYPE testtype (
    name text,
);

CREATE TABLE testtable (
    id int,
    connections map<text,frozen<testtype>>,
    PRIMARY KEY (id)
);

cqlc run results in: expected type, found ')' (and 5 more errors)

Build the cqlc library

@0x6e6562 I had to change the gocql library that is being used inside cqlc to our internal gocql library. How exactly should I rebuild cqlc to make this change?

Using Protocol 4

I'm trying to generate the code in command line however I get the following error:

2016/07/05 15:24:33 gocql: unable to dial control conn 127.0.0.1:9042: gocql: error on stream 0: Invalid or unsupported protocol version (2); the lowest supported version is 3 and the greatest is 4
2016/07/05 15:24:33 Connect error%!(EXTRA *errors.errorString=gocql: unable to create session: control: unable to connect to initial hosts: gocql: error on stream 0: Invalid or unsupported protocol version (2); the lowest supported version is 3 and the greatest is 4)

I'm using Cassandra 3.0.7 on Docker, gocql is able to connect just fine if I switch to Protocol 4, however I don't see any parameter for cqlc to change Protocol in command line

"blob" data type is not supported

Schemas that use "blob" data type fail:

Unmapped data type: org.apache.cassandra.db.marshal.BytesType
2014/02/05 15:13:31 3:14: expected ';', found '/'

(the second error is a gofmt error)

Does cqlc support Extending a Map?

I can see there is a function to SetStringStringMap . This method Sets the entite map but doesn't update the existing map. Is there any function that I can use to update the existing map?

panic: runtime error: invalid memory address or nil pointer dereference (render.go)

I'm seeing occasional nil pointer dereferences in render.go (line 81) that causes my entire webapp to crash:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x30 pc=0x708767]

goroutine 4573 [running]:
github.com/relops/cqlc/cqlc.renderInsert(0xc208083ce0, 0xc210e55ab0)
/home/ubuntu/go/src/github.com/relops/cqlc/cqlc/render.go:81 +0x77
github.com/relops/cqlc/cqlc.(_Context).RenderCQL(0xc208083ce0, 0x0, 0x0, 0x0, 0x0)
/home/ubuntu/go/src/github.com/relops/cqlc/cqlc/cqlc.go:570 +0x1c1
github.com/relops/cqlc/cqlc.BuildStatement(0xc208083ce0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/ubuntu/go/src/github.com/relops/cqlc/cqlc/cqlc.go:525 +0x8a
github.com/relops/cqlc/cqlc.(_Context).Exec(0xc208083ce0, 0xc208094160, 0x0, 0x0)
/home/ubuntu/go/src/github.com/relops/cqlc/cqlc/cqlc.go:464 +0x43

Compilation failure with new gocql driver

github.com/relops/cqlc/generator

../gocode/src/github.com/relops/cqlc/generator/template.go:50: undefined: gocql.CLUSTERING_KEY
../gocode/src/github.com/relops/cqlc/generator/template.go:54: undefined: gocql.PARTITION_KEY
../gocode/src/github.com/relops/cqlc/generator/template.go:59: undefined: gocql.PARTITION_KEY
../gocode/src/github.com/relops/cqlc/generator/template.go:62: undefined: gocql.CLUSTERING_KEY
../gocode/src/github.com/relops/cqlc/generator/template.go:85: undefined: gocql.CLUSTERING_KEY
../gocode/src/github.com/relops/cqlc/generator/template.go:91: undefined: gocql.PARTITION_KEY

installation failed

command go get github.com/relops/cqlc failed with the following output :

$GOPATH/github.com/relops/cqlc/generator/template.go:50: undefined: gocql.CLUSTERING_KEY
$GOPATH/github.com/relops/cqlc/generator/template.go:54: undefined: gocql.PARTITION_KEY
$GOPATH/github.com/relops/cqlc/generator/template.go:59: undefined: gocql.PARTITION_KEY
$GOPATH/github.com/relops/cqlc/generator/template.go:62: undefined: gocql.CLUSTERING_KEY
$GOPATH/github.com/relops/cqlc/generator/template.go:85: undefined: gocql.CLUSTERING_KEY
$GOPATH/github.com/relops/cqlc/generator/template.go:91: undefined: gocql.PARTITION_KEY

Same for command go build. Any clue ?
Thanks

Result set binding callbacks have no way to error out

If an error occurs within the implementation of the a result set callback, there is no clean way to propagate this error to the invoking loop. Maybe the callback should return false if should not continue? But we still need to pass the error back up to the caller.

Missing definition: cqlc.EqualityStringStringMapColumn

A similar issue was posted, though this is based on using map keys as an index.

create table t (
   x int,
   y int,
   z map<varchar,varchar>,
   primary key (x,y)
);
CREATE INDEX ON t (KEYS(z));

It should generate methods for the EqualityStringStringMapColumn interface, which doesn't appear to exist.

CQLC: Go Cassandra query returning page token for boundary limit?

In my Cassandra database for a particular query, I have 8 records, and I am using relops/cqlc library to query.

When I query with limit = 8, it returns 8 records with a PageState which is to be used as page token for the next set of results. First of all, I don't think it should have returned that PageState. And also as expected when I query again with that page_token and the same query parameters, it returns no data.

This is a representative of the way I am using to query

query, err := cx.Select().From(db.MY_TABLE).Where(db.MY_TABLE.NAME.Eq(name), db.MY_TABLE.EV_START.Ge(begin), db.MY_TABLE.EV_START.Lt(end)).Prepare(cass)
query.PageSize(8)
iter := query.Iter()
data, err = db.BindMyTable(iter)

err = iter.Close()
next_page_token = iter.PageState()

*cass is a gocql.Session

Why is it returning a value for the next_page_token?

The same thing does not happen if I increase the limit by one more, say 9.

Did someone else face a similar issue? Any hints as to what might be the issue?

Add From() binding for UPSERTs

e72de39 added the Apply(...ColumnBindings) for generating UPSERTs using ColumnBindings. This is probably messy, since you need to use the To() method to create the binding, which accepts a destination pointer. Whilst this works, I think it would be clearer to offer an explicit non-pointer method such as From(). If we were to do this, we'd probably need to create a specialized type of ColumnBinding to avoid overloading the legal arguments for To() and From().

connection reset error

I'm using generated bindings from cqlc and pass session object for queries. This works fine but after a while, on query, returns "connection reset error" while while session.Closed api returns false.
sample query with error message is below:

	present, e := ctx.Select().From(FOOTABLE).Where(
		FOOTABLE.TENANT.Eq(tenant), FOOTABLE.NS.Eq(ns)).Into(FOOTABLE.To(&foo)).
		FetchOne(session)

read tcp 10.160.105.22:34614->10.146.86.33:9042: read: connection reset by peer

My understanding is session object should re-establish session upon failure but in this case probably it is not able to detect connection reset ? Any pointers on handling this scenario. thanks..

Unable to install with `go get`

This tool looks great and I would love to use it. When I try install it I get compilation errors. I'm not sure if I'm doing something wrong or what. In this example I made a new empty $GOPATH to be sure there was not some weird dependency issue.

~ ᐳ rm -rf tmp
~ ᐳ mkdir tmp
~ ᐳ export GOPATH=$PWD/tmp
~ ᐳ cd $GOPATH
~/tmp ᐳ ls
~/tmp ᐳ go get github.com/relops/cqlc
# github.com/relops/cqlc/generator
src/github.com/relops/cqlc/generator/generator.go:165: t.Type undefined (type *gocql.TypeInfo has no field or method Type)
src/github.com/relops/cqlc/generator/generator.go:175: invalid case gocql.TypeList in switch on t.Type (mismatched types int and func() gocql.Type)
src/github.com/relops/cqlc/generator/generator.go:175: invalid case gocql.TypeSet in switch on t.Type (mismatched types int and func() gocql.Type)
src/github.com/relops/cqlc/generator/generator.go:176: t.Elem undefined (type gocql.TypeInfo has no field or method Elem)
src/github.com/relops/cqlc/generator/generator.go:177: invalid case gocql.TypeMap in switch on t.Type (mismatched types int and func() gocql.Type)
src/github.com/relops/cqlc/generator/generator.go:178: t.Key undefined (type gocql.TypeInfo has no field or method Key)
src/github.com/relops/cqlc/generator/generator.go:179: t.Elem undefined (type gocql.TypeInfo has no field or method Elem)
src/github.com/relops/cqlc/generator/template.go:46: invalid operation: c.Type.Type == gocql.TypeCounter (mismatched types func() gocql.Type and int)
src/github.com/relops/cqlc/generator/template.go:71: invalid operation: c.Type.Type == gocql.TypeList (mismatched types func() gocql.Type and int)
src/github.com/relops/cqlc/generator/template.go:71: invalid operation: c.Type.Type == gocql.TypeSet (mismatched types func() gocql.Type and int)
src/github.com/relops/cqlc/generator/template.go:71: too many errors

Do you have any advice?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.