Skip to content

Commit

Permalink
big upd
Browse files Browse the repository at this point in the history
  • Loading branch information
danylo-safonov-solid committed Sep 18, 2023
1 parent 4fbcdf4 commit abaf4c6
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
9 changes: 8 additions & 1 deletion lib/src/query_array_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@ import 'dart:js_interop';

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

/// [postgres@v0.17.0/QueryArrayResult](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryArrayResult).
@JS()
class QueryArrayResult<T> extends QueryResult {}
class QueryArrayResult<T extends List<dynamic>> extends QueryResult {
/// [postgres@v0.17.0/QueryArrayResult/rows](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryArrayResult#prop_rows).
external List<T> get rows;

/// [postgres@v0.17.0/QueryResult/constructor](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#ctor_0).
external factory QueryArrayResult(Query<ResultType> query);
}
4 changes: 2 additions & 2 deletions lib/src/query_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ extension QueryClientProps on QueryClient {
}

/// [postgres@v0.17.0/QueryClient/queryArray](https://deno.land/x/postgres@v0.17.0/mod.ts?s=QueryClient#method_queryArray_0).
Future<QueryArrayResult<T>> queryArray<T>(
Future<QueryArrayResult<T>> queryArray<T extends List<dynamic>>(
String query, [
QueryArguments? args,
]) =>
ClientCommon.queryArray(this, query, args);

/// [postgres@v0.17.0/QueryClient/queryArray](https://deno.land/x/postgres@v0.17.0/mod.ts?s=QueryClient#method_queryArray_1).
Future<QueryArrayResult<T>> queryArrayWithOptions<T>(
Future<QueryArrayResult<T>> queryArrayWithOptions<T extends List<dynamic>>(
QueryObjectOptions config,
) =>
ClientCommon.queryArrayWithOptions(this, config);
Expand Down
3 changes: 3 additions & 0 deletions lib/src/query_object_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import 'package:deno_postgres_interop/src/query_result.dart';
class QueryObjectResult<T> extends QueryResult {
/// [postgres@v0.17.0/QueryObjectResult/columns](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryObjectResult#prop_columns).
external List<String>? get columns;

/// [postgres@v0.17.0/QueryResult/constructor](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#ctor_0).
external factory QueryObjectResult(Query<ResultType> query);
}

/// [postgres@v0.17.0/QueryObjectResult](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryObjectResult).
Expand Down
45 changes: 44 additions & 1 deletion lib/src/query_result.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
import 'dart:js_interop';
import 'dart:js_util';

@JS()
class QueryResult {}

/// [postgres@v0.17.0/QueryResult](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult)
class QueryResult {
/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#prop_command
external CommandType get command;

/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#prop_rowCount
external int? get rowCount;

/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#accessor_rowDescription
external RowDescription? get rowDescription;

/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#prop_warnings
external List<Notice> get warnings;

/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#ctor_0
external factory QueryResult(Query<ResultType> query);

/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#method_handleCommandComplete_0
external void handleCommandComplete(String commandTag);

/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#method_loadColumnDescriptions_0
external void loadColumnDescriptions(RowDescription description);
}

extension QueryResultProps on QueryResult {

Check notice on line 30 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.
/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=QueryResult#method_insertRow_0
void insertRow(List<Uint8Array> row) => callMethod(this, 'insertRow', [row]);
}

// TODO:

class Uint8Array {}

Check notice on line 37 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.

class Notice {}

Check notice on line 39 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.

class CommandType {}

Check notice on line 41 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.

class Query<T> {}

Check notice on line 43 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.

class ResultType {}

Check notice on line 45 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.

class RowDescription {}

Check notice on line 47 in lib/src/query_result.dart

View workflow job for this annotation

GitHub Actions / build

Missing documentation for a public member.

Try adding documentation for the member. See https://dart-lang.github.io/linter/lints/public_member_api_docs.html to learn more about this problem.
4 changes: 2 additions & 2 deletions lib/src/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ extension TransactionProps on Transaction {
Future<void> commit() => callFutureMethod(this, 'commit');

/// [postgres@v0.17.0/Transaction/queryArray](https://deno.land/x/postgres@v0.17.0/mod.ts?s=Transaction#method_queryArray_0).
Future<QueryArrayResult<T>> queryArray<T>(
Future<QueryArrayResult<T>> queryArray<T extends List<dynamic>>(
String query, [
QueryArguments? args,
]) =>
ClientCommon.queryArray(this, query, args);

/// [postgres@v0.17.0/Transaction/queryArray](https://deno.land/x/postgres@v0.17.0/mod.ts?s=Transaction#method_queryArray_1).
Future<QueryArrayResult<T>> queryArrayWithOptions<T>(
Future<QueryArrayResult<T>> queryArrayWithOptions<T extends List<dynamic>>(
QueryObjectOptions config,
) =>
ClientCommon.queryArrayWithOptions(this, config);
Expand Down

0 comments on commit abaf4c6

Please sign in to comment.