-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Feature - Multiple Database Connnection #61
Feature - Multiple Database Connnection #61
Conversation
@@ -57,7 +57,17 @@ func (adapter *Adapter) Insert(query grimoire.Query, changes map[string]interfac | |||
ID int64 | |||
} | |||
|
|||
_, err := adapter.Query(&result, statement, args, loggers...) | |||
// use query to get insert ids for postgres |
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.
should we wrap this as a new function??
coz it has identical statements in InsertAll
below.
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.
maybe a good idea
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.
will fix the ci later after the design pattern is reviewed
@@ -57,7 +57,17 @@ func (adapter *Adapter) Insert(query grimoire.Query, changes map[string]interfac | |||
ID int64 | |||
} | |||
|
|||
_, err := adapter.Query(&result, statement, args, loggers...) | |||
// use query to get insert ids for postgres |
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.
maybe a good idea
|
||
// NewConnection for sql database | ||
func NewConnection(driver, dsns string) (*Connection, error) { | ||
db, err := nap.Open(driver, dsns) |
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.
maybe we can detect wether nap is required or not here by checking the dsn pattern.
if it's not using a master-slave configuration, I think we can just use standard sql.DB instance to avoid unnecessary complexity.
todo: