db dsl tweaks

local-config
Thibault Duplessis 2020-06-24 11:36:35 +02:00
parent 56eb2c969b
commit 0f3f60d333
2 changed files with 4 additions and 8 deletions

View File

@ -11,7 +11,7 @@ import lila.common.{ EmailAddress, IpAddress, Iso, NormalizedEmailAddress }
trait Handlers {
implicit val BSONJodaDateTimeHandler = dsl.quickHandler[DateTime](
implicit val BSONJodaDateTimeHandler = quickHandler[DateTime](
{ case v: BSONDateTime => new DateTime(v.value) },
v => BSONDateTime(v.getMillis)
)
@ -73,7 +73,7 @@ trait Handlers {
}
def handlerBadType[T](b: BSONValue): Try[T] =
Failure(TypeDoesNotMatchException("BSONBinary", b.getClass.getSimpleName))
Failure(TypeDoesNotMatchException("BSONValue", b.getClass.getSimpleName))
def handlerBadValue[T](msg: String): Try[T] =
Failure(new IllegalArgumentException(msg))

View File

@ -133,7 +133,7 @@ trait dsl {
/** Matches values that are greater than or equal to the value specified in the query. */
def $gte[T: BSONWriter](value: T) = $doc("$gte" -> value)
/** Matches any of the values that exist in an array specified in the query.*/
/** Matches any of the values that exist in an array specified in the query. */
def $in[T: BSONWriter](values: T*) = $doc("$in" -> values)
/** Matches values that are less than the value specified in the query. */
@ -171,9 +171,6 @@ trait dsl {
}
}
def $currentDate(items: (String, CurrentDateValueProducer[_])*): Bdoc =
$doc("$currentDate" -> $doc(items.map(item => (item._1, item._2.produce))))
// End of Top Level Field Update Operators
//**********************************************************************************************//
@ -245,7 +242,6 @@ trait dsl {
* "age" $gt 50 $lt 60
* "age" $gte 50 $lte 60
* }}}
*
*/
case class CompositeExpression(field: String, value: Bdoc)
extends Expression[Bdoc]
@ -272,7 +268,7 @@ trait dsl {
CompositeExpression(field, append($doc("$gte" -> value)))
}
/** Matches any of the values that exist in an array specified in the query.*/
/** Matches any of the values that exist in an array specified in the query. */
def $in[T: BSONWriter](values: Iterable[T]): SimpleExpression[Bdoc] = {
SimpleExpression(field, $doc("$in" -> values))
}