Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
danylo-safonov-solid committed Sep 21, 2023
1 parent 0047c9b commit d947da8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ The main scenario is Supabase Edge Functions, but it should also work for other

- Transaction
- [ ] constructor
- [ ] rollback
- [ ] `(options: { savepoint?: string | Savepoint; })`
- [ ] `(options: { chain?: boolean; })`

- errors:
- [ ] TransactionError
Expand Down
19 changes: 13 additions & 6 deletions lib/src/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,29 @@ extension TransactionProps on Transaction {
ClientCommon.queryArrayWithOptions(this, config);

/// [[email protected]/Transaction/rollback](https://deno.land/x/[email protected]/mod.ts?s=Transaction#method_rollback_0).
Future<void> rollback(Savepoint? savepoint) => callFutureMethod(
Future<void> rollback([Savepoint? savepoint]) => callFutureMethod(
this,
'rollback',
[if (savepoint != null) savepoint],
);

// TODO:
// rollback(options?: { savepoint?: string | Savepoint; }): Promise<void>
// [[email protected]/Transaction/rollback](https://deno.land/x/[email protected]/mod.ts?s=Transaction#method_rollback_1).
// this has the same functionality as [rollback] and [rollbackByName]
// so it won't be implemented.

/// [[email protected]/Transaction/rollback](https://deno.land/x/[email protected]/mod.ts?s=Transaction#method_rollback_2).
Future<void> rollbackWithChain() => callFutureMethod(
this,
'rollback',
[
jsify({'chain': true}),
],
);

/// [[email protected]/Transaction/rollback](https://deno.land/x/[email protected]/mod.ts?s=Transaction#method_rollback_0).
Future<void> rollbackByName(String savepoint) =>
callFutureMethod(this, 'rollback', [savepoint]);

// TODO:
// rollback(options?: { chain?: boolean; }): Promise<void>

/// [[email protected]/Transaction/savepoint](https://deno.land/x/[email protected]/mod.ts?s=Transaction#method_savepoint_0).
Future<Savepoint> createSavepoint(String name) =>
callFutureMethod(this, 'savepoint', [name]);
Expand Down

0 comments on commit d947da8

Please sign in to comment.