@@ -687,7 +687,7 @@ statements apply here as well
687
687
const my_id = 17 ;
688
688
await client .queryArray ` UPDATE TABLE X SET Y = 0 WHERE Z = ${my_id } ` ;
689
689
690
- // Invalid attempt to replace an specifier
690
+ // Invalid attempt to replace a specifier
691
691
const my_table = " IMPORTANT_TABLE" ;
692
692
const my_other_id = 41 ;
693
693
await client
@@ -699,12 +699,12 @@ await client
699
699
When a query is executed, the database returns all the data serialized as string
700
700
values. The ` deno-postgres ` driver automatically takes care of decoding the
701
701
results data of your query into the closest JavaScript compatible data type.
702
- This makes it easy to work with the data in your applciation using native
702
+ This makes it easy to work with the data in your application using native
703
703
Javascript types. A list of implemented type parsers can be found
704
704
[ here] ( https://github.com/denodrivers/postgres/issues/446 ) .
705
705
706
706
However, you may have more specific needs or may want to handle decoding
707
- yourself in your application. The driver provides 2 ways to handle decoding of
707
+ yourself in your application. The driver provides two ways to handle decoding of
708
708
the result data:
709
709
710
710
#### Decode strategy
@@ -714,9 +714,9 @@ decode the result data. This can be done by setting the `decodeStrategy`
714
714
controls option when creating your query client. The following options are
715
715
available:
716
716
717
- - ` auto ` : (** default** ) deno-postgres parses the data into JS types or objects
717
+ - ` auto ` : (** default** ) deno-postgres parses the data into JS types or objects
718
718
(non-implemented type parsers would still return strings).
719
- - ` string ` : all values are returned as string, and the user has to take care of
719
+ - ` string ` : all values are returned as string, and the user has to take care of
720
720
parsing
721
721
722
722
``` ts
@@ -733,7 +733,7 @@ available:
733
733
const result = await client .queryArray (
734
734
" SELECT ID, NAME, AGE, BIRTHDATE FROM PEOPLE WHERE ID = 1" ,
735
735
);
736
- console .log (result .rows ); // [[1, "Laura", 25, 1996-01-01T00:00:00.000Z ]]
736
+ console .log (result .rows ); // [[1, "Laura", 25, Date(' 1996-01-01') ]]
737
737
738
738
// versus
739
739
@@ -757,8 +757,8 @@ available:
757
757
758
758
You can also provide custom decoders to the client that will be used to decode
759
759
the result data. This can be done by setting the ` decoders ` controls option in
760
- the client configuration. This options is a map object where the keys are the
761
- type names or Oid number and the values are the custom decoder functions.
760
+ the client configuration. This option is a map object where the keys are the
761
+ type names or Oid numbers and the values are the custom decoder functions.
762
762
763
763
You can use it with the decode strategy. Custom decoders take precedence over
764
764
the strategy and internal parsers.
@@ -785,7 +785,7 @@ the strategy and internal parsers.
785
785
const result = await client .queryObject (
786
786
" SELECT ID, NAME, IS_ACTIVE FROM PEOPLE" ,
787
787
);
788
- console .log (result .rows [0 ]); // {id: '1', name: 'Javier', _bool : { value: false, type: "boolean"}}
788
+ console .log (result .rows [0 ]); // {id: '1', name: 'Javier', is_active : { value: false, type: "boolean"}}
789
789
}
790
790
```
791
791
0 commit comments