KyselyK
Kysely4w ago
3 replies
UV

How to add a hardcoded value in select query

For example, I wanted to add a hardcoded value that is not a column in the table. How can I do that :
const persons = await db
  .selectFrom('person')
  .select(['first_name', 'hardcoded_value'=1])
  .execute()

so the result for every query will have the same hard-coded value.
{
  id: "John",
  hardcoded_value: 1,
}


I can add that value after the query has executed, but I was wondering if I could do it in 1 step within the select().
Was this page helpful?