select count(*)::integer from mytable
knexjs๋ก ์ด๊ฒ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ํํ๋ ๋ฐฉ๋ฒ์ ๋ฌด์์
๋๊น?
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
ํ์คํ ์กด์ฌํฉ๋๋ค. require('knex').raw
์๋ ๊ตฌ์ฑ๋ knex ์ธ์คํด์ค์์ ํธ์ถํ๊ธฐ ๋งํ๋ฉด๋ฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ knex-postgis
๋ ๋ค๋ฅธ ๊ณณ์์ ๋ฌผ์ด๋ด์ผํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํฐ ์ ์์ ๋ํ๋ณด๋ค ์ฐ์ํ ํด๊ฒฐ์ฑ ์ # 387์ ์์ธํ ์ค๋ช ๋์ด ์์ต๋๋ค.