Skip to content
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

Add typo with custom types #426

Closed
wants to merge 13 commits into from
Closed

Add typo with custom types #426

wants to merge 13 commits into from

Conversation

KapStorm
Copy link
Contributor

@KapStorm KapStorm commented Sep 20, 2023

Added SQL DSL files from Typo to replace our DAOs
Typo docs https://oyvindberg.github.io/typo/docs/

@github-actions
Copy link

Preview ready at https://add-typo.sssppa.wiringbits.dev

Powered by https://codepreview.io community edition.

@KapStorm KapStorm requested a review from AlexITC September 20, 2023 01:19
@github-actions
Copy link

Preview ready at https://add-typo.sssppa.wiringbits.dev

Powered by https://codepreview.io community edition.

build.sbt Outdated
@@ -37,7 +38,7 @@ lazy val commonSettings: Project => Project = {
Wart.IsInstanceOf,
Wart.JavaConversions,
// Wart.JavaSerializable,
Wart.MutableDataStructures,
// Wart.MutableDataStructures,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can suppress warts for typo-generated sources, see (https://www.wartremover.org/doc/install-setup.html).

It seems this is the way wartremoverExcluded += baseDirectory.value / "src" / "main" / "scala" / "SomeFile.scala"

@@ -20,4 +21,21 @@ object Email extends WrappedString.Companion[Email] {
}

override def trusted(string: String): Email = new Email(string)

implicit val emailColumn: Column[Email] = Column.nonNull[Email] { (value, _) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the reason to do this is because Typo picks these models and expects the Column definition to be available.

Let's try adding all these definitions into the typo project, we can use the scala-cli script to import these into each generated source.

@github-actions
Copy link

Preview ready at https://add-typo.sssppa.wiringbits.dev

Powered by https://codepreview.io community edition.

@github-actions
Copy link

Preview ready at https://add-typo.sssppa.wiringbits.dev

Powered by https://codepreview.io community edition.

1 similar comment
@github-actions
Copy link

Preview ready at https://add-typo.sssppa.wiringbits.dev

Powered by https://codepreview.io community edition.

@@ -19,5 +21,7 @@ object Email extends WrappedString.Companion[Email] {
}
}

override def trusted(string: String): Email = new Email(string)
implicit override def trusted(string: String): Email = new Email(string)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid implicit conversions

override def trusted(string: String): Email = new Email(string)
implicit override def trusted(string: String): Email = new Email(string)

implicit val sqlType: String = "CITEXT"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make much sense to me, can we write it somewhere else? the typo layer would be ideal

@AlexITC
Copy link
Contributor

AlexITC commented Oct 4, 2023

See #424

@AlexITC AlexITC closed this Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants