This package contains helper functions that I use almost everyday in my NodeJs Projects. So, I decided to create a package. I hope this helps.
Fundamentally, the functions use Knex and Postgres as Database.
- Provide a connector and a logger
import { ZizoDataAccessor } from 'zizo';
const connector = knexfile('path to knexfile')
const logger = bunyan.createLogger({
name: 'NAME_OF_APP'
});
const database = new Zizo(connecto, logger);
- Check if record exists
await database.recordExists("TABLE_NAME", 'COLUMN', 'VALUE' )