Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors #18

Merged
merged 171 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
23562f5
wip
danylo-safonov-solid Sep 13, 2023
bd265f7
fix
danylo-safonov-solid Sep 13, 2023
6320938
rm commented-out code
danylo-safonov-solid Sep 13, 2023
a84b790
extract to file
danylo-safonov-solid Sep 13, 2023
94c408f
add comments
danylo-safonov-solid Sep 13, 2023
2a319c2
docs
danylo-safonov-solid Sep 13, 2023
24155e4
fix
danylo-safonov-solid Sep 13, 2023
0f3d68b
upd
danylo-safonov-solid Sep 13, 2023
7b4d2fa
test
danylo-safonov-solid Sep 13, 2023
a28b5c5
upd
danylo-safonov-solid Sep 13, 2023
ecdc8d0
flutter_version
danylo-safonov-solid Sep 13, 2023
df9edb4
test
danylo-safonov-solid Sep 13, 2023
e509352
?
danylo-safonov-solid Sep 13, 2023
d163aea
blessrng
danylo-safonov-solid Sep 13, 2023
e117e55
blessRNG
danylo-safonov-solid Sep 13, 2023
64703e0
experiment
danylo-safonov-solid Sep 13, 2023
851c27e
up
danylo-safonov-solid Sep 13, 2023
1ad4cda
ultra bless
danylo-safonov-solid Sep 13, 2023
97d2d09
.
danylo-safonov-solid Sep 13, 2023
1e9ec88
maybe closer
danylo-safonov-solid Sep 13, 2023
7dae9bc
not bruh
danylo-safonov-solid Sep 13, 2023
3867137
please
danylo-safonov-solid Sep 13, 2023
cef2fdb
<>
danylo-safonov-solid Sep 13, 2023
6b80cdf
777
danylo-safonov-solid Sep 13, 2023
d60906e
pls
danylo-safonov-solid Sep 13, 2023
1dca1a2
ultra please
danylo-safonov-solid Sep 13, 2023
6ecd4c6
pls
danylo-safonov-solid Sep 13, 2023
492f945
hope
danylo-safonov-solid Sep 13, 2023
969c37c
fix
danylo-safonov-solid Sep 14, 2023
3a033a8
fix
danylo-safonov-solid Sep 14, 2023
a764848
versions
danylo-safonov-solid Sep 14, 2023
8c6be21
merge
danylo-safonov-solid Sep 14, 2023
f6bb9dc
fix
danylo-safonov-solid Sep 14, 2023
b77bada
Merge branch 'bugfix' into lock-dart
danylo-safonov-solid Sep 14, 2023
7d92ba6
Merge branch 'lock-dart' into isolation-level
danylo-safonov-solid Sep 14, 2023
458db56
init?
danylo-safonov-solid Sep 14, 2023
96f8f13
done?
danylo-safonov-solid Sep 14, 2023
6ffc520
fix
danylo-safonov-solid Sep 14, 2023
305f2b8
upd
danylo-safonov-solid Sep 14, 2023
1612dfb
part
danylo-safonov-solid Sep 14, 2023
209977f
add placeholders
danylo-safonov-solid Sep 14, 2023
f773417
exports
danylo-safonov-solid Sep 14, 2023
c1fd25b
fixes
danylo-safonov-solid Sep 14, 2023
a21505e
fixes
danylo-safonov-solid Sep 14, 2023
4b4a4ec
more fixes
danylo-safonov-solid Sep 14, 2023
242629a
source
danylo-safonov-solid Sep 14, 2023
8bde0c3
todo
danylo-safonov-solid Sep 14, 2023
42967fe
clientOptions
danylo-safonov-solid Sep 14, 2023
832646f
info
danylo-safonov-solid Sep 14, 2023
5bed91c
remove things that are implemented
danylo-safonov-solid Sep 15, 2023
ee7936e
sync
danylo-safonov-solid Sep 15, 2023
44905a2
simplify checklist
danylo-safonov-solid Sep 15, 2023
8954ba7
align
danylo-safonov-solid Sep 15, 2023
bb547a3
extract checklist
danylo-safonov-solid Sep 15, 2023
2b3ca57
more implemented
danylo-safonov-solid Sep 15, 2023
f388fcd
upd
danylo-safonov-solid Sep 15, 2023
6fa5994
upd
danylo-safonov-solid Sep 15, 2023
34c4fec
Savepoint
danylo-safonov-solid Sep 15, 2023
9d788be
fix comments
danylo-safonov-solid Sep 15, 2023
8c4acfe
Merge branch 'fix-comments' into complete-interop1
danylo-safonov-solid Sep 15, 2023
54d4f1e
Merge branch 'main' into complete-interop1
danylo-safonov-solid Sep 15, 2023
d14616d
promise docs
danylo-safonov-solid Sep 15, 2023
9985a66
savepoint comments
danylo-safonov-solid Sep 15, 2023
7dfe833
ClientOptions comments
danylo-safonov-solid Sep 15, 2023
c232814
hosttype
danylo-safonov-solid Sep 15, 2023
62c347f
partialconnectionoptions upd
danylo-safonov-solid Sep 15, 2023
1017a57
partialTLSOptions
danylo-safonov-solid Sep 15, 2023
547a29c
uncomment
danylo-safonov-solid Sep 15, 2023
196ee80
progress
danylo-safonov-solid Sep 15, 2023
14d1469
partially resolve queryObject
danylo-safonov-solid Sep 15, 2023
0f0a0c5
upd
danylo-safonov-solid Sep 18, 2023
4fbcdf4
upd
danylo-safonov-solid Sep 18, 2023
abaf4c6
big upd
danylo-safonov-solid Sep 18, 2023
f59ef27
fix
danylo-safonov-solid Sep 18, 2023
c206335
split by files
danylo-safonov-solid Sep 18, 2023
d15417e
init
danylo-safonov-solid Sep 18, 2023
db75396
CommandType
danylo-safonov-solid Sep 18, 2023
737d5fb
notice
danylo-safonov-solid Sep 18, 2023
c1f6a1d
ResultType
danylo-safonov-solid Sep 18, 2023
91f9831
working type
danylo-safonov-solid Sep 18, 2023
da3208f
placeholders
danylo-safonov-solid Sep 18, 2023
d3f8d90
working
danylo-safonov-solid Sep 18, 2023
c92dd81
more consistent comments
danylo-safonov-solid Sep 18, 2023
eefbfd2
sync
danylo-safonov-solid Sep 18, 2023
efae6a2
sync
danylo-safonov-solid Sep 18, 2023
13750a9
rowdescription
danylo-safonov-solid Sep 18, 2023
fd0274e
query
danylo-safonov-solid Sep 18, 2023
330b1fa
split by files
danylo-safonov-solid Sep 18, 2023
53ffeba
queryObjectOptions
danylo-safonov-solid Sep 18, 2023
2be332b
uint8
danylo-safonov-solid Sep 18, 2023
6ebfab9
init
danylo-safonov-solid Sep 18, 2023
20e5d3f
mini upd
danylo-safonov-solid Sep 18, 2023
8f965ff
working
danylo-safonov-solid Sep 18, 2023
8075339
remove generic
danylo-safonov-solid Sep 18, 2023
3f8c731
sync
danylo-safonov-solid Sep 18, 2023
16dd4b5
sync
danylo-safonov-solid Sep 19, 2023
99010b3
upd
danylo-safonov-solid Sep 19, 2023
ee30c72
init
danylo-safonov-solid Sep 19, 2023
9000f58
upd
danylo-safonov-solid Sep 19, 2023
2c06285
sync
danylo-safonov-solid Sep 19, 2023
3252e45
init
danylo-safonov-solid Sep 19, 2023
0168f8d
sync
danylo-safonov-solid Sep 19, 2023
3ff9819
rm duplicate
danylo-safonov-solid Sep 19, 2023
69f0268
restore
danylo-safonov-solid Sep 19, 2023
7c2474a
restore order
danylo-safonov-solid Sep 19, 2023
b1652e1
sync
danylo-safonov-solid Sep 19, 2023
03714ff
sync
danylo-safonov-solid Sep 19, 2023
1d670fb
sync
danylo-safonov-solid Sep 19, 2023
5516b9f
part
danylo-safonov-solid Sep 19, 2023
38540f1
more prope
danylo-safonov-solid Sep 19, 2023
b0391f1
upd
danylo-safonov-solid Sep 19, 2023
747a4b8
fix
danylo-safonov-solid Sep 19, 2023
da1e5bb
todos
danylo-safonov-solid Sep 19, 2023
f4608b0
upd
danylo-safonov-solid Sep 19, 2023
6cf6999
constructor
danylo-safonov-solid Sep 19, 2023
0e7420e
parse
danylo-safonov-solid Sep 19, 2023
f6d6608
todo
danylo-safonov-solid Sep 19, 2023
e6a36d0
upd
danylo-safonov-solid Sep 20, 2023
d1080ab
Merge branch 'main' into PoolClient
danylo-safonov-solid Sep 20, 2023
2a99e77
upd
danylo-safonov-solid Sep 20, 2023
b396b87
fix comments
danylo-safonov-solid Sep 20, 2023
be46787
upd
danylo-safonov-solid Sep 20, 2023
63bb9de
upd
danylo-safonov-solid Sep 20, 2023
08caea6
upd
danylo-safonov-solid Sep 20, 2023
ac91006
constructor
danylo-safonov-solid Sep 20, 2023
f5c5768
upd
danylo-safonov-solid Sep 20, 2023
24cb622
upd
danylo-safonov-solid Sep 20, 2023
68545d5
export
danylo-safonov-solid Sep 20, 2023
1eafda3
tls options
danylo-safonov-solid Sep 20, 2023
8cfa653
finish?
danylo-safonov-solid Sep 20, 2023
e671dcc
upd
danylo-safonov-solid Sep 20, 2023
f1b6395
last
danylo-safonov-solid Sep 20, 2023
67aab73
Merge branch 'PoolClient' into QueryResult
danylo-safonov-solid Sep 20, 2023
ac208bc
upd
danylo-safonov-solid Sep 20, 2023
26f47f3
upd
danylo-safonov-solid Sep 20, 2023
986eed2
upd
danylo-safonov-solid Sep 20, 2023
d4542bb
sync
danylo-safonov-solid Sep 20, 2023
1769b88
revert
danylo-safonov-solid Sep 20, 2023
d092ed9
revert
danylo-safonov-solid Sep 20, 2023
5f4ad6c
upd
danylo-safonov-solid Sep 20, 2023
dbc929f
upd
danylo-safonov-solid Sep 20, 2023
74d4e6e
sync
danylo-safonov-solid Sep 20, 2023
8474d2c
sync
danylo-safonov-solid Sep 20, 2023
1bbb7e6
fix
danylo-safonov-solid Sep 20, 2023
6a42760
restore
danylo-safonov-solid Sep 20, 2023
6807f24
add comments
danylo-safonov-solid Sep 20, 2023
d1f834a
comments
danylo-safonov-solid Sep 20, 2023
2a995de
update unimplemented
danylo-safonov-solid Sep 20, 2023
740a82b
upd
danylo-safonov-solid Sep 20, 2023
4579d59
upd
danylo-safonov-solid Sep 20, 2023
0047c9b
upd
danylo-safonov-solid Sep 20, 2023
d947da8
upd
danylo-safonov-solid Sep 21, 2023
89fdb19
transaction
danylo-safonov-solid Sep 21, 2023
162e09f
fin
danylo-safonov-solid Sep 21, 2023
4973815
upd
danylo-safonov-solid Sep 21, 2023
1757b65
impl
danylo-safonov-solid Sep 21, 2023
b0810ce
seemps good
danylo-safonov-solid Sep 21, 2023
49e84a5
upd
danylo-safonov-solid Sep 21, 2023
90963a4
sync
danylo-safonov-solid Sep 21, 2023
82f0d47
exports
danylo-safonov-solid Sep 21, 2023
789adf6
jserror
danylo-safonov-solid Sep 21, 2023
c2f98cb
upd
danylo-safonov-solid Sep 21, 2023
acd3600
upd again
danylo-safonov-solid Sep 21, 2023
6f2df24
fix
danylo-safonov-solid Sep 21, 2023
79feefb
fix
danylo-safonov-solid Sep 21, 2023
a273f3b
fix
danylo-safonov-solid Sep 21, 2023
c87a381
fix
danylo-safonov-solid Sep 21, 2023
138cbfa
export
danylo-safonov-solid Sep 21, 2023
8946b1d
130/130 pana
danylo-safonov-solid Sep 21, 2023
aecda29
sync
danylo-safonov-solid Sep 21, 2023
64705ba
better description
danylo-safonov-solid Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 32 additions & 16 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,50 @@ Future<Response> fetch(Request _) async {

final client = Client(dbUrl);
await client.connect();
final result = await client.transaction(
'transaction',
transaction,
TransactionOptions(isolationLevel: IsolationLevel.serializable),
);
await client.end();
try {
final result = await client.transaction(
'transaction',
transaction,
TransactionOptions(isolationLevel: IsolationLevel.serializable),
);
await client.end();

return Response(
[
result.command == CommandType.select,
'warnings = ${result.warnings}',
'''
return Response(
[
result.command == CommandType.select,
'warnings = ${result.warnings}',
'''
rowDescription =
columnCount = ${result.rowDescription?.columnCount}
columns =
${result.rowDescription?.columns.map((e) => ' name = ${e.name}').join('\n')}
''',
result.query.resultType,
...result.rows.map(rowToPrettyString),
].join('\n\n'),
);
result.query.resultType,
...result.rows.map(rowToPrettyString),
].join('\n\n'),
);
} on TransactionError catch (e) {
await client.end();

return Response('''
${e.name}
${e.cause}
${e.cause.name}
${e.cause.cause}
${e.cause.message}
${e.cause.fields}
${e.message}
$e
''');
}
}

Future<QueryObjectResult<dynamic>> transaction(Transaction transaction) async {
await transaction.queryObject(
'UPDATE public."User" '
r'SET username=$1 '
"WHERE last_name='user'",
"WHERE last_name='user'"
'AND y = z',
["'user${transaction.hashCode}'"],
);
await Future.delayed(const Duration(seconds: 10));
Expand Down
4 changes: 4 additions & 0 deletions lib/deno_postgres_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export 'src/command_type.dart';
export 'src/connection.dart';
export 'src/connection_options.dart';
export 'src/encoded_arg.dart';
export 'src/errors/connection_error.dart';
export 'src/errors/connection_params_error.dart';
export 'src/errors/postgres_error.dart';
export 'src/errors/transaction_error.dart';
export 'src/isolation_level.dart';
export 'src/notice.dart';
export 'src/partial/partial_connection_options.dart';
Expand Down
7 changes: 7 additions & 0 deletions lib/src/errors/connection_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'dart:js_interop';

import 'package:deno_postgres_interop/src/errors/js_error.dart';

/// [deno-postgres@v0.17.0/ConnectionError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=ConnectionError).
@JS('Error')
class ConnectionError extends JSError {}
7 changes: 7 additions & 0 deletions lib/src/errors/connection_params_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'dart:js_interop';

import 'package:deno_postgres_interop/src/errors/js_error.dart';

/// [deno-postgres@v0.17.0/ConnectionParamsError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=ConnectionParamsError).
@JS('Error')
class ConnectionParamsError extends JSError {}
14 changes: 14 additions & 0 deletions lib/src/errors/js_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'dart:js_interop';

/// [js/Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error).
@JS('Error')
class JSError {
/// [js/Error/name](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name).
external String get name;

/// [js/Error/cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause).
external Error? get cause;

/// [js/Error/message](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message).
external String get message;
}
11 changes: 11 additions & 0 deletions lib/src/errors/postgres_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'dart:js_interop';

import 'package:deno_postgres_interop/src/errors/js_error.dart';
import 'package:deno_postgres_interop/src/notice.dart';

/// [deno-postgres@v0.17.0/PostgresError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=TransactionError).
@JS()
class PostgresError extends JSError {
/// [deno-postgres@v0.17.0/PostgresError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=PostgresError#prop_fields).
external Notice get fields;
}
17 changes: 17 additions & 0 deletions lib/src/errors/transaction_error.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'dart:js_interop';

import 'package:deno_postgres_interop/src/errors/postgres_error.dart';

/// [deno-postgres@v0.17.0/TransactionError](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=TransactionError).
@JS()
class TransactionError {
/// [js/Error/cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause).
/// [deno-postgres@v0.17.0/TransactionError/constructor](https://deno.land/x/postgres@v0.17.0/client/error.ts?s=TransactionError#ctor_0).
external PostgresError get cause;

/// [js/Error/message](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message).
external String get message;

/// [js/Error/name](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name).
external String get name;
}
4 changes: 3 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: deno_postgres_interop
description: An interop for deno-postgres.
description:
An interop for js package deno-postgres - PostgreSQL
driver that can be used in deno-deploy (supabase edge functions).
version: 0.0.1
repository: https://github.com/solid-software/deno_postgres_interop

Expand Down
Loading