I am a front end developer and this is my first time using Slonik with postgresql.
I want to know how I can make this query dynamic by inserting the data (which is hardcoded) using function parameters:
const addMany = async (connection = slonik) =>…
Via Slonik I try to create a sql statement in a dynamic way. I have a list of keys I want to use for my insert statement and to create a list of values.
This is an example of my setup. Though the definition of my insert columns always fails.
const…
THE PROBLEM
I have a NodeJs server where I'm using jest for testing. In case of integration tests i get a message after all tests where passing:
"Jest has detected the following X (15-20) open handles potentially keeping Jest from exiting"
I knew…
This query seems to be legal when I run it in Datagrip with a parameter value of '14 days'
SELECT * FROM users WHERE users.updated_at < (CURRENT_DATE - INTERVAL $1)
But trying to do something similar in slonik as below does not:
const interval='14…
I'm trying to query a CSV into a DB, but always returns the error (No such file or directory).
The file should be hosted on the /tmp folder on the container?
Database: postgres:13.2-alpine (Docker container)
Backend: node + slonik (on top of…
Good Day!
I got an error when I try to connect to db Google Cloud by dint of slonik:
const pool = createPool(
`socket:userName:password@/cloudsql/teest-123986:europe-west3:test?db=dbName`
)
I got:
error: throw new Error('SASL:…
after updating slonik I got this error
[ERROR] 00:03:35 ⨯ Unable to compile TypeScript:
lib/newrelic/instrumentSlonik.ts(1,10): error TS2305: Module '"slonik"' has no exported member 'InterceptorType'.
node_modules/ts-node-dev/lib/log.js:27
any…
I'm building a postgres query using slonik to update a user table.
The passwordHash column should be changed only if the passwordHash variable is not null, otherwise it should be left untouched.
I've tried with a nested rule:
import { createPool,…
I am using slonik lib to run that query
connection of DatabaseTransactionConnectionType
const fileIds = ["3001"];
const noteId = 424;
const query = sql`
UPDATE file SET note_id = ${noteId}
WHERE file_id in (${fileIds})`;
await…
I'm trying to run tests in parallel using slonik. Each jest worker creates his own pool. All SQL queries in one test case must be executed inside a separate transaction. This will isolate jest workers from each other.
The global setup script…
I am fetching an issue where I have to generate dynamic ORDER BY clause for multiple columns.
Here is my sample query:
SELECT *
FROM user
WHERE gender = 'male'
ORDER BY created_at ASC, updated_at DESC
LIMIT 10 OFFSET 0;
Here, ORDER BY values will…