@sqb/postgres 4.13.0 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/datatype-map.js +13 -13
- package/cjs/pg-adapter.js +3 -3
- package/cjs/pg-connection.js +18 -18
- package/esm/datatype-map.js +1 -1
- package/esm/pg-adapter.js +2 -2
- package/esm/pg-connection.js +1 -1
- package/package.json +7 -7
- package/types/datatype-map.d.ts +1 -1
- package/types/pg-connection.d.ts +1 -1
package/cjs/datatype-map.js
CHANGED
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dataTypeToOID = dataTypeToOID;
|
|
4
4
|
const builder_1 = require("@sqb/builder");
|
|
5
|
-
const
|
|
5
|
+
const postgrejs_1 = require("postgrejs");
|
|
6
6
|
function dataTypeToOID(dataType, isArray) {
|
|
7
7
|
if (dataType === builder_1.DataType.DATE)
|
|
8
|
-
return isArray ?
|
|
8
|
+
return isArray ? postgrejs_1.DataTypeOIDs._date : postgrejs_1.DataTypeOIDs.date;
|
|
9
9
|
if (dataType === builder_1.DataType.BOOL)
|
|
10
|
-
return isArray ?
|
|
10
|
+
return isArray ? postgrejs_1.DataTypeOIDs._bool : postgrejs_1.DataTypeOIDs.bool;
|
|
11
11
|
if (dataType === builder_1.DataType.CHAR)
|
|
12
|
-
return isArray ?
|
|
12
|
+
return isArray ? postgrejs_1.DataTypeOIDs._bpchar : postgrejs_1.DataTypeOIDs.bpchar;
|
|
13
13
|
if (dataType === builder_1.DataType.SMALLINT)
|
|
14
|
-
return isArray ?
|
|
14
|
+
return isArray ? postgrejs_1.DataTypeOIDs._int2 : postgrejs_1.DataTypeOIDs.int2;
|
|
15
15
|
if (dataType === builder_1.DataType.INTEGER)
|
|
16
|
-
return isArray ?
|
|
16
|
+
return isArray ? postgrejs_1.DataTypeOIDs._int4 : postgrejs_1.DataTypeOIDs.int4;
|
|
17
17
|
if (dataType === builder_1.DataType.BIGINT)
|
|
18
|
-
return isArray ?
|
|
18
|
+
return isArray ? postgrejs_1.DataTypeOIDs._int8 : postgrejs_1.DataTypeOIDs.int8;
|
|
19
19
|
if (dataType === builder_1.DataType.BINARY)
|
|
20
|
-
return isArray ?
|
|
20
|
+
return isArray ? postgrejs_1.DataTypeOIDs._bytea : postgrejs_1.DataTypeOIDs.bytea;
|
|
21
21
|
if (dataType === builder_1.DataType.FLOAT)
|
|
22
|
-
return isArray ?
|
|
22
|
+
return isArray ? postgrejs_1.DataTypeOIDs._float4 : postgrejs_1.DataTypeOIDs.float4;
|
|
23
23
|
if (dataType === builder_1.DataType.DOUBLE)
|
|
24
|
-
return isArray ?
|
|
24
|
+
return isArray ? postgrejs_1.DataTypeOIDs._float8 : postgrejs_1.DataTypeOIDs.float8;
|
|
25
25
|
if (dataType === builder_1.DataType.GUID)
|
|
26
|
-
return isArray ?
|
|
26
|
+
return isArray ? postgrejs_1.DataTypeOIDs._uuid : postgrejs_1.DataTypeOIDs.uuid;
|
|
27
27
|
if (dataType === builder_1.DataType.TEXT)
|
|
28
|
-
return isArray ?
|
|
28
|
+
return isArray ? postgrejs_1.DataTypeOIDs._text : postgrejs_1.DataTypeOIDs.text;
|
|
29
29
|
if (dataType === builder_1.DataType.JSON)
|
|
30
|
-
return isArray ?
|
|
30
|
+
return isArray ? postgrejs_1.DataTypeOIDs._json : postgrejs_1.DataTypeOIDs.json;
|
|
31
31
|
}
|
package/cjs/pg-adapter.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PgAdapter = void 0;
|
|
4
4
|
require("@sqb/postgres-dialect");
|
|
5
5
|
const connect_1 = require("@sqb/connect");
|
|
6
|
-
const
|
|
6
|
+
const postgrejs_1 = require("postgrejs");
|
|
7
7
|
const pg_connection_js_1 = require("./pg-connection.js");
|
|
8
8
|
class PgAdapter {
|
|
9
9
|
constructor() {
|
|
10
|
-
this.driver = '
|
|
10
|
+
this.driver = 'postgrejs';
|
|
11
11
|
this.dialect = 'postgres';
|
|
12
12
|
this.features = {
|
|
13
13
|
cursor: true,
|
|
@@ -29,7 +29,7 @@ class PgAdapter {
|
|
|
29
29
|
cfg.database = config.database;
|
|
30
30
|
if (config.schema)
|
|
31
31
|
cfg.schema = config.schema;
|
|
32
|
-
const connection = new
|
|
32
|
+
const connection = new postgrejs_1.Connection(cfg);
|
|
33
33
|
try {
|
|
34
34
|
await connection.connect();
|
|
35
35
|
return new pg_connection_js_1.PgConnection(connection);
|
package/cjs/pg-connection.js
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PgConnection = void 0;
|
|
4
4
|
const connect_1 = require("@sqb/connect");
|
|
5
|
-
const
|
|
5
|
+
const postgrejs_1 = require("postgrejs");
|
|
6
6
|
const datatype_map_js_1 = require("./datatype-map.js");
|
|
7
7
|
const SqbDataTypToOIDMap = {
|
|
8
|
-
[connect_1.DataType.BOOL]:
|
|
9
|
-
[connect_1.DataType.CHAR]:
|
|
10
|
-
[connect_1.DataType.VARCHAR]:
|
|
11
|
-
[connect_1.DataType.SMALLINT]:
|
|
12
|
-
[connect_1.DataType.INTEGER]:
|
|
13
|
-
[connect_1.DataType.BIGINT]:
|
|
14
|
-
[connect_1.DataType.FLOAT]:
|
|
15
|
-
[connect_1.DataType.DOUBLE]:
|
|
16
|
-
[connect_1.DataType.NUMBER]:
|
|
17
|
-
[connect_1.DataType.DATE]:
|
|
18
|
-
[connect_1.DataType.TIMESTAMP]:
|
|
19
|
-
[connect_1.DataType.TIMESTAMPTZ]:
|
|
20
|
-
[connect_1.DataType.TIME]:
|
|
21
|
-
[connect_1.DataType.BINARY]:
|
|
22
|
-
[connect_1.DataType.TEXT]:
|
|
23
|
-
[connect_1.DataType.GUID]:
|
|
8
|
+
[connect_1.DataType.BOOL]: postgrejs_1.DataTypeOIDs.bool,
|
|
9
|
+
[connect_1.DataType.CHAR]: postgrejs_1.DataTypeOIDs.char,
|
|
10
|
+
[connect_1.DataType.VARCHAR]: postgrejs_1.DataTypeOIDs.varchar,
|
|
11
|
+
[connect_1.DataType.SMALLINT]: postgrejs_1.DataTypeOIDs.int2,
|
|
12
|
+
[connect_1.DataType.INTEGER]: postgrejs_1.DataTypeOIDs.int4,
|
|
13
|
+
[connect_1.DataType.BIGINT]: postgrejs_1.DataTypeOIDs.int8,
|
|
14
|
+
[connect_1.DataType.FLOAT]: postgrejs_1.DataTypeOIDs.float4,
|
|
15
|
+
[connect_1.DataType.DOUBLE]: postgrejs_1.DataTypeOIDs.float8,
|
|
16
|
+
[connect_1.DataType.NUMBER]: postgrejs_1.DataTypeOIDs.float8,
|
|
17
|
+
[connect_1.DataType.DATE]: postgrejs_1.DataTypeOIDs.date,
|
|
18
|
+
[connect_1.DataType.TIMESTAMP]: postgrejs_1.DataTypeOIDs.timestamp,
|
|
19
|
+
[connect_1.DataType.TIMESTAMPTZ]: postgrejs_1.DataTypeOIDs.timestamptz,
|
|
20
|
+
[connect_1.DataType.TIME]: postgrejs_1.DataTypeOIDs.time,
|
|
21
|
+
[connect_1.DataType.BINARY]: postgrejs_1.DataTypeOIDs.bytea,
|
|
22
|
+
[connect_1.DataType.TEXT]: postgrejs_1.DataTypeOIDs.text,
|
|
23
|
+
[connect_1.DataType.GUID]: postgrejs_1.DataTypeOIDs.uuid,
|
|
24
24
|
};
|
|
25
25
|
class PgConnection {
|
|
26
26
|
constructor(conn) {
|
|
@@ -103,7 +103,7 @@ class PgConnection {
|
|
|
103
103
|
if (v != null && paramOpts && paramOpts.dataType) {
|
|
104
104
|
const oid = (0, datatype_map_js_1.dataTypeToOID)(paramOpts.dataType, paramOpts.isArray);
|
|
105
105
|
if (oid)
|
|
106
|
-
return new
|
|
106
|
+
return new postgrejs_1.BindParam(oid, v);
|
|
107
107
|
}
|
|
108
108
|
return v;
|
|
109
109
|
});
|
package/esm/datatype-map.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataType } from '@sqb/builder';
|
|
2
|
-
import { DataTypeOIDs } from '
|
|
2
|
+
import { DataTypeOIDs } from 'postgrejs';
|
|
3
3
|
export function dataTypeToOID(dataType, isArray) {
|
|
4
4
|
if (dataType === DataType.DATE)
|
|
5
5
|
return isArray ? DataTypeOIDs._date : DataTypeOIDs.date;
|
package/esm/pg-adapter.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '@sqb/postgres-dialect';
|
|
2
2
|
import { DataType } from '@sqb/connect';
|
|
3
|
-
import { Connection } from '
|
|
3
|
+
import { Connection } from 'postgrejs';
|
|
4
4
|
import { PgConnection } from './pg-connection.js';
|
|
5
5
|
export class PgAdapter {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.driver = '
|
|
7
|
+
this.driver = 'postgrejs';
|
|
8
8
|
this.dialect = 'postgres';
|
|
9
9
|
this.features = {
|
|
10
10
|
cursor: true,
|
package/esm/pg-connection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataType } from '@sqb/connect';
|
|
2
|
-
import { BindParam, DataTypeOIDs } from '
|
|
2
|
+
import { BindParam, DataTypeOIDs } from 'postgrejs';
|
|
3
3
|
import { dataTypeToOID } from './datatype-map.js';
|
|
4
4
|
const SqbDataTypToOIDMap = {
|
|
5
5
|
[DataType.BOOL]: DataTypeOIDs.bool,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/postgres",
|
|
3
3
|
"description": "SQB serialization extension for PostgreSQL database",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.14.1",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"putil-promisify": "^1.10.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"
|
|
41
|
+
"postgrejs": "^2.15.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@sqb/builder": "^4.
|
|
45
|
-
"@sqb/connect": "^4.
|
|
46
|
-
"@sqb/postgres-dialect": "^4.
|
|
47
|
-
"
|
|
44
|
+
"@sqb/builder": "^4.14.1",
|
|
45
|
+
"@sqb/connect": "^4.14.1",
|
|
46
|
+
"@sqb/postgres-dialect": "^4.14.1",
|
|
47
|
+
"postgrejs": ">=2.15.1 <3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=16.0",
|
|
@@ -70,4 +70,4 @@
|
|
|
70
70
|
"serializer",
|
|
71
71
|
"database"
|
|
72
72
|
]
|
|
73
|
-
}
|
|
73
|
+
}
|
package/types/datatype-map.d.ts
CHANGED
package/types/pg-connection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Adapter, QueryRequest } from '@sqb/connect';
|
|
2
|
-
import { Connection, FieldInfo } from '
|
|
2
|
+
import { Connection, FieldInfo } from 'postgrejs';
|
|
3
3
|
export declare class PgConnection implements Adapter.Connection {
|
|
4
4
|
private intlcon?;
|
|
5
5
|
constructor(conn: Connection);
|