Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@knorm/postgres

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knorm/postgres - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

6

lib/KnormPostgres.js

@@ -362,3 +362,6 @@ const { Knorm } = require('@knorm/knorm');

const table = this.getTable();
const primary = this.quote(this.config.primary);
const primary = this.getColumn(this.config.primary, {
format: false,
quote: true
});

@@ -390,2 +393,3 @@ return this.sql

);
await this.releaseClient(client);

@@ -392,0 +396,0 @@ return result.rows;

6

package.json
{
"name": "@knorm/postgres",
"version": "1.1.0",
"version": "1.1.1",
"description": "Postgres plugin for knorm",

@@ -19,7 +19,7 @@ "main": "index.js",

"peerDependencies": {
"@knorm/knorm": "^1.0.0",
"@knorm/knorm": "^1.3.0",
"@knorm/relations": "^1.1.3"
},
"devDependencies": {
"@knorm/knorm": "^1.0.0",
"@knorm/knorm": "^1.3.0",
"@knorm/relations": "^1.1.3",

@@ -26,0 +26,0 @@ "coveralls": "^3.0.0",

@@ -895,2 +895,51 @@ const knorm = require('@knorm/knorm');

});
it('formats fields to columns', async () => {
class OtherUser extends User {}
OtherUser.fields = {
ID: { type: 'integer', primary: true, updated: false, column: 'id' },
NAME: { type: 'string', column: 'name' }
};
await new Query(OtherUser).insert([
{ ID: 1, NAME: 'foo' },
{ ID: 2, NAME: 'bar' }
]);
await expect(
new Query(OtherUser).update([
{ ID: 1, NAME: 'foofoo' },
{ ID: 2, NAME: 'barbar' }
]),
'to be fulfilled with value satisfying',
[{ ID: 1, NAME: 'foofoo' }, { ID: 2, NAME: 'barbar' }]
);
});
it('supports model `schema`', async () => {
class OtherUser extends User {}
OtherUser.schema = 'public';
await new Query(OtherUser).insert([
{ id: 1, name: 'foo' },
{ id: 2, name: 'bar' }
]);
const spy = sinon.spy(Query.prototype, 'query');
await expect(
new Query(OtherUser).update([
{ id: 1, name: 'foofoo' },
{ id: 2, name: 'barbar' }
]),
'to be fulfilled with value satisfying',
[{ id: 1, name: 'foofoo' }, { id: 2, name: 'barbar' }]
);
await expect(spy, 'to have calls satisfying', () => {
spy(
expect.it(
'when passed as parameter to',
sql => sql.toString(),
'to contain',
'"public"."user"'
)
);
});
spy.restore();
});
});

@@ -897,0 +946,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc