Chore: make db.taskEx private

This commit is contained in:
csrapr 2021-06-08 23:17:56 +01:00 committed by Josh Harvey
parent 081957c957
commit 64e07fa8bd
2 changed files with 10 additions and 10 deletions

View file

@ -31,7 +31,7 @@ const stripDefaultDbFuncs = dbCtx => {
const any = (obj, query, variables) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.any(query, variables).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -43,7 +43,7 @@ const any = (obj, query, variables) => {
const none = (obj, query, variables) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.none(query, variables).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -55,7 +55,7 @@ const none = (obj, query, variables) => {
const one = (obj, query, variables) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.one(query, variables).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -67,7 +67,7 @@ const one = (obj, query, variables) => {
const oneOrNone = (obj, query, variables) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.oneOrNone(query, variables).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -79,7 +79,7 @@ const oneOrNone = (obj, query, variables) => {
const manyOrNone = (obj, query, variables) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.manyOrNone(query, variables).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -91,7 +91,7 @@ const manyOrNone = (obj, query, variables) => {
const many = (obj, query, variables) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.many(query, variables).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -103,7 +103,7 @@ const many = (obj, query, variables) => {
const result = (obj, query, variables, cb, thisArg) => {
const schema = getSchema()
if (!schema) throw new Error(schemaNotFound(query))
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.result(query, variables, cb, thisArg).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res
@ -118,7 +118,7 @@ const query = (obj, query, variables, qrm, throwOnError) => {
if (throwOnError) throw new Error(schemaNotFound(query))
return Promise.resolve(schemaNotFound(query))
}
return obj.taskEx({ schema }, t => {
return obj._taskEx({ schema }, t => {
return t.query(query, variables, qrm).then(res => {
return t.none('set search_path to $1~', [getDefaultSchema()]).then(() => {
return res