【发布时间】:2018-04-28 00:23:17
【问题描述】:
我正在尝试将 json-sql npm 模块与 postgres 一起使用。 但我什至无法选择。
我认为,问题在于来自 json-sql 的查询包含 $p1 而不是 $1。 我需要调整什么才能从 json-sql 获得类似 postgres 的查询?
我尝试使用 { dialect : 'postgresql' } 配置选项,但仍然有问题。
以下代码的结果:
let userCompSql = jsonSql.build({
type: 'select',
fields: ['id'],
table: 'user_computers',
condition: {
'os_name' : params.osName,
'os_minor' : params.osVersionMinor
}})
我得到一个字符串 userCompSql: "select "id" from "user_computers" where "os_name" = $p1 and "os_minor" = 0;" 但我想为我的 postgresql DB 使用 $1 而不是 $p1。
【问题讨论】:
标签: json node.js postgresql