Skip to content

Commit

Permalink
make existing code compatible with Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
KuceraMartin committed Jan 4, 2024
1 parent 7ffa5b9 commit a96df75
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scalasql/core/src/SqlStr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object SqlStr {
case (part, null) => part
case (part, param) =>
val jdbcTypeString = param.mappedType.castTypeString
if (castParams) part + s"CAST(? AS $jdbcTypeString)" else part + "?"
if (castParams) part.toString + s"CAST(? AS $jdbcTypeString)" else part.toString + "?"
}
.mkString

Expand Down
2 changes: 1 addition & 1 deletion scalasql/query/src/Delete.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object Delete {
class Renderer(table: TableRef, expr: Expr[Boolean], prevContext: Context) {
lazy val tableNameStr =
SqlStr.raw(prevContext.config.tableNameMapper(Table.name(table.value)))
implicit val implicitCtx = Context.compute(prevContext, Nil, Some(table))
implicit val implicitCtx: Context = Context.compute(prevContext, Nil, Some(table))

def render() = sql"DELETE FROM $tableNameStr WHERE $expr"
}
Expand Down
2 changes: 1 addition & 1 deletion scalasql/query/src/JoinAppend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait JoinAppendLowPriority {
implicit def default[Q, R, Q2, R2](
implicit qr0: Queryable.Row[Q, R],
qr20: Queryable.Row[Q2, R2]
) = new JoinAppend[Q, Q2, (Q, Q2), (R, R2)] {
): JoinAppend[Q, Q2, (Q, Q2), (R, R2)] = new JoinAppend[Q, Q2, (Q, Q2), (R, R2)] {
override def appendTuple(t: Q, v: Q2): (Q, Q2) = (t, v)

def qr: Queryable.Row[(Q, Q2), (R, R2)] = Queryable.Row.Tuple2Queryable
Expand Down
2 changes: 1 addition & 1 deletion scalasql/query/src/Query.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object Query {
override def walkExprs(q: Q) = q.queryWalkExprs()
override def isSingleRow(q: Q) = q.queryIsSingleRow

def renderSql(q: Q, ctx: Context): SqlStr = q.renderSql(ctx)
def renderSql(q: Q, ctx: Context): SqlStr = Renderable.renderSql(q)(ctx)

override def construct(q: Q, args: Queryable.ResultSetIterator): R = q.queryConstruct(args)
}
Expand Down
2 changes: 1 addition & 1 deletion scalasql/query/src/SimpleSelect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ object SimpleSelect {
extends SubqueryRef.Wrapped.Renderer {
lazy val flattenedExpr = query.qr.walkLabelsAndExprs(query.expr)
lazy val froms = query.from ++ query.joins.flatMap(_.from.map(_.from))
implicit lazy val context = Context.compute(prevContext, froms, None)
implicit lazy val context: Context = Context.compute(prevContext, froms, None)

lazy val joinOns =
query.joins.map(_.from.map(_.on.map(t => SqlStr.flatten(Renderable.renderSql(t)))))
Expand Down
2 changes: 1 addition & 1 deletion scalasql/query/src/Update.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object Update {
prevContext: Context
) {
lazy val froms = joins0.flatMap(_.from).map(_.from)
implicit lazy val implicitCtx = Context.compute(prevContext, froms, Some(table))
implicit lazy val implicitCtx: Context = Context.compute(prevContext, froms, Some(table))

lazy val tableName =
SqlStr.raw(implicitCtx.config.tableNameMapper(Table.name(table.value)))
Expand Down
2 changes: 1 addition & 1 deletion scalasql/src/dialects/MySqlDialect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ trait MySqlDialect extends Dialect {

implicit def LateralJoinOpsConv[C[_, _], Q, R](wrapped: JoinOps[C, Q, R] with Joinable[Q, R])(
implicit qr: Queryable.Row[Q, R]
) = new LateralJoinOps(wrapped)
): LateralJoinOps[C, Q, R] = new LateralJoinOps(wrapped)

implicit def ExprAggOpsConv[T](v: Aggregatable[Expr[T]]): operations.ExprAggOps[T] =
new MySqlDialect.ExprAggOps(v)
Expand Down
2 changes: 1 addition & 1 deletion scalasql/src/dialects/PostgresDialect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait PostgresDialect extends Dialect with ReturningDialect with OnConflictOps {

implicit def LateralJoinOpsConv[C[_, _], Q, R](wrapped: JoinOps[C, Q, R] with Joinable[Q, R])(
implicit qr: Queryable.Row[Q, R]
) = new LateralJoinOps(wrapped)
): LateralJoinOps[C, Q, R] = new LateralJoinOps(wrapped)

implicit def ExprAggOpsConv[T](v: Aggregatable[Expr[T]]): operations.ExprAggOps[T] =
new PostgresDialect.ExprAggOps(v)
Expand Down

0 comments on commit a96df75

Please sign in to comment.