This repository has been archived by the owner on Mar 4, 2019. It is now read-only.
Connection wrapper - e.g. to allow row level security #295
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #291
Rebased upon #297; to see just the changes in this (and not the refactoring): benjie/massive-js@refactor-index...connection-wrapper
The aim of this PR is to enable a new
newDb = db.withConnectionWrapper(fn)
API that allows users to do interesting things by creating a fast clone of the massive instance, but wherein each query is wrapped with custom functionality.The functionality could be, for example:
SET LOCAL TIME ZONE 'Europe/London'
before some queries andSET LOCAL TIME ZONE 'America/New_York'
on othersbegin; ... rollback;
This PR is a proof-of-concept; I think it's safe to merge but we probably ought to add more tests before documenting it as a public API!
To achieve the goal of a connection wrapper, this PR does the following things:
connect
changes from Refactor index.js to allow multiple connections, async startup, cleaner bootstrapping #297 to allow spawning a new instance of massive with all connections wrapped by a wrapper function without the need to re-scan the database/filesystem