Guest User

Untitled

a guest
Mar 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. 'use strict'
  2.  
  3. const pg = require('pg');
  4. const connection = "postgres://lado:1@localhost:5432/public.account";
  5.  
  6. const client = new pg.Client(connection);
  7. client.connect();
  8. //const queryy = client.query('SELECT * FROM public.account');
  9. //queryy.on('end', () => {client.end(); });
  10.  
  11. //await client.connect();
  12. const res = client.query("SELECT * FROM account", function(err, rows, fileds) {
  13. rows.forEach(async function(row) {
  14. console.log(row.name);
  15. })
  16. console.log('Finish');
  17. });
  18.  
  19. //res.rows.forEach(row=>{
  20. // console.log(row);
  21. //});
  22.  
  23. //res.forEach(function(row){
  24. // console.log(row);
  25. //});
  26. const func = ms => new Promise(res => setTimeout(res, ms));
  27. console.dir({func});
  28. console.dir(res);
  29. client.end();
Add Comment
Please, Sign In to add comment