From 6670c1f55a8096fa4352886998c6639f6db55f09 Mon Sep 17 00:00:00 2001 From: Anton Nesterov Date: Thu, 15 Aug 2024 17:56:52 +0200 Subject: [PATCH] [fix] add tx method for client; [todo] add exec on client --- dal/Builder.ts | 8 ++++++-- dal/Protocol.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dal/Builder.ts b/dal/Builder.ts index 38eabca..0b30543 100644 --- a/dal/Builder.ts +++ b/dal/Builder.ts @@ -113,8 +113,8 @@ export default class Builder any> { this.methodCalls.set("Delete", []); return this; } - Insert(data: Record): Builder { - this.methodCalls.set("Insert", [data]); + Insert(...data: Record[]): Builder { + this.methodCalls.set("Insert", data); return this; } Set(data: Record): Builder { @@ -139,6 +139,10 @@ export default class Builder any> { this.methodCalls.set("DoNothing", []); return this; } + Tx(): Builder { + this.methodCalls.set("Tx", []); + return this; + } async *Rows>(): AsyncGenerator { this.formatRequest(); const response = await fetch(this.url, { diff --git a/dal/Protocol.ts b/dal/Protocol.ts index 81b39b8..069aef5 100644 --- a/dal/Protocol.ts +++ b/dal/Protocol.ts @@ -12,7 +12,7 @@ export interface Request { } export const METHODS = - "In|Find|Select|Fields|Join|Group|Sort|Limit|Offset|Delete|Insert|Set|Update|OnConflict|DoUpdate|DoNothing".split( + "In|Find|Select|Fields|Join|Group|Sort|Limit|Offset|Delete|Insert|Set|Update|OnConflict|DoUpdate|DoNothing|Tx".split( "|", );