KeyWriter

object KeyWriter

KeyWriter factories

Companion:
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[T](write: T => String): KeyWriter[T]

Creates a KeyWriter based on the given write function.

Creates a KeyWriter based on the given write function.

def from[T](writeTry: T => Try[String]): KeyWriter[T]

Creates a KeyWriter based on the given writeTry function.

Creates a KeyWriter based on the given writeTry function.

Implicits

Implicits

implicit def keyWriter[T](implicit conv: T => String): KeyWriter[T]

Provides a KeyWriter instance of any T type that can be viewed as a String.

Provides a KeyWriter instance of any T type that can be viewed as a String.

implicit def localeWriter: KeyWriter[Locale]

Supports writing locales as keys, using language tag as string representation.

Supports writing locales as keys, using language tag as string representation.

import reactivemongo.api.bson.KeyWriter

implicitly[KeyWriter[java.util.Locale]].writeTry(java.util.Locale.FRANCE)
// => Success("fr-FR")
implicit def uuidWriter: KeyWriter[UUID]

Supports writing UUID as keys.

Supports writing UUID as keys.

import reactivemongo.api.bson.KeyWriter

implicitly[KeyWriter[java.util.UUID]].writeTry(
 java.util.UUID fromString "BDE87A8B-52F6-4345-9BCE-A30F4CB9FCB4")
// => Success("BDE87A8B-52F6-4345-9BCE-A30F4CB9FCB4")

Inherited implicits

implicit def anyValKeyWriter[T <: AnyVal]: KeyWriter[T]
Inherited from:
LowPriorityKeyWriter