-
Notifications
You must be signed in to change notification settings - Fork 0
Column(s)
Christoph Herrmann edited this page Nov 21, 2019
·
3 revisions
const columns = ['id', 'email']
const result = await sql.query(sql`
SELECT ${sql.columns(columns)} FROM "users"
`)
// text: SELECT "id", "email" FROM "users"
// values: []If the parameter is an object (e.g. a user) the keys of the object will be used:
const user = { id: 'id', email: 'email' }
const result = await sql.query(sql`
SELECT ${sql.columns(user)} FROM users
`)
// text: SELECT "id", "email" FROM "users"
// values: []A column can also be a Tag Helper, which is used to support JSON Columns.
Found a bug or missing a feature? -> Create a new Issue
Found a security issue? -> Look at the Security Policy
Having questions, want to give feedback or talk to me? -> E-Mail me sql-pg@sharaal.de