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 162e09f commit 4973815
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 48 additions & 1 deletion lib/src/connection.dart
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
class Connection {}
import 'dart:js_interop';
import 'dart:js_util';

import 'package:deno_postgres_interop/src/client_configuration.dart';
import 'package:deno_postgres_interop/src/promise.dart';
import 'package:deno_postgres_interop/src/transport.dart';
import 'package:deno_postgres_interop/src/util.dart';

/// [[email protected]/Connection](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection).
@JS()
class Connection {
/// [[email protected]/Connection/connected](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#accessor_pid).
external int get pid;

/// [[email protected]/Connection/constructor](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#ctor_0).
factory Connection({
required ClientConfiguration connectionParams,
required Future<void> Function() disconnectionCallback,
}) =>
callConstructor(
'Connection',
[connectionParams, () => futureToPromise(disconnectionCallback())],
);
}

/// [[email protected]/Connection](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection).
extension ConnectionProps on Connection {
/// [[email protected]/Connection/connected](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#prop_connected).
bool get isConnected => getProperty(this, 'connected');

/// [[email protected]/Connection/tls](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#accessor_tls).
bool get isCarriedOverTLS => getProperty(this, 'tls');

/// [[email protected]/Connection/transport](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#accessor_transport).
Transport get transport => Transport.parse(getProperty(this, 'transport'));

/// [[email protected]/Connection/end](https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#method_end_0).
Future<void> end() => callFutureMethod(this, 'end');

// https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#method_query_0
// query(query: Query<ResultType.ARRAY>): Promise<QueryArrayResult>

// https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#method_query_1
// query(query: Query<ResultType.OBJECT>): Promise<QueryObjectResult>

// https://deno.land/x/[email protected]/connection/connection.ts?s=Connection#method_startup_0
// startup(is_reconnection: boolean)
}
2 changes: 2 additions & 0 deletions lib/src/pool.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:js_interop';
import 'dart:js_util';

import 'package:deno_postgres_interop/src/client_options.dart';
Expand All @@ -6,6 +7,7 @@ import 'package:deno_postgres_interop/src/undefined.dart';
import 'package:deno_postgres_interop/src/util.dart';

/// [[email protected]/Pool](https://deno.land/x/[email protected]/mod.ts?s=Pool).
@JS()
class Pool {
/// [[email protected]/Pool/constructor](https://deno.land/x/[email protected]/mod.ts?s=Pool#ctor_0).
factory Pool({
Expand Down

0 comments on commit 4973815

Please sign in to comment.