1

I'm trying to use json-sql npm module with postgres. But I was not able to even do select.

I think, the problem is that query from json-sql contains $p1 instead $1. What I need to tune to be able to get postgres-like query from json-sql?

I tried to use { dialect : 'postgresql' } configuration option but still I have a problem.

As a result of code below:

let userCompSql = jsonSql.build({
    type: 'select',
    fields: ['id'],
    table: 'user_computers',
    condition: {
        'os_name' : params.osName,
        'os_minor' : params.osVersionMinor
   }})

I get a string userCompSql: "select "id" from "user_computers" where "os_name" = $p1 and "os_minor" = 0;" But I would like to have $1 instead of $p1 for my postgresql DB.

1 Answer 1

2

That was so easy. Just configure { namedValues: false }...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.