Unknown syntax sql-string
Answered
Sun bear posted this in #help-forum
Sun bearOP
Hi, I saw the following code in the nextjs tutorial and I don't understand what it's doing (having sql next to a string). What does it do, and is it from JavaScript or TypeScript?
const invoiceCountPromise = sql
const invoiceCountPromise = sql
SELECT COUNT(*) FROM invoices;Answered by Morelet’s Crocodile
sql is a "template tag".https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
It's probably from the vercel postgres SDK. https://vercel.com/docs/storage/vercel-postgres/sdk
3 Replies
Morelet’s Crocodile
sql is a "template tag".https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
It's probably from the vercel postgres SDK. https://vercel.com/docs/storage/vercel-postgres/sdk
Answer
Sun bearOP
@Morelet’s Crocodile Do you know how to mark this post as answered?
Morelet’s Crocodile
no idea!