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 ํ™•์‹คํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. require('knex').raw ์•„๋‹Œ ๊ตฌ์„ฑ๋œ knex ์ธ์Šคํ„ด์Šค์—์„œ ํ˜ธ์ถœํ•˜๊ธฐ ๋งŒํ•˜๋ฉด๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  knex-postgis ๋Š” ๋‹ค๋ฅธ ๊ณณ์—์„œ ๋ฌผ์–ด๋ด์•ผํ•ฉ๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰