Codec

skunk.Codec
See theCodec companion object
trait Codec[A] extends Encoder[A] with Decoder[A]

Symmetric encoder and decoder of Postgres text-format data to and from Scala types.

Attributes

Companion:
object
Source:
Codec.scala
Graph
Supertypes
trait Decoder[A]
trait Encoder[A]
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

Forget this value is a Codec and treat it as a Decoder.

Forget this value is a Codec and treat it as a Decoder.

Attributes

Source:
Codec.scala

Forget this value is a Codec and treat it as an Encoder.

Forget this value is a Codec and treat it as an Encoder.

Attributes

Source:
Codec.scala
def eimap[B](f: A => Either[String, B])(g: B => A): Codec[B]

Contramap inputs from, and map decoded results to a new type B or an error, yielding a Codec[B].

Contramap inputs from, and map decoded results to a new type B or an error, yielding a Codec[B].

Attributes

Source:
Codec.scala
def gimap[B](implicit ev: Aux[B, A]): Codec[B]

Adapt this Codec from twiddle-list type A to isomorphic case-class type B.

Adapt this Codec from twiddle-list type A to isomorphic case-class type B.

Attributes

Source:
Codec.scala
def imap[B](f: A => B)(g: B => A): Codec[B]

Contramap inputs from, and map outputs to, a new type B, yielding a Codec[B].

Contramap inputs from, and map outputs to, a new type B, yielding a Codec[B].

Attributes

Source:
Codec.scala
override def opt: Codec[Option[A]]

Lift this Codec into Option, where None is mapped to and from a vector of NULL.

Lift this Codec into Option, where None is mapped to and from a vector of NULL.

Attributes

Definition Classes
Source:
Codec.scala
def product[B](fb: Codec[B]): Codec[(A, B)]

Codec is semigroupal: a pair of codecs make a codec for a pair.

Codec is semigroupal: a pair of codecs make a codec for a pair.

Attributes

Source:
Codec.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns:

a string representation of the object.

Definition Classes
Decoder -> Encoder -> Any
Source:
Codec.scala
def ~[B](fb: Codec[B]): Codec[(A, B)]

Shorthand for product.

Shorthand for product.

Attributes

Source:
Codec.scala

Inherited methods

def contramap[B](f: B => A): Encoder[B]

Contramap inputs from a new type B, yielding an Encoder[B].

Contramap inputs from a new type B, yielding an Encoder[B].

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def decode(offset: Int, ss: List[Option[String]]): Either[Error, A]

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def emap[B](f: A => Either[String, B]): Decoder[B]

Map decoded results to a new type B or an error, yielding a Decoder[B].

Map decoded results to a new type B or an error, yielding a Decoder[B].

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def encode(a: A): List[Option[String]]

Encode a value of type A, yielding a list of Postgres text-formatted strings, lifted to Option to handle NULL values. Encoding failures raise unrecoverable errors.

Encode a value of type A, yielding a list of Postgres text-formatted strings, lifted to Option to handle NULL values. Encoding failures raise unrecoverable errors.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def filter[B](f: A => Boolean): Decoder[A]

An equivalent decoder that filters results, failing with a generic error message when the filter condition is not met. For a custom error message use emap.

An equivalent decoder that filters results, failing with a generic error message when the filter condition is not met. For a custom error message use emap.

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def gcontramap[B](implicit ev: Aux[B, A]): Encoder[B]

Adapt this Encoder from twiddle-list type A to isomorphic case-class type B.

Adapt this Encoder from twiddle-list type A to isomorphic case-class type B.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def gmap[B](implicit ev: Aux[B, A]): Decoder[B]

Adapt this Decoder from twiddle-list type A to isomorphic case-class type B.

Adapt this Decoder from twiddle-list type A to isomorphic case-class type B.

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def length: Int

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def list(as: List[A]): Encoder[List[A]]

Derive an encoder for the specified list. This is equivalent to list(as.length) but the resulting encoder can only encode the exact list that it was passed. Prefer this overload when possible because it lessens the possibility of attempting to encode a list of the wrong length.

Derive an encoder for the specified list. This is equivalent to list(as.length) but the resulting encoder can only encode the exact list that it was passed. Prefer this overload when possible because it lessens the possibility of attempting to encode a list of the wrong length.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def list(n: Int): Encoder[List[A]]

Derive an encoder for a list of size n that expands to a comma-separated list of placeholders.

Derive an encoder for a list of size n that expands to a comma-separated list of placeholders.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def map[B](f: A => B): Decoder[B]

Map decoded results to a new type B, yielding a Decoder[B].

Map decoded results to a new type B, yielding a Decoder[B].

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def oids(ty: Typer): Either[List[(Type, Option[Int])], List[Int]]

Oids of types, or mismatches.

Oids of types, or mismatches.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def product[B](fb: Decoder[B]): Decoder[(A, B)]

Decoder is semigroupal: a pair of decoders make a decoder for a pair.

Decoder is semigroupal: a pair of decoders make a decoder for a pair.

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def product[B](fb: Encoder[B]): Encoder[(A, B)]

Encoder is semigroupal: a pair of encoders make a encoder for a pair.

Encoder is semigroupal: a pair of encoders make a encoder for a pair.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala

Given an initial parameter index, yield a hunk of sql containing placeholders, and a new index.

Given an initial parameter index, yield a hunk of sql containing placeholders, and a new index.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def values: Encoder[A]

Derive an equivalent encoder for a row type; i.e., its placeholders will be surrounded by parens.

Derive an equivalent encoder for a row type; i.e., its placeholders will be surrounded by parens.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala
def ~[B](fb: Decoder[B]): Decoder[(A, B)]

Shorthand for product.

Shorthand for product.

Attributes

Inherited from:
Decoder
Source:
Decoder.scala
def ~[B](fb: Encoder[B]): Encoder[(A, B)]

Shorthand for product.

Shorthand for product.

Attributes

Inherited from:
Encoder
Source:
Encoder.scala