Skip to content

Commit

Permalink
Fix missing asAlias
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hui committed May 21, 2024
1 parent c2b0771 commit bb16ca1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ internal fun exprToValue(expr: Expr): Value {

interface Projectable

internal class ExprWithAlias internal constructor(val alias: String, val expr: Expr) : Projectable

interface Expr {
// Infix functions returning Function subclasses
infix fun equal(other: Expr) = Equal(this, other)
Expand Down Expand Up @@ -143,6 +145,10 @@ interface Expr {
fun descending(): Ordering {
return Ordering(this, Direction.DESCENDING)
}

fun asAlias(alias: String): Projectable {
return ExprWithAlias(alias, this)
}
}

// Convenient class for internal usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@ internal constructor(
}
}

class FindNearestOptions(val limit: Long, val output: Field? = null) {
class FindNearestOptions internal constructor(
val limit: Long,
val distanceMeasure: DistanceMeasure,
val output: Field? = null
) {
companion object {
@JvmStatic
fun newInstance(limit: Long, output: Field? = null) = FindNearestOptions(limit, output)
fun newInstance(limit: Long, distanceMeasure: DistanceMeasure, output: Field? = null) =
FindNearestOptions(limit, distanceMeasure, output)
}
}
}
Expand Down

0 comments on commit bb16ca1

Please sign in to comment.