Skip to content

Commit bb16ca1

Browse files
committed
Fix missing asAlias
1 parent c2b0771 commit bb16ca1

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Expressions.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ internal fun exprToValue(expr: Expr): Value {
4949

5050
interface Projectable
5151

52+
internal class ExprWithAlias internal constructor(val alias: String, val expr: Expr) : Projectable
53+
5254
interface Expr {
5355
// Infix functions returning Function subclasses
5456
infix fun equal(other: Expr) = Equal(this, other)
@@ -143,6 +145,10 @@ interface Expr {
143145
fun descending(): Ordering {
144146
return Ordering(this, Direction.DESCENDING)
145147
}
148+
149+
fun asAlias(alias: String): Projectable {
150+
return ExprWithAlias(alias, this)
151+
}
146152
}
147153

148154
// Convenient class for internal usage

google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Stages.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,15 @@ internal constructor(
104104
}
105105
}
106106

107-
class FindNearestOptions(val limit: Long, val output: Field? = null) {
107+
class FindNearestOptions internal constructor(
108+
val limit: Long,
109+
val distanceMeasure: DistanceMeasure,
110+
val output: Field? = null
111+
) {
108112
companion object {
109113
@JvmStatic
110-
fun newInstance(limit: Long, output: Field? = null) = FindNearestOptions(limit, output)
114+
fun newInstance(limit: Long, distanceMeasure: DistanceMeasure, output: Field? = null) =
115+
FindNearestOptions(limit, distanceMeasure, output)
111116
}
112117
}
113118
}

0 commit comments

Comments
 (0)