-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efae6a2
commit 13750a9
Showing
1 changed file
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |