Codec

object Codec extends CodecCompanionCompat
Companion
class
trait CodecCompanionCompat
class Object
trait Matchable
class Any

Document{}

final def apply[A](codec: Codec[A]): codec

Returns the Codec for the specified type.

Returns the Codec for the specified type.

final implicit val boolean: Aux[Boolean, Boolean]
final implicit lazy val byte: Aux[Int, Byte]
final implicit val bytes: Aux[ByteBuffer, Array[Byte]]
final implicit def chain[A](codec: Codec[A]): Aux[List[Repr], Chain[A]]
final implicit val char: Aux[Utf8, Char]
final def decimal(precision: Int, scale: Int): Aux[ByteBuffer, BigDecimal]

Returns a new decimal Codec for type BigDecimal.

Returns a new decimal Codec for type BigDecimal.

final def decode[A](value: Any)(codec: Codec[A]): Either[AvroError, A]

Returns the result of decoding the specified value to the specified type.

Returns the result of decoding the specified value to the specified type.

final implicit val double: Aux[Double, Double]
final implicit def either[A, B](codecA: Codec[A], codecB: Codec[B]): Aux[Any, Either[A, B]]
final def encode[A](a: A)(codec: Codec[A]): Either[AvroError, Repr]

Returns the result of encoding the specified value.

Returns the result of encoding the specified value.

final def enumeration[A](name: String, namespace: String, symbols: Seq[String], encode: A => String, decode: String => Either[AvroError, A], default: Option[A], doc: Option[String], aliases: Seq[String], props: Props): Aux[EnumSymbol, A]

Returns a new enum Codec for type A.

Returns a new enum Codec for type A.

final def fixed[A](name: String, namespace: String, size: Int, encode: A => Array[Byte], decode: Array[Byte] => Either[AvroError, A], doc: Option[String], aliases: Seq[String], props: Props): Aux[GenericFixed, A]

Returns a new fixed Codec for type A.

Returns a new fixed Codec for type A.

When encoding, bytes are zero-padded to the specified size. Zero-padding is applied at the end, and will remain in the input to decode. Encoding checks to ensure the size is not exceeded, while decoding ensures the exact size.

final implicit val float: Aux[Float, Float]
final def fromBinary[A](bytes: Array[Byte], writerSchema: Schema)(codec: Codec[A]): Either[AvroError, A]

Returns the result of decoding the specified Avro binary to the specified type.

Returns the result of decoding the specified Avro binary to the specified type.

final def fromJson[A](json: String, writerSchema: Schema)(codec: Codec[A]): Either[AvroError, A]

Returns the result of decoding the specified Avro JSON to the specified type.

Returns the result of decoding the specified Avro JSON to the specified type.

final def instance[Repr0, A](schema: Either[AvroError, Schema], encode: A => Either[AvroError, Repr0], decode: (Any, Schema) => Either[AvroError, A]): Aux[Repr0, A]

Returns a new Codec instance using the specified Schema, and encode and decode functions.

Returns a new Codec instance using the specified Schema, and encode and decode functions.

final implicit val instant: Aux[Long, Instant]
final implicit val int: Aux[Int, Int]
final implicit def left[A, B](codec: Codec[A]): Aux[Repr, Left[A, B]]
final implicit def list[A](codec: Codec[A]): Aux[List[Repr], List[A]]
final implicit val localDate: Aux[Int, LocalDate]
final val localTimeMillis: Aux[Int, LocalTime]
final val localTimeMicros: Aux[Long, LocalTime]
final implicit val long: Aux[Long, Long]
final implicit def map[A](codec: Codec[A]): Aux[Map[Utf8, Repr], Map[String, A]]
final implicit val none: Aux[Null, None]
final implicit def nonEmptyChain[A](codec: Codec[A]): Aux[List[Repr], Type[A]]
final implicit def nonEmptyList[A](codec: Codec[A]): Aux[List[Repr], NonEmptyList[A]]
final implicit def nonEmptySet[A](codec: Codec[A], ordering: Ordering[A]): Aux[List[Repr], Type[A]]
final implicit def nonEmptyVector[A](codec: Codec[A]): Aux[List[Repr], NonEmptyVector[A]]
final implicit def option[A](codec: Codec[A]): Codec[Option[A]]
final def record[A](name: String, namespace: String, doc: Option[String], aliases: Seq[String], props: Props)(f: FieldBuilder[A] => FreeApplicative[[_] =>> Field[A, _$39], A]): Aux[GenericRecord, A]

Returns a new record Codec for type A.

Returns a new record Codec for type A.

final implicit def right[A, B](codec: Codec[B]): Aux[Repr, Right[A, B]]
final implicit def seq[A](codec: Codec[A]): Aux[List[Repr], Seq[A]]
final implicit def set[A](codec: Codec[A]): Aux[List[Repr], Set[A]]
final implicit val short: Aux[Int, Short]
final implicit def some[A](codec: Codec[A]): Aux[Repr, Some[A]]
final implicit val string: Aux[Utf8, String]
final def toBinary[A](a: A)(codec: Codec[A]): Either[AvroError, Array[Byte]]

Returns the result of encoding the specified value to Avro binary.

Returns the result of encoding the specified value to Avro binary.

final def toJson[A](a: A)(codec: Codec[A]): Either[AvroError, String]

Returns the result of encoding the specified value to Avro JSON.

Returns the result of encoding the specified value to Avro JSON.

final def union[A](f: AltBuilder[A] => Chain[Alt[A]]): Aux[Any, A]

Returns a new union Codec for type A.

Returns a new union Codec for type A.

final implicit val unit: Aux[Null, Unit]
final implicit val uuid: Aux[Utf8, UUID]
final implicit def vector[A](codec: Codec[A]): Aux[List[Repr], Vector[A]]
final implicit val codecInvariant: Invariant[[A] =>> Codec[A]]
final implicit def codecShow[A]: Show[Codec[A]]
final implicit def codecAuxShow[Repr, A]: Show[Aux[Repr, A]]
sealed abstract class Alt[A]
sealed abstract class AltBuilder[A]
sealed abstract class Field[A, B]
sealed abstract class FieldBuilder[A]

Type members

Types

type Aux[Repr0, A] = Codec[A] { type Repr = Repr0; }

Value members

Deprecated methods

@deprecated("Use Codec.enumeration - enum is a keyword in Scala 3", "1.3.0")
final def enum[A](name: String, namespace: String, symbols: Seq[String], encode: A => String, decode: String => Either[AvroError, A], default: Option[A], doc: Option[String], aliases: Seq[String], props: Props): Aux[EnumSymbol, A]
Deprecated