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
console.log('The number is: '+row.get('i')); // 1, 2, 3, ...
164
+
constresult = client.query(...);
165
+
forawait (constobjofresult) {
166
+
console.log('The number is: '+obj.i); // 1, 2, 3, ...
164
167
}
165
168
```
166
-
Note that values are polymorphic and need to be explicitly cast to a concrete type such as ``number`` or ``string``.
167
169
168
170
### Result interface
169
171
170
-
This interface is available on the already waited for result object. It makes data available in the ``rows`` attribute as an array of arrays (of values).
172
+
The awaited result object provides an interface based on rows and column names.
173
+
171
174
```typescript
172
175
for (const row ofresult.rows) {
176
+
// Using the array indices:
173
177
console.log('The number is: '+row[0]); // 1, 2, 3, ...
178
+
179
+
// Using the column name:
180
+
console.log('The number is: '+row.get('i')); // 1, 2, 3, ...
174
181
}
175
182
```
176
-
This is the most efficient way to work with result data. Column names are available as the ``names`` attribute of a result.
183
+
184
+
Column names are available via the ``names`` property.
177
185
178
186
### Streaming
179
187
@@ -208,8 +216,8 @@ You can prepare a query and subsequently execute it multiple times. This is also
0 commit comments