Skip to content

Instantly share code, notes, and snippets.

@asror797
Last active February 17, 2024 14:43
Show Gist options
  • Save asror797/7cc9c407890c4b7835e1cedecb915e25 to your computer and use it in GitHub Desktop.
Save asror797/7cc9c407890c4b7835e1cedecb915e25 to your computer and use it in GitHub Desktop.
Fetch data client function for SQL queries
const Fetch = async(SQL, ...params) => {
try {
const client = await pool.connect()
const { rows } = await client.query(SQL,params.length ? params : null)
return rows
} finally {
client.release()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment