oyvindberg / typo

Typed Postgresql integration for Scala. Hopes to avoid typos
https://oyvindberg.github.io/typo/
MIT License
99 stars 9 forks source link

selectByUnique only selects input column #84

Closed sbrunk closed 6 months ago

sbrunk commented 6 months ago

I just stumbled upon an error when using selectByUnique, which promises to return the full row in the type signature, but only selects the input column in the generated SQL.

You can see that in the Users example:

https://github.com/oyvindberg/typo/blob/53539fa8205327828958748dbd00b78e13bf6813/typo-tester-doobie/generated-and-checked-in/adventureworks/public/users/UsersRepoImpl.scala#L86-L91

selectById in comparison selects the full row as expected:

https://github.com/oyvindberg/typo/blob/53539fa8205327828958748dbd00b78e13bf6813/typo-tester-doobie/generated-and-checked-in/adventureworks/public/users/UsersRepoImpl.scala#L80-L82

oyvindberg commented 6 months ago

Great catch! These unique things haven't been prioritized or used much (as you can tell), but I hope to build very cool things with indices and foreign keys eventually.

The fix should be very easy, I'll get to it in a day or two :)