SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export class KnexStorageWriter implements IStorageWriter {
  2.     private knex: Knex;
  3.     constructor(knex: Knex) {
  4.         this.knex = knex;
  5.     }
  6.  
  7.     insert = async (tableName: string, data: any, id: string = 'id') => {
  8.         const [result] = await this.knex(tableName).insert(data, [id]);
  9.         return {
  10.             ...result,
  11.             ...data,
  12.         };
  13.     };
  14. }
  15.  
  16. const knex = configureKnex();
  17. const storage = new KnexStorageWriter(knex);
  18. const dbSeeder = new DbSeeder(storage);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top