pg-rest-api/src/service/agency-oset-limit.js

17 lines
443 B
JavaScript

const db = require('./db');
const helper = require('../helper');
require('dotenv').config();
async function get(oset = 1,limit = 100) {
const schema = process.env.DB_SCHEMA || 'schema';
const query = 'SELECT * FROM ' + schema + '.agency OFFSET $1 LIMIT $2'
const offset = helper.getOffset(oset, limit);
const rows = await db.query(query, [offset, limit]);
return helper.emptyOrRows(rows);
};
module.exports = {
get
};