Нарбек
Нарбек
DTDrizzle Team
Created by Нарбек on 6/27/2024 in #help
How to combine 'union' and 'orderBy'
👍
9 replies
DTDrizzle Team
Created by Нарбек on 6/27/2024 in #help
How to combine 'union' and 'orderBy'
so i've used sort method anyway. It's gonna block the event loop i guess
9 replies
DTDrizzle Team
Created by Нарбек on 6/27/2024 in #help
How to combine 'union' and 'orderBy'
I had to make completely different set of requests as a workaround. No idea how to use aliases to get it work(
9 replies
DTDrizzle Team
Created by Нарбек on 2/23/2024 in #help
Long names for relations are not supported?
2 replies
DTDrizzle Team
Created by Mike Borozdin on 2/22/2024 in #help
How do I use `where` inside `with`?
@Mike Borozdin @subrahmanyamv
4 replies
DTDrizzle Team
Created by Mike Borozdin on 2/22/2024 in #help
How do I use `where` inside `with`?
if you define the relation as "one" try this
await db.query.posts.findMany({
where: inArray(
posts.id,
await db.query.comments.findMany({
where: eq(comments.someColumn, 'val'),
columns: { id: true },
}).map(comment => comment.id)
),
with: {
comments: true,
},
});
await db.query.posts.findMany({
where: inArray(
posts.id,
await db.query.comments.findMany({
where: eq(comments.someColumn, 'val'),
columns: { id: true },
}).map(comment => comment.id)
),
with: {
comments: true,
},
});
4 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
thanks
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
I've used concat and raw ILIKE command but it doesn't work. Could you show working example of this kind of filtering please?
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
All method constructs the objects right? Will it be impemented for postgresql?
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
orm syntax combines foreign rows into an array, but query builder syntax doesn't and thats why i needed all() method
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
@solo
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
i can't use ORM syntax because of this:
db.query.orders.findMany({
where: and(
ilike(
sql`${users.lastname} || ${users.firstname} || ${users.surname}` as any,
`%Alan%`
)
),
with: {
users: true,
},
})
db.query.orders.findMany({
where: and(
ilike(
sql`${users.lastname} || ${users.firstname} || ${users.surname}` as any,
`%Alan%`
)
),
with: {
users: true,
},
})
this filtering works when i use query builder syntax, but it doesn't when i use ORM syntax
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
for example.
const data = await db
.select()
.from(users)
.leftJoin(orders, eq(orders.userId, users.id))
.all()
const data = await db
.select()
.from(users)
.leftJoin(orders, eq(orders.userId, users.id))
.all()
It's just an example. I can't use ORM syntax in my case
15 replies
DTDrizzle Team
Created by Нарбек on 1/11/2024 in #help
all property
so there is no way to combine multiple foreign rows into an array?
15 replies