Skip to content

Commit

Permalink
extract to file
Browse files Browse the repository at this point in the history
  • Loading branch information
danylo-safonov-solid committed Sep 13, 2023
1 parent 6320938 commit a84b790
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/deno_postgres_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
library;

export 'src/client.dart';
export 'src/isolation_level.dart';
export 'src/query_client.dart';
export 'src/query_object_result.dart';
export 'src/transaction.dart';
Expand Down
8 changes: 8 additions & 0 deletions lib/src/isolation_level.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enum IsolationLevel {
readCommited,
repeatableRead,
serializable;

static IsolationLevel parse(String string) =>
values.firstWhere((e) => e.name == string);
}
12 changes: 3 additions & 9 deletions lib/src/transaction_options.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'dart:js_interop';
import 'dart:js_util';

import 'package:deno_postgres_interop/src/isolation_level.dart';

/// [[email protected]/TransactionOptions](https://deno.land/x/[email protected]/mod.ts?s=TransactionOptions)
@JS()
class TransactionOptions {
Expand All @@ -20,6 +22,7 @@ class TransactionOptions {
}) as TransactionOptions;
}

/// [[email protected]/TransactionOptions](https://deno.land/x/[email protected]/mod.ts?s=TransactionOptions)
extension TransactionOptionsProps on TransactionOptions {
IsolationLevel? get isolationLevel {
final jsProperty = getProperty<String?>(this, 'isolation_level');
Expand All @@ -29,12 +32,3 @@ extension TransactionOptionsProps on TransactionOptions {

bool? get isReadOnly => getProperty(this, 'read_only');
}

enum IsolationLevel {
readCommited,
repeatableRead,
serializable;

static IsolationLevel parse(String string) =>
values.firstWhere((e) => e.name == string);
}

0 comments on commit a84b790

Please sign in to comment.