@@ -33,9 +33,7 @@ import kotlinx.coroutines.flow.drop
33
33
import kotlinx.coroutines.flow.emptyFlow
34
34
import kotlinx.coroutines.flow.filter
35
35
import kotlinx.coroutines.flow.flow
36
- import kotlinx.coroutines.flow.forEach
37
36
import kotlinx.coroutines.flow.map
38
- import kotlinx.coroutines.flow.skip
39
37
import kotlinx.coroutines.flow.take
40
38
import kotlinx.coroutines.flow.toList
41
39
@@ -54,7 +52,7 @@ sealed class Stage<T : Stage<T>>(
54
52
55
53
internal abstract fun self (options : InternalOptions ): T
56
54
57
- protected fun with (key : String , value : Value ): T = self(options.with (key, value))
55
+ protected fun withOption (key : String , value : Value ): T = self(options.with (key, value))
58
56
59
57
/* *
60
58
* Specify named [String] parameter
@@ -63,7 +61,7 @@ sealed class Stage<T : Stage<T>>(
63
61
* @param value The [String] value of parameter
64
62
* @return New stage with named parameter.
65
63
*/
66
- fun with (key : String , value : String ): T = with (key, Values .encodeValue(value))
64
+ fun withOption (key : String , value : String ): T = withOption (key, Values .encodeValue(value))
67
65
68
66
/* *
69
67
* Specify named [Boolean] parameter
@@ -72,7 +70,7 @@ sealed class Stage<T : Stage<T>>(
72
70
* @param value The [Boolean] value of parameter
73
71
* @return New stage with named parameter.
74
72
*/
75
- fun with (key : String , value : Boolean ): T = with (key, Values .encodeValue(value))
73
+ fun withOption (key : String , value : Boolean ): T = withOption (key, Values .encodeValue(value))
76
74
77
75
/* *
78
76
* Specify named [Long] parameter
@@ -81,7 +79,7 @@ sealed class Stage<T : Stage<T>>(
81
79
* @param value The [Long] value of parameter
82
80
* @return New stage with named parameter.
83
81
*/
84
- fun with (key : String , value : Long ): T = with (key, Values .encodeValue(value))
82
+ fun withOption (key : String , value : Long ): T = withOption (key, Values .encodeValue(value))
85
83
86
84
/* *
87
85
* Specify named [Double] parameter
@@ -90,7 +88,7 @@ sealed class Stage<T : Stage<T>>(
90
88
* @param value The [Double] value of parameter
91
89
* @return New stage with named parameter.
92
90
*/
93
- fun with (key : String , value : Double ): T = with (key, Values .encodeValue(value))
91
+ fun withOption (key : String , value : Double ): T = withOption (key, Values .encodeValue(value))
94
92
95
93
/* *
96
94
* Specify named [Field] parameter
@@ -99,7 +97,7 @@ sealed class Stage<T : Stage<T>>(
99
97
* @param value The [Field] value of parameter
100
98
* @return New stage with named parameter.
101
99
*/
102
- fun with (key : String , value : Field ): T = with (key, value.toProto())
100
+ fun withOption (key : String , value : Field ): T = withOption (key, value.toProto())
103
101
104
102
internal open fun evaluate (
105
103
context : EvaluationContext ,
@@ -232,7 +230,7 @@ internal constructor(
232
230
}
233
231
}
234
232
235
- fun withForceIndex (value : String ) = with (" force_index" , value)
233
+ fun withForceIndex (value : String ) = withOption (" force_index" , value)
236
234
237
235
override fun evaluate (
238
236
context : EvaluationContext ,
@@ -276,7 +274,7 @@ private constructor(private val collectionId: String, options: InternalOptions)
276
274
}
277
275
}
278
276
279
- fun withForceIndex (value : String ) = with (" force_index" , value)
277
+ fun withForceIndex (value : String ) = withOption (" force_index" , value)
280
278
}
281
279
282
280
internal class DocumentsSource
@@ -508,7 +506,7 @@ internal constructor(
508
506
* @param limit must be a positive integer.
509
507
* @return [FindNearestStage] with specified [limit].
510
508
*/
511
- fun withLimit (limit : Long ): FindNearestStage = with (" limit" , limit)
509
+ fun withLimit (limit : Long ): FindNearestStage = withOption (" limit" , limit)
512
510
513
511
/* *
514
512
* Add a field containing the distance to the result.
@@ -517,7 +515,7 @@ internal constructor(
517
515
* @return [FindNearestStage] with specified [distanceField].
518
516
*/
519
517
fun withDistanceField (distanceField : Field ): FindNearestStage =
520
- with (" distance_field" , distanceField)
518
+ withOption (" distance_field" , distanceField)
521
519
522
520
/* *
523
521
* Add a field containing the distance to the result.
@@ -825,5 +823,5 @@ internal constructor(
825
823
* @param indexField The field name of index field.
826
824
* @return [SampleStage] that includes specified index field.
827
825
*/
828
- fun withIndexField (indexField : String ): UnnestStage = with (" index_field" , indexField)
826
+ fun withIndexField (indexField : String ): UnnestStage = withOption (" index_field" , indexField)
829
827
}
0 commit comments