You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-3
Original file line number
Diff line number
Diff line change
@@ -55,14 +55,23 @@ the Parser will push rows with the corresponding keys.
55
55
56
56
When `mapping` is not given, the Parser will push rows as arrays of Buffers.
57
57
58
+
Check test directory for examples.
59
+
58
60
## fieldReader
59
61
60
-
A fieldReader is a Transform stream that takes a copyOut stream as input and outputs a sequence of fields.
61
-
The fields are decoded according to the `options.mapping` definition
62
+
A fieldReader is a Transform stream that takes a copyOut stream as input and outputs an objectMode stream that is a sequence of fields.
63
+
The fields are decoded according to the `options.mapping` definition and each field has the following keys :
64
+
-_fieldIndex: zero-based index of the field within a row
65
+
-_fieldCount: total number of fields within a row
66
+
-_fieldLength: byte-length of the field in binary representation (for bytea = number of bytes)
67
+
- name: name of the field, equal to the key of the field in the mapping definition
68
+
- value: value of the field. When mode is 'sync', this is the decoded value. When mode is 'async', this is a stream of _fieldLength bytes
62
69
63
70
Note that in fieldReader, each field can define a `mode = sync / async` attribute. When `mode = async`, the field output will be a Readable Stream.
64
71
This can help in scenarios when you do not want to gather a big field in memory but you will need to make sure that you read the field stream because if you do not read it, backpressure will kick in and you will not receive more fields.
65
72
73
+
Check test directory for examples.
74
+
66
75
### options.mapping
67
76
68
77
default: false
@@ -75,10 +84,13 @@ the Parser will push fields with the corresponding keys.
75
84
76
85
When `mapping` is not given, the Parser will push fields as arrays of Buffers.
77
86
87
+
78
88
## rawReader
79
89
80
90
A rawReader is a Transform stream that takes a copyOut stream as input and outputs raw field bytes.
81
91
92
+
Check test directory for examples.
93
+
82
94
## rowWriter
83
95
84
96
the deparser is usually used without arguments. It is a Transform Stream (always in object mode) that receives a stream of arrays, and outputs their PostgreSQL binary representation.
@@ -89,6 +101,8 @@ Currently, make sure sure value is not the javascript `undefined` because this c
89
101
90
102
Usually, you would want to use a through2 stream to prepare the arrays, and pipe this into the deparser.
91
103
104
+
Check test directory for examples.
105
+
92
106
### options.COPY_sendHeader
93
107
94
108
default: true
@@ -318,7 +332,7 @@ Use it at your own risks !
318
332
319
333
-[COPY documentation, including binary format](https://www.postgresql.org/docs/current/static/sql-copy.html)
320
334
-[send/recv implementations for types in PostgreSQL](https://github.com/postgres/postgres/tree/master/src/backend/utils/adt)
321
-
-[default type OIDs in PostgreSQL catalog](https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.h)
335
+
-[default type OIDs in PostgreSQL catalog](https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat)
0 commit comments