Knex: 如何进行铸造?

创建于 2016-03-04  ·  3评论  ·  资料来源: knex/knex

select count(*)::integer from mytable
如何使用 knexjs 正确执行此操作?

question

最有用的评论

knex('mytable').select(knex.raw('count(*)::integer'))

#387 中详细介绍了大整数作为字符串问题的更优雅的解决方案。

所有3条评论

knex('mytable').select(knex.raw('count(*)::integer'))

#387 中详细介绍了大整数作为字符串问题的更优雅的解决方案。

@rhys-vdw global Knex.raw is deprecated, use knex.raw (chain off an initialized knex object) (https://github.com/jfgodoy/knex-postgis/issues/20)

我相应地更新了它,使用knex-postgis https://github.com/jfgodoy/knex-postgis/issues/20#issuecomment -312404336

现在查询: .select(st.asText('count(*)::integer'))
显示: column "count(*)::integer" does not exist

使用:
[email protected]
[email protected]
[email protected]

@sagidM knex.raw肯定存在。 您只需要从配置的 knex 实例调用它,而不是从require('knex').raw调用它。 关于knex-postgis你应该在别处问。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

rarkins picture rarkins  ·  3评论

mattgrande picture mattgrande  ·  3评论

mtom55 picture mtom55  ·  3评论

saurabhghewari picture saurabhghewari  ·  3评论

ghost picture ghost  ·  3评论