DT
Drizzle Team•12mo ago
Slinger

Select * with an alteration TO_CHAR

I could not find something similar and better ask (sorry if was previously answered) It's there a way to select all the rows and without specifying all of them and also muttating a value in a simple way? For example select('*', {...}) I can write the query but just curious 😬
await db.select({ formatted: sql<string>`to_char(timestamp, 'DD Month YYYY')` }).from(data);
await db.select({ formatted: sql<string>`to_char(timestamp, 'DD Month YYYY')` }).from(data);
2 Replies
Angelelz
Angelelz•12mo ago
You could do:
db.select({
...getTableColumns(users),
formatted: sql<string>`to_char(timestamp, 'DD Month YYYY')`
})
.from(users)
db.select({
...getTableColumns(users),
formatted: sql<string>`to_char(timestamp, 'DD Month YYYY')`
})
.from(users)
import { getTableColumns } from "drizzle-orm";
Slinger
Slinger•12mo ago
Yes! that's exactly what I was searching, thx 😄
Want results from more Discord servers?
Add your server