Drizzle type question
I swapped over to Drizzle, and I've got this schema right
And I'm trying to get a session based on an id coming from the client
This seems right, right?
But why in the world is the type of session an array consisting of an object with a users and sessions prop?
5 Replies
To use this I'd have to do this
session.at(0)?.sessions
session.at(0)?.users
Which seems like an odd thingIt's called session because you called the cost session. Just switch to cost data and then it's data.session and data.users
Or you can do a spread operator in the select()
select({
...session,
users: users
})
Solution
And limit 1 still returns an array btw. So you have to do data[0].sessions
If I want one of something, I usually write it like this:
Thx