db-json-column
v0.0.3
Published
JSON column support for Knex and TypeORM
Downloads
3
Readme
db-json-column
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'])