Jukka Tawast
Jukka Tawast
DTDrizzle Team
Created by Ayaz on 9/2/2023 in #help
Help with types in Repository Pattern
Well exercise it was indeed. And I lost 😄 But indeed you kinda have to learn quite a lot of a library when you're trying to do generic stuff...
55 replies
DTDrizzle Team
Created by Ayaz on 9/2/2023 in #help
Help with types in Repository Pattern
Yeah, I do see what you mean. Personally I wasn't even planning to use the repositories for the more difficult queries/stuff for the reasons you just wrote, which in turn would make them kinda unnecessary I guess
55 replies
DTDrizzle Team
Created by Ayaz on 9/2/2023 in #help
Help with types in Repository Pattern
Did you manage to do this in a way that would allow to pass columns as a parameter for select() and the types for the returned rows for find/findAll would be correct? I got it to a point where all the real db columns were right but it was missing the "virtual" ones. So
db.select({
id: table.id,
madeUpFoo: sql<string>`lower(${table.bar})`
})...
db.select({
id: table.id,
madeUpFoo: sql<string>`lower(${table.bar})`
})...
was missing the madeUpFoo from the return type.
55 replies