postgresql-client
Advanced tools
Comparing version 2.1.2 to 2.1.3
{ | ||
"name": "postgresql-client", | ||
"description": "Professional PostgreSQL client for JavaScript and TypeScript", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"author": "Panates", | ||
@@ -64,4 +64,4 @@ "contributors": [ | ||
"@types/node": "^18.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.29.0", | ||
"@typescript-eslint/parser": "^5.29.0", | ||
"@typescript-eslint/eslint-plugin": "^5.30.0", | ||
"@typescript-eslint/parser": "^5.30.0", | ||
"babel-eslint": "^10.1.0", | ||
@@ -68,0 +68,0 @@ "dotenv": "^16.0.1", |
@@ -78,2 +78,18 @@ ## postgresql-client | ||
### Using prepared statements | ||
```ts | ||
import {DataTypeOIDs} from 'postgresql-client'; | ||
// ..... | ||
const statement = await connection.prepare( | ||
'insert into my_table(id, name) values ($1, $2)', { | ||
paramTypes: [DataTypeOIDs.Int4, DataTypeOIDs.Varchar] | ||
}); | ||
for (let i = 0; i < 100; i++) { | ||
await statement.execute({params: [i, ('name' + i)]}); | ||
} | ||
await statement.close(); // When you done, close the statement to relase resources | ||
``` | ||
#### Check [DOCUMENTATION](DOCUMENTATION.md) for other examples. | ||
@@ -83,2 +99,55 @@ | ||
## Data types mappings | ||
The table below lists builtin data type mappings. | ||
| Posgtres type | JS type | Receive | Send | | ||
|---------------|:------------| ------------|----------| | ||
| bool | boolean | text,binary | binary | | ||
| int2 | number | text,binary | binary | | ||
| int4 | number | text,binary | binary | | ||
| int8 | BigInt | text,binary | binary | | ||
| float4 | number | text,binary | binary | | ||
| float8 | number | text,binary | binary | | ||
| char | string | text,binary | binary | | ||
| bpchar | string | text,binary | binary | | ||
| varchar | string | text,binary | binary | | ||
| date | Date | text,binary | binary | | ||
| time | Date | text,binary | binary | | ||
| timestamp | Date | text,binary | binary | | ||
| timestamptz | Date | text,binary | binary | | ||
| oid | number | text,binary | binary | | ||
| bytea | Buffer | text,binary | binary | | ||
| uuid | string | text,binary | binary | | ||
| json | object | text,binary | binary | | ||
| jsonb | object | text,binary | binary | | ||
| xml | string | text,binary | binary | | ||
| point | Point | text,binary | binary | | ||
| circle | Circle | text,binary | binary | | ||
| lseg | Rectangle | text,binary | binary | | ||
| box | Rectangle | text,binary | binary | | ||
| _bool | boolean[] | text,binary | binary | | ||
| _int2 | number[] | text,binary | binary | | ||
| _int4 | number[] | text,binary | binary | | ||
| _int8 | BigInt[] | text,binary | binary | | ||
| _float4 | number[] | text,binary | binary | | ||
| _float8 | number[] | text,binary | binary | | ||
| _char | string[] | text,binary | binary | | ||
| _bpchar | string[] | text,binary | binary | | ||
| _varchar | string[] | text,binary | binary | | ||
| _date | Date[] | text,binary | binary | | ||
| _time | Date[] | text,binary | binary | | ||
| _timestamp | Date[] | text,binary | binary | | ||
| _timestamptz | Date[] | text,binary | binary | | ||
| _uuid | string[] | text,binary | binary | | ||
| _oid | number[] | text,binary | binary | | ||
| _bytea | Buffer[] | text,binary | binary | | ||
| _json | object[] | text,binary | binary | | ||
| _jsonb | object[] | text,binary | binary | | ||
| _xml | string[] | text,binary | binary | | ||
| _point | Point[] | text,binary | binary | | ||
| _circle | Circle[] | text,binary | binary | | ||
| _lseg | Rectangle[] | text,binary | binary | | ||
| _box | Rectangle[] | text,binary | binary | | ||
## Support | ||
@@ -85,0 +154,0 @@ You can report bugs and discuss features on the [GitHub issues](https://github.com/panates/postgresql-client/issues) page |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
358385
178