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
There is currently no guaranteed way to handle `numeric` / `decimal` types in native Javascript. **These [and similar] types will be returned as a `string`**. The best way in this case is to use [custom types](#custom-types).
663
664
665
+
## Result Array
666
+
667
+
The `Result` Array returned from queries is a custom array allowing for easy destructuring or passing on directly to JSON.stringify or general Array usage. It includes the following properties.
668
+
669
+
### .count
670
+
671
+
The `count` property is the number of affected rows returned by the database. This is usefull for insert, update and delete operations to know the number of rows since .length will be 0 in these cases if not using `RETURNING...`.
672
+
673
+
### .command
674
+
675
+
The `command` run by the query - eg. one of `SELECT`, `UPDATE`, `INSERT`, `DELETE`
676
+
677
+
### .columns
678
+
679
+
The `columns` returned by the query useful to determine types, or map to the result values when using `.values()`
680
+
681
+
```js
682
+
{
683
+
name :String, // Column name,
684
+
type : oid, // PostgreSQL oid column type
685
+
parser:Function// The function used by Postgres.js for parsing
686
+
}
687
+
```
688
+
689
+
### .statement
690
+
691
+
The `statement` contains information about the statement implicitly created by Postgres.js.
692
+
693
+
```js
694
+
{
695
+
name :String, // The auto generated statement name
696
+
string :String, // The actual query string executed
697
+
types : [oid], // An array of oid expected as input parameters
698
+
columns : [Column] // Array of columns - same as Result.columns
699
+
}
700
+
```
701
+
702
+
### .state
703
+
704
+
This is the state `{ pid, secret }` of the connection that executed the query.
0 commit comments