[go: up one dir, main page]

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

Feature - Multiple Database Connnection #61

Closed

Conversation

dkiswanto
Copy link
Contributor

todo:

  • update readme
  • add an example for multiple connections

@@ -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
Copy link
Contributor Author

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a good idea

Copy link
Contributor Author
@dkiswanto dkiswanto left a 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
Copy link
Owner

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)
Copy link
Owner

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.

@dkiswanto dkiswanto closed this Feb 13, 2020
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.

2 participants