0.0.3 • Published 2 years ago

db-json-column v0.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

db-json-column image test

If you need to query JSON columns with your Query Builder and Connection Pool without writing raw SQL, this package is for you.

Knex example

await updateJson(knex, knex(tableName).where('id', 1), ['data.foo'], { data: { foo: 'bar' } })

// { data: { foo: 'bar' } }
await selectAndParseJson(knex, knex(tableName), ['data.foo'])

TypeORM example

await updateJson(
  repository.createQueryBuilder().update().where({ id: 1 }),
  ['data.foo'],
  { data: { foo: 'bar' } },
)

// { data: { foo: 'bar' } }
await selectAndParseJson(repository.createQueryBuilder(), ['data.foo'])

Table of contents