Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support set map value by key and fix dependency #43

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

pingginp
Copy link

@pingginp pingginp commented Sep 18, 2018

This PR fixes #36 and #39 Since the repo has not been maintained for a while I changed the readme and test, if it's possible to get those things merged, I can create a cleaner PR with different readme.

Improvements

Dependencies

  • remove seelog, it is only used in generator cli, use standard log is enough
  • use pkg/errrors to preserve context in cqlc runtime
  • use logrus in cqlc runtime, could add a extra logger interface to allow using other library if really needed

Know issues

  • integration test no longer works because they generate file in /tmp and can't use gocql under /vendor and will fail assertion due to type mismatch

And @0x6e6562 if you no longer have the time to maintain it, is it possible to update the repo doc and point to a maintained fork, thx.

pingginp and others added 29 commits September 14, 2018 19:19
- the template would result in extra space
- #3
- not sure if I can run ccm locally
- when use /usr/local/bin got permission denied ...
- it should be using relops/cqlc, but default travis will be using
pingginp/cqlc, that's the problem of enable travis on fork
- it seems 3.11 is invalid for ccm
- generator generates files in /tmp for testing, so need global gocql in
$GOPATH to work ...
- generator was comparing type, and due to use vendor and global go
path, there will be type mismatch https://travis-ci.org/pingginp/cqlc/builds/428908553
- only support `col[?] = ?`, value binding should work, because there
was `WHERE foo in (?,?,?)` so in `Prepare` cqlc would flat the slice
before passing to gocql
- #2
- [ ] TODO: need to test against a real database to see if it works
- in port mapping, was using 904 instead of 9042 ...
- got "can not marshal []interface {} into map(varchar, varchar)"
- when insert, use SetStringStringMap
- when update, SetStringStringMapValue didn't work ... got gocql: expected 3 values send got 2
- BuildStatement is called by Exec, Prepare is called by Fetch,
previously flatten is only applied in Prepare
- previous implementation is wrong, it blindly expand all value slice,
which would break AppendSlice, now we use struct KeyValue as binding
value and expand based on CollectionType and CollectionOperationType
- string map worked fine, not sure about slice though ...
- I don't know if old integration test still work though ....
Reboot

- Fix #1 we are now using glide
- Fix #2 support set map by key, the generated interface `cqlc/columns.go` is updated, the runtime `BuildStatement` is updated to flatten the `KeyValue` struct to a slice of length 2
- Fix #3 use docker-compose to test locally and on CI, the e2e works because we don't allow parallel and go will run them serial in the order they are defined. Also if the schema is changed, the test need to be run twice and the first one will fail (same as latex bib index), the generated package can only be pick up next time
- Fix #5 we now use template in go code using long text
- Fix #6 need to set broadcast_address to 127.0.0.1 and avoid typo in port mapping
- in generated table definitions, was using log.Fatalf, that function
returns error, better just return errors.Errorf
[runtime] Use logrus and remove log.Fatal in generated table definition
@vidyavnv
Copy link

vidyavnv commented Jan 2, 2019

@pingginp I just incorporated Fix #36 and did make build. But nothing really happened and CQLC command is still not working. Is there any other command that I should run?

@ddave09
Copy link

ddave09 commented Jan 2, 2019

@pingginp I don't think Ben is maintaining this repo anymore. Last contribution from him on this repo is from 3 years ago. Seems like you have the latest code with all the fixes. If you're okay with it, users can work of your fork and we can maintain your fork as master until we get access to this repo.

@pingginp
Copy link
Author

pingginp commented Jan 9, 2019

@vidyavnv hi, are you trying to use cqlc command on cassandra 3? Now (even after my fix) it only works on cassandra 2, it is swallowing errors when generating code. I will spend some time to fix the cassandra 3 issue pingginp#7 . A work around is run a local cassandra 2 to create the same schema and generate the code, it works on cassandra 3.

@ddave09 I am maintaining my fork but I don't have plan to actively maintain it, I can make sure it works and fix bugs and release new tags (and go mod etc.), but I won't spend time on adding new features for it, I have to use it at work, that's the only reason I picked it up.

pingginp and others added 7 commits February 18, 2019 15:08
- `gocql.TypeText` was not mapped to string, so generated file is
invalid, could be in C*2 there is no Text in mapping ...
- support Cassandra 3
- remove logrus and use interface
@pingginp
Copy link
Author

pingginp commented Feb 18, 2019

just an update on this PR, after some fix, the fork now supports Cassandra 3 and works w/ go mod.

You can download the generator binary in release page and see the README for how to use the fork for runtime

pingginp and others added 7 commits February 18, 2019 16:36
- previous release didn't fix the generator entirely, columnTypes
mapping also need to be updated to support text #7
- previously only primary key and those with index support it
[runtime] Support if in delete statement #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

installation failed
3 participants