dmarkham / enumer

A Go tool to auto generate methods for your enums
Other
411 stars 63 forks source link

Add flag to support for CQL #31

Open gamorejon opened 4 years ago

gamorejon commented 4 years ago

Add support for CQL which is used by Cassandra, ScyllaDB, YugeByte, etc. Works similarly to json in that it adds Marshal and Unmarshal methods.

dmarkham commented 4 years ago

@gamorejon were you not happy with this code?

gamorejon commented 4 years ago

There was a bug in the generated code that I fixed, but it's all working now and we are using in production. Mostly, I was unsure if you were open to taking it because adding the extra flag to main seemed to tip your code coverage tool over the threshold. I'll re-open if you are.

dmarkham commented 4 years ago

When I look though the code, it looked just fine I was more concerned about the introduction of a 3rd party include github.com/gocql/gocql currently I think everything we use is internal, my luck the next person will want to add some other cql library! Really wish the UnmarshalCQL did not require gocql.TypeInfo :cry: I guess if you have it all working and your happy with it, open it up maybe I can take some time try to get the coverage figured out.

gamorejon commented 4 years ago

Will do. Yeah, the dependency is not ideal -- especially since we don't care about supporting non-string CQL types -- but if it makes you feel better gocql is a low-level package for CQL which all the other ORM-like packages depend on. It's unlikely to be displaced for at least for a few years and TypeInfo is an interface so things still work with any forks. The ScyllaDB guys (they are a Go shop, for everything except the core DB) maintain a fork of gocql for gocqlx which we use and there are no issues.

codecov-commenter commented 4 years ago

Codecov Report

Merging #31 into master will increase coverage by 0.00%. The diff coverage is 57.14%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #31   +/-   ##
=======================================
  Coverage   66.14%   66.15%           
=======================================
  Files           3        3           
  Lines         449      455    +6     
=======================================
+ Hits          297      301    +4     
- Misses        140      142    +2     
  Partials       12       12           
Impacted Files Coverage Δ
stringer.go 61.11% <40.00%> (-0.12%) :arrow_down:
enumer.go 100.00% <100.00%> (ø)
sql.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d46c853...008ac77. Read the comment docs.