Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Add replicaset support#18

Open
smoliji wants to merge 9 commits into
masterfrom
feat/replicasets
Open

Add replicaset support#18
smoliji wants to merge 9 commits into
masterfrom
feat/replicasets

Conversation

@smoliji
Copy link
Copy Markdown
Contributor

@smoliji smoliji commented Sep 16, 2020

@smoliji smoliji self-assigned this Sep 16, 2020
@smoliji smoliji requested a review from akrivohlavy September 16, 2020 07:34
Comment thread replicaset.js Outdated
Comment thread replicaset.js
Comment thread replicaset.js
};

exports.isWriteBuilder = (builder) => {
// Enable query context override: knex.select('*').queryContext({ replicaNode: 'write' | 'read' })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be passed via repostitory method options?

repo.detail({ id : 1 }, { queryContext: { replicaNode: 'write' } })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am afraid not, these options are passed to Bookshelf directly, but BS doesn't seem to pass these options directly below to Knex.

For now you can use:

repo.detail({ id : 1 }, { qb => qb.queryContext({ replicaNode: 'write' }) } )

Or I can make shortcut for the reposutory to set it via repository option queryContext as you suggested.

Comment thread replicaset.js Outdated
smoliji and others added 2 commits September 30, 2020 07:31
Co-authored-by: Antonín Křivohlavý <antonin.krivohlavy@ackee.cz>
Co-authored-by: Antonín Křivohlavý <antonin.krivohlavy@ackee.cz>
@garritfra
Copy link
Copy Markdown

@Tond4 @smoliji any update on this? We just encountered a situation where this feature would be really helpful. Can this be merged?

@smoliji
Copy link
Copy Markdown
Contributor Author

smoliji commented May 4, 2021

@vlasy you use this revision on one of your projects - is there anything blocking the merge and release?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants