chore: re-add feature missing from merge

This commit is contained in:
Taranto 2021-10-01 13:46:10 +01:00 committed by Josh Harvey
parent 956b5bfca6
commit abbcda793b
8 changed files with 67 additions and 20 deletions

View file

@ -20,7 +20,8 @@ const stripDefaultDbFuncs = dbCtx => {
manyOrNone: dbCtx.$manyOrNone,
tx: dbCtx.$tx,
task: dbCtx.$task,
batch: dbCtx.batch
batch: dbCtx.batch,
multi: dbCtx.$multi
}
}
@ -67,6 +68,7 @@ const pgp = Pgp({
obj.$one = (query, variables) => obj.__taskEx(t => t.one(query, variables))
obj.$none = (query, variables) => obj.__taskEx(t => t.none(query, variables))
obj.$any = (query, variables) => obj.__taskEx(t => t.any(query, variables))
obj.$multi = (query, variables) => obj.__taskEx(t => t.multi(query, variables))
// when opts is not defined "cb" occupies the "opts" spot of the arguments
obj.$tx = (opts, cb) => typeof opts === 'function' ? _tx(obj, {}, opts) : _tx(obj, opts, cb)
obj.$task = (opts, cb) => typeof opts === 'function' ? _task(obj, {}, opts) : _task(obj, opts, cb)