I was wondering about a feature in Ktor/Exposed :slightly_smiling_face: Assume i got a table ```ID |...
j
I was wondering about a feature in Ktor/Exposed 🙂 Assume i got a table
Copy code
ID | User | value
1  |  1   | value1
2  |  1   | value2
3  |  2   | value3
In other ORM frameworks, if I want to extract only values from user=1, I could create a DB session and use 
Values.all()
 and it'll fetch only [value1, value2] I don't want to fetch via 
Values.select { Values.user eq user }
🤦‍♂️ 1
b
I wonder how the framework should understand that you only need to filter by user = 1?
j
DB sessions?
b
the session does not say anything about the limitations of data fetching, give an example of an ORM where it is possible
👍 1
j
@Bogdan so how would you address something like that? query all models with
modelX.user eq user
?
b
if all values of all users are used then
Values.all ()
is used. If you need to unload all values for a specific user, then use
Values.user eq userId
PS: this is DSL syntax, to use ORM you need to look at DAO section
d
You could always make some kind of variable saving the user id (maybe saved in the thread), and implement your own all() that uses that variable to limit the request... But I personally don't like global vars...