Suleyman
Suleyman
Explore posts from servers
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
@Angelelz I'm sorry, but i have a question again.
{
prepared_by: sql`mails.organization_prepared_by`.mapWith(async function (value) {
return {
id: value,
}
}) as unknown as SQL<{
id: string,
}>,
{
prepared_by: sql`mails.organization_prepared_by`.mapWith(async function (value) {
return {
id: value,
}
}) as unknown as SQL<{
id: string,
}>,
sometimes i need to call async function for relations, but sql doesn't support async. is that have solution?
18 replies
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
Thanks @Angelelz! I worked finally Thanks a lot!
18 replies
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
No, its and just javascript function
18 replies
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
const [action] = await this.drizzle.db
.select(
{
id: encode(tasks.id) as string,
body: tasks.body,
created_at: tasks.createdAt,
finishes_at: tasks.finishesAt,
is_read: tasks.isRead,
mail_id: tasks.mailId,
read_at: tasks.readAt,
recipient: {
id: users.id,
username: users.username,
avatar: users.avatar,
name: users.name,
surname: users.surname,
},
recipient_id: tasks.recipientId,
sender_id: tasks.senderId,
updated_at: tasks.updatedAt,
uid: users.id
}
)
.from(tasks)
.innerJoin(users, eq(tasks.recipientId, users.id))
.where(eq(tasks.id, request.id));
const [action] = await this.drizzle.db
.select(
{
id: encode(tasks.id) as string,
body: tasks.body,
created_at: tasks.createdAt,
finishes_at: tasks.finishesAt,
is_read: tasks.isRead,
mail_id: tasks.mailId,
read_at: tasks.readAt,
recipient: {
id: users.id,
username: users.username,
avatar: users.avatar,
name: users.name,
surname: users.surname,
},
recipient_id: tasks.recipientId,
sender_id: tasks.senderId,
updated_at: tasks.updatedAt,
uid: users.id
}
)
.from(tasks)
.innerJoin(users, eq(tasks.recipientId, users.id))
.where(eq(tasks.id, request.id));
full code
18 replies
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
ok, how to solve this problem
18 replies
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
db.select({
id: users.id,
isOnline: true, // <- without sql``
})
.from(users);
db.select({
id: users.id,
isOnline: true, // <- without sql``
})
.from(users);
like this
18 replies
DTDrizzle Team
Created by Suleyman on 12/16/2023 in #help
How to add external data in select
Hello @solo , My question is is that way has to define data without sql or schema
18 replies
DTDrizzle Team
Created by Suleyman on 12/14/2023 in #help
Nest.js mysql connection type like PostgreSQL
Thanks @solo
4 replies