-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to turn off the the creation of specific types for primary key fields? #77
Comments
You can use
What's the problem with the primary key types by the way? I consider it such a cool feature to get those for free |
I mean I could expose a better interface for this, similar to |
I feel it adds a lot of unnecessary noise to the code. My app is a simple CRUD app, I am the only developer, and I don't think I am going to trip over myself if I use Int fields instead of value types fields. I know that there are other people that exult the benefits of using specific types and I am not negating those benefits in other contexts. I was wondering if there is an option to turn them off and use plain types. |
as you per your suggestion I used the following setting and I was able to change the scala types of the these fields to Int: import typo.db.RelationName
val rewriteMore = TypeOverride.of {
case (RelationName(Some(schema), tableName), colName) if colName.value.endsWith("_id") => "Int"
} Another question: is it possible to re-map a scala type by sql type name not by sql field name as it is done above? For instance, I want to map Date sql fields to LocalDate in scala and timestampz fields to |
I added the possibility of not generating id types for the relations you specify in #83 .
No, not now. I also want to get rid of the Also note that |
Thank you for the prompt response.
Do you have an example that shows what's wrong? From the little testing i've done the type seems ok. When you say "roundtrip" do you mean: get the value from the db and then save it to the database, and the process of saving removes the TZ from the value? Thanks again! |
Create it in code, persist it to pg and read it back. |
ok, thank you for the explantions! |
Hi,
I have the following table:
Typo generates the following case class & companion object:
Is it possible to turn off the creation of this class and use only a straight Int?
If you can point me to an article that describes this approach in detail, that would be great.
Thanks
The text was updated successfully, but these errors were encountered: