Codec

@implicitNotFound("could not find implicit Codec[${A}]; ensure no imports are missing or manually define an instance") sealed abstract class Codec[A]

Provides a schema, along with encoding and decoding functions for a given type.

Provides a schema, along with encoding and decoding functions for a given type.

Companion
object
class Object
trait Matchable
class Any

Type members

Types

type Repr
Implicitly added by option
type Repr

Value members

Abstract methods

def decode(value: Any, schema: Schema): Either[AvroError, A]
Implicitly added by option

Attempts to decode the specified value using the provided schema.

Attempts to decode the specified value using the provided schema.

def decode(value: Any, schema: Schema): Either[AvroError, A]

Attempts to decode the specified value using the provided schema.

Attempts to decode the specified value using the provided schema.

def encode(a: A): Either[AvroError, Repr]
Implicitly added by option

Attempts to encode the specified value using the provided schema.

Attempts to encode the specified value using the provided schema.

def encode(a: A): Either[AvroError, Repr]

Attempts to encode the specified value using the provided schema.

Attempts to encode the specified value using the provided schema.

def schema: Either[AvroError, Schema]
Implicitly added by option

The schema or an error if the schema could not be generated.

The schema or an error if the schema could not be generated.

def schema: Either[AvroError, Schema]

The schema or an error if the schema could not be generated.

The schema or an error if the schema could not be generated.

Concrete methods

final def imap[B](f: A => B)(g: B => A): Aux[Repr, B]
Implicitly added by option

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

final def imap[B](f: A => B)(g: B => A): Aux[Repr, B]

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

final def imapError[B](f: A => Either[AvroError, B])(g: B => A): Aux[Repr, B]
Implicitly added by option

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Similar to Codec#imap, except the mapping from A to B might be unsuccessful.

final def imapError[B](f: A => Either[AvroError, B])(g: B => A): Aux[Repr, B]

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Similar to Codec#imap, except the mapping from A to B might be unsuccessful.

final def imapTry[B](f: A => Try[B])(g: B => A): Aux[Repr, B]
Implicitly added by option

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Similar to Codec#imap, except the mapping from A to B might be unsuccessful.

final def imapTry[B](f: A => Try[B])(g: B => A): Aux[Repr, B]

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Returns a new Codec which uses this Codec for encoding and decoding, mapping back-and-forth between types A and B.

Similar to Codec#imap, except the mapping from A to B might be unsuccessful.