-
Notifications
You must be signed in to change notification settings - Fork 18
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
chore: Make Sql.Interpolation backwards compatible #514
Conversation
* used in other projects that we don't want to break
@@ -1,8 +1,4 @@ | |||
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.persistence.r2dbc.R2dbcSettings.this") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the file should be latest release, 1.2.1, not 1.2.2
* interpolation arguments `$` can be used. | ||
*/ | ||
@InternalApi private[akka] implicit class InterpolationWithAdapter(val sc: StringContext)(implicit | ||
adapter: QueryAdapter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QueryAdapter
is private[akka]
and therefore I think the InterpolationWithAdapter
should also be private[akka]
, otherwise we should also make QueryAdapter public (InternalStableApi)
Note that this is AnyRef
because of two parameters, instead of AnyVal
. I'm not sure this idea with the adapter is worth the indirect complexity it adds. Doesn't we override all sql for sqlserver anyway in the SqlServerDao classes? Those could use @
as the placeholder instead of ?
and then we could change the ordinary fillInParameterNumbers
to look for ?
and @
and replace accordingly. I'll might try that in a separate pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, we don't override all sql, which is good. I'll think a little more about this, but this PR can be merged seperately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, we do not override all sql statements, which is why this QueryAdaper was introduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I leave it as this for now. Projections will still be able to use QueryAdapter since it's private[akka]
.
226a9b5
to
6d30fdf
Compare
val queryAdapter: QueryAdapter) { | ||
|
||
// implicits that can be imported | ||
object JournalImplicits { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not seen this very often, objects within a case class. But I guess it is fine. Alternative could be something based on inheritance or so, this this CodecSettings.this.journalPayloadCodec
could be avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodecSettings.this.journalPayloadCodec was just because I used the same names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, the object is only for name scoping
@@ -44,6 +44,7 @@ private[r2dbc] class SqlServerDurableStateDao( | |||
connectionFactory: ConnectionFactory, | |||
dialect: Dialect)(implicit ec: ExecutionContext, system: ActorSystem[_]) | |||
extends PostgresDurableStateDao(settings, connectionFactory, dialect) { | |||
import settings.codecSettings.DurableStateImplicits._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, this means imports within the parent class are not available in the sub-class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a side effect, but I think it's good to be more explicit about the implicits. Can be difficult to understand where they come from otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvement to avoid having to import each coded individually.
Follow up to #505
Sql.Interpolation
is used in other projects that we don't want to break.Also a cleanup of the codec settings.