You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like maxBy has an issue. Unlike minBy, it requires a Numeric[T] constraint, which is inconsistent and unnecessary.
packagescalasql.operationsclassAggOps[T](v: Aggregatable[T])(...){
defminBy[V:TypeMapper] ...
//it seams that none of those functions need Numeric! defmaxBy[V:Numeric:TypeMapper] ...
defminByOpt[V:Numeric:TypeMapper] ...
defmaxByOpt[V:Numeric:TypeMapper] ...
}
Minified example that shows compilation error:
//>usingdepcom.lihaoyi::scalasql:0.1.11importscalasql._, SqliteDialect._importjava.time.Instant// Define your table model classes//>usingdepcom.lihaoyi::scalasql:0.1.11caseclassCity[T[_]](
id: T[Int],
name: T[String],
createdAt: T[Instant],
)
objectCityextendsTable[City]
//uncomment to fix compilationimplicitvalops:Numeric[Instant] =nulldefgetCities() =City.select
.maxBy(_.createdAt) //<---- [error] implicit Ordering defined for java.time.Instant.
Not sure why we get Ordering issue:
[error] No implicit Ordering defined for java.time.Instant.
[error] .maxBy(_.createdAt)
It seems like
maxBy
has an issue. UnlikeminBy
, it requires aNumeric[T]
constraint, which is inconsistent and unnecessary.Minified example that shows compilation error:
Not sure why we get Ordering issue:
Discord question that exposed it:
https://discord.com/channels/632150470000902164/940067748103487558/1309464062014525451
Complete code that runs queries
The text was updated successfully, but these errors were encountered: