nopg
v1.4.0
Published
Shell scripting CLI for nopg
Downloads
39
Maintainers
Readme
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 -e
tr=''
function finish {
status="$?"
test -n "$tr" && nopg -b -q $tr rollback
exit "$status"
}
trap finish EXIT
tr="$(nopg -b -q start)"
nopg -b -q $tr search User
nopg -b -q $tr commit
tr=''
exit 0Transactions
Start a transaction:
tr = "$(nopg -b -q start)"End a transaction successfully:
nopg $tr commitRollback a transaction:
nopg $tr rollbackList all User documents
nopg $tr search UserList all User documents by email
nopg $tr search User --where-email='[email protected]'Create a User document
nopg $tr create User --set-email='[email protected]'Update a User document
nopg $tr update User --where-email='[email protected]' --set-email='[email protected]'Delete a User document by email
nopg $tr delete User --where-email='[email protected]'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