BsonCodec

io.github.mbannour.mongo.codecs.BsonCodec
See theBsonCodec companion object
trait BsonCodec[T]

Type class for BSON encoding and decoding.

This provides a more functional and composable alternative to directly working with MongoDB codecs. It allows for better type safety and easier testing.

Type parameters

T

The type to encode/decode

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def decode(reader: BsonReader, context: DecoderContext): T

Decode a value from BSON

Decode a value from BSON

Attributes

def encode(writer: BsonWriter, value: T, context: EncoderContext): Unit

Encode a value to BSON

Encode a value to BSON

Attributes

def encoderClass: Class[T]

The runtime class for this codec

The runtime class for this codec

Attributes

Concrete methods

def imap[B](f: A => B)(g: B => A)(using ClassTag[B]): BsonCodec[B]
Extension method from BsonCodec

Map this codec to a different type

Map this codec to a different type

Attributes

def toCodec: Codec[T]

Convert this BsonCodec to a MongoDB Codec

Convert this BsonCodec to a MongoDB Codec

Attributes