Skip to content

Commit 146dc4b

Browse files
authored
fix: remove uneeded Numeric constraint (#47)
fixes #46 ![image](https://github.com/user-attachments/assets/97cd7ec1-f2f8-46cb-a535-26eada352aff) ## Side note ![image](https://github.com/user-attachments/assets/3fc765b7-42e2-4883-944a-0bfb4eb300c3) some of these implicit `qr`s aren't used; could've removed it but kept because it might break existing functions that passed them explicitly
1 parent a7a601c commit 146dc4b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scalasql/operations/src/AggOps.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AggOps[T](v: Aggregatable[T])(implicit qr: Queryable.Row[T, ?], dialect: D
1212
def size: Expr[Int] = v.aggregateExpr(_ => _ => sql"COUNT(1)")
1313

1414
/** Computes the sum of column values */
15-
def sumBy[V: Numeric: TypeMapper](f: T => Expr[V])(
15+
def sumBy[V: TypeMapper](f: T => Expr[V])(
1616
implicit qr: Queryable.Row[Expr[V], V]
1717
): Expr[V] = v.aggregateExpr(expr => implicit ctx => sql"SUM(${f(expr)})")
1818

@@ -22,32 +22,32 @@ class AggOps[T](v: Aggregatable[T])(implicit qr: Queryable.Row[T, ?], dialect: D
2222
): Expr[V] = v.aggregateExpr(expr => implicit ctx => sql"MIN(${f(expr)})")
2323

2424
/** Finds the maximum value in a column */
25-
def maxBy[V: Numeric: TypeMapper](f: T => Expr[V])(
25+
def maxBy[V: TypeMapper](f: T => Expr[V])(
2626
implicit qr: Queryable.Row[Expr[V], V]
2727
): Expr[V] = v.aggregateExpr(expr => implicit ctx => sql"MAX(${f(expr)})")
2828

2929
/** Computes the average value of a column */
30-
def avgBy[V: Numeric: TypeMapper](f: T => Expr[V])(
30+
def avgBy[V: TypeMapper](f: T => Expr[V])(
3131
implicit qr: Queryable.Row[Expr[V], V]
3232
): Expr[V] = v.aggregateExpr(expr => implicit ctx => sql"AVG(${f(expr)})")
3333

3434
/** Computes the sum of column values */
35-
def sumByOpt[V: Numeric: TypeMapper](f: T => Expr[V])(
35+
def sumByOpt[V: TypeMapper](f: T => Expr[V])(
3636
implicit qr: Queryable.Row[Expr[V], V]
3737
): Expr[Option[V]] = v.aggregateExpr(expr => implicit ctx => sql"SUM(${f(expr)})")
3838

3939
/** Finds the minimum value in a column */
40-
def minByOpt[V: Numeric: TypeMapper](f: T => Expr[V])(
40+
def minByOpt[V: TypeMapper](f: T => Expr[V])(
4141
implicit qr: Queryable.Row[Expr[V], V]
4242
): Expr[Option[V]] = v.aggregateExpr(expr => implicit ctx => sql"MIN(${f(expr)})")
4343

4444
/** Finds the maximum value in a column */
45-
def maxByOpt[V: Numeric: TypeMapper](f: T => Expr[V])(
45+
def maxByOpt[V: TypeMapper](f: T => Expr[V])(
4646
implicit qr: Queryable.Row[Expr[V], V]
4747
): Expr[Option[V]] = v.aggregateExpr(expr => implicit ctx => sql"MAX(${f(expr)})")
4848

4949
/** Computes the average value of a column */
50-
def avgByOpt[V: Numeric: TypeMapper](f: T => Expr[V])(
50+
def avgByOpt[V: TypeMapper](f: T => Expr[V])(
5151
implicit qr: Queryable.Row[Expr[V], V]
5252
): Expr[Option[V]] = v.aggregateExpr(expr => implicit ctx => sql"AVG(${f(expr)})")
5353

0 commit comments

Comments
 (0)