Last active
February 17, 2024 14:43
-
-
Save asror797/7cc9c407890c4b7835e1cedecb915e25 to your computer and use it in GitHub Desktop.
Fetch data client function for SQL queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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