Skip to content

Commit

Permalink
Notice (#16)
Browse files Browse the repository at this point in the history
* init

* upd

* init
  • Loading branch information
danylo-safonov-solid authored Sep 20, 2023
1 parent 4e228f6 commit 611000c
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Future<Response> fetch(Request _) async {
return Response(
[
result.command == CommandType.select,
'warnings = ${result.warnings}',
'''
rowDescription =
columnCount = ${result.rowDescription?.columnCount}
Expand Down
98 changes: 98 additions & 0 deletions lib/src/notice.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import 'dart:js_interop';
import 'dart:js_util';

/// [[email protected]/Notice](https://deno.land/x/[email protected]/connection/message.ts?s=Notice).
@JS()
class Notice {
/// [[email protected]/Notice/severity](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_severity).
external String get severity;

/// [[email protected]/Notice/code](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_code).
external String get code;

/// [[email protected]/Notice/message](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_message).
external String get message;

/// [[email protected]/Notice/detail](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_detail).
external String? get detail;

/// [[email protected]/Notice/hint](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_hint).
external String? get hint;

/// [[email protected]/Notice/position](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_position).
external String? get position;

/// [[email protected]/Notice/internalPosition](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_internalPosition).
external String? get internalPosition;

/// [[email protected]/Notice/internalQuery](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_internalQuery).
external String? get internalQuery;

/// [[email protected]/Notice/where](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_where).
external String? get where;

/// [[email protected]/Notice/schema](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_schema).
external String? get schema;

/// [[email protected]/Notice/table](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_table).
external String? get table;

/// [[email protected]/Notice/column](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_column).
external String? get column;

/// [[email protected]/Notice/dataType](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_dataType).
external String? get dataType;

/// [[email protected]/Notice/constraint](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_constraint).
external String? get constraint;

/// [[email protected]/Notice/file](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_file).
external String? get file;

/// [[email protected]/Notice/line](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_line).
external String? get line;

/// [[email protected]/Notice/routine](https://deno.land/x/[email protected]/connection/message.ts?s=Notice#prop_routine).
external String? get routine;

/// [[email protected]/Notice](https://deno.land/x/[email protected]/connection/message.ts?s=Notice).
factory Notice({
required String severity,
required String code,
required String message,
String? detail,
String? hint,
String? position,
String? internalPosition,
String? internalQuery,
String? where,
String? schema,
String? table,
String? column,
String? dataType,
String? constraint,
String? file,
String? line,
String? routine,
}) {
return jsify({
'severity': severity,
'code': code,
'message': message,
if (detail != null) 'detail': detail,
if (hint != null) 'hint': hint,
if (position != null) 'position': position,
if (internalPosition != null) 'internalPosition': internalPosition,
if (internalQuery != null) 'internalQuery': internalQuery,
if (where != null) 'where': where,
if (schema != null) 'schema': schema,
if (table != null) 'table': table,
if (column != null) 'column': column,
if (dataType != null) 'dataType': dataType,
if (constraint != null) 'constraint': constraint,
if (file != null) 'file': file,
if (line != null) 'line': line,
if (routine != null) 'routine': routine,
}) as Notice;
}
}
4 changes: 4 additions & 0 deletions lib/src/query_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import 'dart:js_interop';
import 'dart:js_util';

import 'package:deno_postgres_interop/src/command_type.dart';
import 'package:deno_postgres_interop/src/notice.dart';
import 'package:deno_postgres_interop/src/query.dart';
import 'package:deno_postgres_interop/src/row_description.dart';

/// [[email protected]/QueryResult](https://deno.land/x/[email protected]/query/query.ts?s=QueryResult).
@JS()
class QueryResult {
/// [[email protected]/QueryResult/warnings](https://deno.land/x/[email protected]/query/query.ts?s=QueryResult#prop_warnings).
external List<Notice> get warnings;

/// [[email protected]/QueryResult/constructor](https://deno.land/x/[email protected]/query/query.ts?s=QueryResult#ctor_0).
external Query get query;

Expand Down

0 comments on commit 611000c

Please sign in to comment.