given_BSONDocumentWriter_MySignedPrismEvent

fmgp.did.method.prism.mongo.DataModels.given_BSONDocumentWriter_MySignedPrismEvent

Attributes

Graph
Supertypes
trait BSONDocumentWriter[MySignedPrismEvent[OP]]
trait BSONWriter[MySignedPrismEvent[OP]]
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

override def writeTry(obj: MySignedPrismEvent[OP]): Try[BSONDocument]

Tries to produce a BSON value from an instance of T.

Tries to produce a BSON value from an instance of T.

import scala.util.Try
import reactivemongo.api.bson.{ BSONWriter, BSONValue }

def toBSON[T](value: T)(implicit w: BSONWriter[T]): Try[BSONValue] =
 w.writeTry(value)

Attributes

Definition Classes
BSONDocumentWriter -> BSONWriter

Inherited methods

def afterWrite(f: BSONDocument => BSONDocument): BSONDocumentWriter[MySignedPrismEvent[OP]]

Attributes

Inherited from:
BSONDocumentWriter
def afterWrite(f: PartialFunction[BSONValue, BSONValue]): BSONWriter[MySignedPrismEvent[OP]]

Prepares a BSON writer that returns the result of applying f on the BSON value from this writer.

Prepares a BSON writer that returns the result of applying f on the BSON value from this writer.

If the f function is not defined for a BSONValue, it will results in a Failure.

Value parameters

f

the partial function to apply

Attributes

Inherited from:
BSONWriter
def afterWriteTry(f: BSONDocument => Try[BSONDocument]): BSONDocumentWriter[MySignedPrismEvent[OP]]

Attributes

Inherited from:
BSONDocumentWriter
def afterWriteTry(f: BSONValue => Try[BSONValue]): BSONWriter[MySignedPrismEvent[OP]]

Prepares a BSON writer that returns the result of applying f on the BSON value from this writer.

Prepares a BSON writer that returns the result of applying f on the BSON value from this writer.

Value parameters

f

the safe function to apply

Attributes

Inherited from:
BSONWriter
final override def beforeWrite[U](f: U => MySignedPrismEvent[OP]): BSONDocumentWriter[U]

Prepares a BSON writer that converts the input before calling the current writer.

Prepares a BSON writer that converts the input before calling the current writer.

Value parameters

f

the function apply the U input value to convert at T value used to the current writer

import reactivemongo.api.bson.BSONWriter
val w: BSONWriter[String] =
 implicitly[BSONWriter[Int]].beforeWrite(_.size)
w.writeTry("foo") // Success: BSONInteger(3)

Attributes

Definition Classes
BSONDocumentWriter -> BSONWriter
Inherited from:
BSONDocumentWriter
override def narrow[U <: MySignedPrismEvent[OP]]: BSONDocumentWriter[U]

Narrows this writer for a compatible type U.

Narrows this writer for a compatible type U.

import reactivemongo.api.bson.BSONWriter

val listWriter: BSONWriter[Seq[String]] =
 implicitly[BSONWriter[Seq[String]]]

val narrowAsListWriter: BSONWriter[List[String]] =
 listWriter.narrow[List[String]]
 // as List[String] <: Seq[String]

Type parameters

U

must be a sub-type of T

Attributes

Definition Classes
BSONDocumentWriter -> BSONWriter
Inherited from:
BSONDocumentWriter
override def writeOpt(t: MySignedPrismEvent[OP]): Option[BSONDocument]

Tries to produce a BSON value from an instance of T, returns None if an error occurred.

Tries to produce a BSON value from an instance of T, returns None if an error occurred.

import reactivemongo.api.bson.{ BSONWriter, BSONValue }

def maybeBSON[T](value: T)(implicit w: BSONWriter[T]): Option[BSONValue] =
 w.writeOpt(value)

Attributes

Definition Classes
BSONDocumentWriter -> BSONWriter
Inherited from:
BSONDocumentWriter