Skip to content

Commit

Permalink
rowdescription
Browse files Browse the repository at this point in the history
  • Loading branch information
danylo-safonov-solid committed Sep 18, 2023
1 parent efae6a2 commit 13750a9
Showing 1 changed file with 72 additions and 1 deletion.
73 changes: 72 additions & 1 deletion lib/src/row_description.dart
Original file line number Diff line number Diff line change
@@ -1 +1,72 @@
class RowDescription {}
import 'dart:js_util';

/// [deno-postgres@v0.17.0/RowDescription](https://deno.land/x/postgres@v0.17.0/query/query.ts?s=RowDescription).
class RowDescription {
/// https://deno.land/x/postgres@v0.17.0/query/query.ts?s=RowDescription#ctor_0
external factory RowDescription(int columnsCount, List<Column> columns);
}

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
class Column {
/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
external String get name;

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
external int get tableOid;

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
external int get index;

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
external int get typeOid;

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
external int get columnLength;

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
external int get typeModifier;

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column#ctor_0).
factory Column({
required String name,
required int tableOid,
required int index,
required int typeOid,
required int columnLength,
required int typeModifier,
required ColumnFormat format,
}) =>
callConstructor('Column', [
name,
tableOid,
index,
typeOid,
columnLength,
typeModifier,
format.id,
]);
}

/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
extension ColumnProps on Column {
/// [deno-postgres@v0.17.0/Column](https://deno.land/x/postgres@v0.17.0/query/decode.ts?s=Column).
ColumnFormat get format => ColumnFormat.values
.firstWhere((e) => e.id == getProperty(this, 'format'));
}

/// enum Format {
/// TEXT = 0,
/// BINARY = 1,
/// }
enum ColumnFormat {
/// text.
text(0),

/// binary.
binary(1);

/// Used for interop.
final int id;

const ColumnFormat(this.id);
}

0 comments on commit 13750a9

Please sign in to comment.