Skip to content

Commit 611000c

Browse files
Notice (#16)
* init * upd * init
1 parent 4e228f6 commit 611000c

File tree

3 files changed

+103
-0
lines changed

3 files changed

+103
-0
lines changed

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Future<Response> fetch(Request _) async {
1919
return Response(
2020
[
2121
result.command == CommandType.select,
22+
'warnings = ${result.warnings}',
2223
'''
2324
rowDescription =
2425
columnCount = ${result.rowDescription?.columnCount}

lib/src/notice.dart

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import 'dart:js_interop';
2+
import 'dart:js_util';
3+
4+
/// [[email protected]/Notice](https://deno.land/x/[email protected]/connection/message.ts?s=Notice).
5+
@JS()
6+
class Notice {
7+
/// [[email protected]/Notice/severity](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_severity).
8+
external String get severity;
9+
10+
/// [[email protected]/Notice/code](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_code).
11+
external String get code;
12+
13+
/// [[email protected]/Notice/message](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_message).
14+
external String get message;
15+
16+
/// [[email protected]/Notice/detail](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_detail).
17+
external String? get detail;
18+
19+
/// [[email protected]/Notice/hint](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_hint).
20+
external String? get hint;
21+
22+
/// [[email protected]/Notice/position](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_position).
23+
external String? get position;
24+
25+
/// [[email protected]/Notice/internalPosition](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_internalPosition).
26+
external String? get internalPosition;
27+
28+
/// [[email protected]/Notice/internalQuery](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_internalQuery).
29+
external String? get internalQuery;
30+
31+
/// [[email protected]/Notice/where](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_where).
32+
external String? get where;
33+
34+
/// [[email protected]/Notice/schema](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_schema).
35+
external String? get schema;
36+
37+
/// [[email protected]/Notice/table](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_table).
38+
external String? get table;
39+
40+
/// [[email protected]/Notice/column](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_column).
41+
external String? get column;
42+
43+
/// [[email protected]/Notice/dataType](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_dataType).
44+
external String? get dataType;
45+
46+
/// [[email protected]/Notice/constraint](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_constraint).
47+
external String? get constraint;
48+
49+
/// [[email protected]/Notice/file](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_file).
50+
external String? get file;
51+
52+
/// [[email protected]/Notice/line](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_line).
53+
external String? get line;
54+
55+
/// [[email protected]/Notice/routine](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_routine).
56+
external String? get routine;
57+
58+
/// [[email protected]/Notice](https://deno.land/x/[email protected]/connection/message.ts?s=Notice).
59+
factory Notice({
60+
required String severity,
61+
required String code,
62+
required String message,
63+
String? detail,
64+
String? hint,
65+
String? position,
66+
String? internalPosition,
67+
String? internalQuery,
68+
String? where,
69+
String? schema,
70+
String? table,
71+
String? column,
72+
String? dataType,
73+
String? constraint,
74+
String? file,
75+
String? line,
76+
String? routine,
77+
}) {
78+
return jsify({
79+
'severity': severity,
80+
'code': code,
81+
'message': message,
82+
if (detail != null) 'detail': detail,
83+
if (hint != null) 'hint': hint,
84+
if (position != null) 'position': position,
85+
if (internalPosition != null) 'internalPosition': internalPosition,
86+
if (internalQuery != null) 'internalQuery': internalQuery,
87+
if (where != null) 'where': where,
88+
if (schema != null) 'schema': schema,
89+
if (table != null) 'table': table,
90+
if (column != null) 'column': column,
91+
if (dataType != null) 'dataType': dataType,
92+
if (constraint != null) 'constraint': constraint,
93+
if (file != null) 'file': file,
94+
if (line != null) 'line': line,
95+
if (routine != null) 'routine': routine,
96+
}) as Notice;
97+
}
98+
}

lib/src/query_result.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ import 'dart:js_interop';
22
import 'dart:js_util';
33

44
import 'package:deno_postgres_interop/src/command_type.dart';
5+
import 'package:deno_postgres_interop/src/notice.dart';
56
import 'package:deno_postgres_interop/src/query.dart';
67
import 'package:deno_postgres_interop/src/row_description.dart';
78

89
/// [[email protected]/QueryResult](https://deno.land/x/[email protected]/query/query.ts?s=QueryResult).
910
@JS()
1011
class QueryResult {
12+
/// [[email protected]/QueryResult/warnings](https://deno.land/x/[email protected]/query/query.ts?s=QueryResult#prop_warnings).
13+
external List<Notice> get warnings;
14+
1115
/// [[email protected]/QueryResult/constructor](https://deno.land/x/[email protected]/query/query.ts?s=QueryResult#ctor_0).
1216
external Query get query;
1317

0 commit comments

Comments
 (0)