rado 0.1.54 → 0.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -115,7 +115,7 @@ var SyncDriver = class extends DriverBase {
115
115
  const res = stmt.all(params).map((row) => JSON.parse(row.result).result);
116
116
  if (query.singleResult) {
117
117
  const row = res[0];
118
- if (query.validate && !row)
118
+ if (query.validate && row === void 0)
119
119
  throw new Error("No row found");
120
120
  return row;
121
121
  }
@@ -223,7 +223,7 @@ var AsyncDriver = class extends DriverBase {
223
223
  );
224
224
  if (query.singleResult) {
225
225
  const row = res[0];
226
- if (query.validate && !row)
226
+ if (query.validate && row === void 0)
227
227
  throw new Error("No row found");
228
228
  return row;
229
229
  }
@@ -118,13 +118,11 @@ var Formatter = class {
118
118
  stmt.add("UPDATE").addIdentifier(query.table.name).add("SET").space();
119
119
  for (const key of stmt.separate(Object.keys(data))) {
120
120
  stmt.identifier(key).add("=").space();
121
- this.formatExpr(
122
- {
123
- ...ctx,
124
- formatAsJson: true
125
- },
126
- ExprData.create(data[key])
127
- );
121
+ const value = data[key];
122
+ if (value instanceof Expr)
123
+ this.formatExprJson(ctx, ExprData.create(data[key]));
124
+ else
125
+ this.formatValue({ ...ctx, formatAsJson: true }, value);
128
126
  }
129
127
  this.formatWhere(ctx, query.where);
130
128
  this.formatLimit(ctx, query);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rado",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",