Comparing version 1.0.1 to 1.1.0
11
index.js
@@ -1,2 +0,2 @@ | ||
function CafeQueryError(message) { | ||
function CafeQueryError(message, code) { | ||
this.name = 'CafeQueryError' | ||
@@ -9,2 +9,11 @@ this.message = message | ||
return { | ||
expectNone: async (query, ...values) => { | ||
const [rows] = await dataSource.query(query, values) | ||
if (!rows) { | ||
throw new CafeQueryError('Expected no results, got falsy value') | ||
} | ||
if (rows.length !== 0) { | ||
throw new CafeQueryError('Expected no results, got length: ' + rows.length) | ||
} | ||
}, | ||
findOne: async (query, ...values) => { | ||
@@ -11,0 +20,0 @@ const [rows] = await dataSource.query(query, values) |
{ | ||
"name": "cafe-query", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
1962
4
52