nor-nopg-cli
Shell scripting CLI for nor-nopg
Install
npm install -g nopg
Status
Not well tested, but should work.
Example
#!/bin/bash set -etr=''trap finish EXITtr="$(nopg -b -q start)" nopg -b -q $tr search Usernopg -b -q $tr committr=''exit 0
Transactions
Start a transaction:
tr = "$(nopg -b -q start)"
End a transaction successfully:
nopg $tr commit
Rollback a transaction:
nopg $tr rollback
User
documents
List all nopg $tr search User
User
documents by email
List all nopg $tr search User --where-email='demo@example.com'
User
document
Create a nopg $tr create User --set-email='demo@example.com'
User
document
Update a nopg $tr update User --where-email='demo@example.com' --set-email='demo2@example.com'
User
document by email
Delete a nopg $tr delete User --where-email='demo@example.com'
Force shutdown
You shouldn't normally need to use this, since rollback
or commit
does it also.
nopg $tr exit
...or, since $tr
is just a pid:
kill $tr