Closed KapStorm closed 11 months ago
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Hey I just came across this - very cool :)
I see two things I'm wondering how we should progress with:
I see you added CustomUUID
and CustomInstant
in here, probably to work around for the TypoUUID
classes. is there something in particular wrong with those classes which means you cant use them?
I see you're duplicating anorm types into js. what's the goal here? any thoughts re: my thoughts in https://oyvindberg.github.io/typo/docs/other-features/scala-js-ready/ ?
I see you added CustomUUID and CustomInstant in here, probably to work around for the TypoUUID classes. is there something in particular wrong with those classes which means you cant use them?
It is very likely that our changes were pushed before Typo release covering these custom types.
I see you're duplicating anorm types into js. what's the goal here?
From what I remember, we have a few wrapper objects cross-compiled to sjs, we need to define the implicit ToStatement[_]
value for those, otherwise, Typo code won't compile with our wrappers.
@oyvindberg Given that you are around, are we expected to commit the generated by Typo? i was thinking to leave it at the target/
directory like scalapb does but that would mean that we'd require another step before compiling the app.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
I see you added CustomUUID and CustomInstant in here, probably to work around for the TypoUUID classes. is there something in particular wrong with those classes which means you cant use them?
It is very likely that our changes were pushed before Typo release covering these custom types.
Ok. Let me know if this causes friction. if so we can discuss a path forward
@oyvindberg Given that you are around, are we expected to commit the generated by Typo? i was thinking to leave it at the
target/
directory like scalapb does but that would mean that we'd require another step before compiling the app.
That is left completely open for you to decide. For me personally it makes most sense to check them in so you can track them over time, and speedup the build at the same time.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
Preview ready at https://sql-typo-poc.sssppa.wiringbits.dev
Powered by https://codepreview.io community edition.
I see you added CustomUUID and CustomInstant in here, probably to work around for the TypoUUID classes. is there something in particular wrong with those classes which means you cant use them?
@oyvindberg I got more accurate comments now for this, we are avoiding built-in types because the custom instant/uuid types are exposed to our frontend and we'd prefer to not expose typo values there.
@oyvindberg we ended up deciding not to integrate Typo right now, the main reason being is, given our project structure, Typo doesn't play so smoothly with our scalajs integration, we have typed-models that are cross-compiled to scalajs which we also use from anorm.
I'm still very interested to try again in a few months.
Thanks!
Oh ok, @AlexITC - no worries.
The solution is likely to not expose the database layer to frontend. Create domain types, which often bears some similarity to db objects but are not the same, and enjoy a compiler-checked map
from Row
objects to domain objects 👍
The solution is likely to not expose the database layer to frontend
Its the other way around, we have some core models which are exposed to the db layer, Typo generates some of these but we would like to use the ones we already have, for example: https://github.com/wiringbits/scala-webapp-template/blob/master/lib/common/shared/src/main/scala/net/wiringbits/common/models/Email.scala
PoC using the SQL DSL generator github.com/oyvindberg/typo/