The cross-database ORM that powers falcon
Requires node >= 8
and npm >= 5
npm install falcon-core --save
import path from 'path';
import { db, config } from 'falcon-core';
const serverInfo = {
database: path.join(__dirname, 'demo.sqlite'),
client: 'sqlite'
};
async function main() {
const serverSession = db.createServer(serverInfo);
const connection = await serverSession.createConnection('demo.sqlite');
await connection.connect(serverInfo);
// Connection APIs
console.log(await connection.getTableSelectScript('albums'));
console.log(await connection.listTables());
console.log(await connection.listDatabases());
console.log(await connection.getTableColumns('albums'));
console.log(await connection.getTableValues('albums'));
// Export API's
console.log(await connection.exportJson('./tmp.json', {
table: 'users'
}));
}
main();