-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add WithSession helper for Cassandra driver #30
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
Conversation
Also changes method receivers names for the Cassandra struct to "c" since "p" makes no sense in this context.
database/cassandra/cassandra.go
Outdated
} | ||
|
||
func (p *Cassandra) Open(url string) (database.Driver, error) { | ||
func WithSession(session *gocql.Session, config *Config) (database.Driver, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency with all the other drivers, shouldn't the name remain as WithInstance
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, use the name WithInstance
for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're renaming the receiver variable, could you also replace dbLocked
with c.isLocked
? I think this might be causing the races we're seeing in the tests.
database/cassandra/cassandra.go
Outdated
} | ||
|
||
func (p *Cassandra) Open(url string) (database.Driver, error) { | ||
func WithSession(session *gocql.Session, config *Config) (database.Driver, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, use the name WithInstance
for consistency
@dhui Added both requests. Travis still seems to be failing. I am unsure how these changes are affecting the tests, since (at least before the lock change) it's just a variable name change and a completely new function. |
Yeah, I don't think your changes are related to the failing tests. Thanks for the PR! I'll merge in your changes, but if you wanna use them, use the master branch as the failing tests are release blockers. |
Closes #11.
Also tweaks the method receivers to match the struct name.