-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * fix * rm commented-out code * extract to file * add comments * docs * fix * upd * test * upd * flutter_version * test * ? * blessrng * blessRNG * experiment * up * ultra bless * . * maybe closer * not bruh * please * <> * 777 * pls * ultra please * pls * hope * fix * fix
- Loading branch information
1 parent
4637546
commit 9ac090e
Showing
5 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// https://www.postgresql.org/docs/current/transaction-iso.html | ||
enum IsolationLevel { | ||
/// [postgresql/Transaction Isolation/Read Committed Isolation Level](https://www.postgresql.org/docs/current/transaction-iso.html#XACT-READ-COMMITTED) | ||
readCommitted, | ||
|
||
/// [postgresql/Transaction Isolation/Repeatable Read Isolation Level](https://www.postgresql.org/docs/current/transaction-iso.html#XACT-REPEATABLE-READ) | ||
repeatableRead, | ||
|
||
/// [postgresql/Transaction Isolation/Serializable Isolation Level](https://www.postgresql.org/docs/current/transaction-iso.html#XACT-SERIALIZABLE) | ||
serializable; | ||
|
||
/// Parses a string containing an [IsolationLevel] literal into its instance. | ||
static IsolationLevel parse(String string) => | ||
values.firstWhere((e) => e.name == string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'dart:js_interop'; | ||
import 'dart:js_util'; | ||
|
||
import 'package:deno_postgres_interop/src/isolation_level.dart'; | ||
|
||
/// [postgres@v0.17.0/TransactionOptions](https://deno.land/x/postgres@v0.17.0/mod.ts?s=TransactionOptions) | ||
@JS() | ||
class TransactionOptions { | ||
/// [postgres@v0.17.0/TransactionOptions/snapshot](https://deno.land/x/postgres@v0.17.0/mod.ts?s=TransactionOptions) | ||
external String? get snapshot; | ||
|
||
/// [postgres@v0.17.0/TransactionOptions/constructor](https://deno.land/x/postgres@v0.17.0/mod.ts?s=TransactionOptions) | ||
factory TransactionOptions({ | ||
IsolationLevel? isolationLevel, | ||
bool? isReadOnly, | ||
String? snapshot, | ||
}) => | ||
jsify({ | ||
if (isolationLevel != null) 'isolation_level': isolationLevel.name, | ||
if (isReadOnly != null) 'read_only': isReadOnly, | ||
if (snapshot != null) 'snapshot': snapshot, | ||
}) as TransactionOptions; | ||
} | ||
|
||
/// [postgres@v0.17.0/TransactionOptions](https://deno.land/x/postgres@v0.17.0/mod.ts?s=TransactionOptions) | ||
extension TransactionOptionsProps on TransactionOptions { | ||
/// [postgres@v0.17.0/TransactionOptions/isolation_level](https://deno.land/x/postgres@v0.17.0/mod.ts?s=TransactionOptions) | ||
IsolationLevel? get isolationLevel { | ||
final jsProperty = getProperty<String?>(this, 'isolation_level'); | ||
|
||
return jsProperty == null ? null : IsolationLevel.parse(jsProperty); | ||
} | ||
|
||
/// [postgres@v0.17.0/TransactionOptions/read_only](https://deno.land/x/postgres@v0.17.0/mod.ts?s=TransactionOptions) | ||
bool? get isReadOnly => getProperty(this, 'read_only'); | ||
} |