Packages

  • package root
    Definition Classes
    root
  • package skunk

    Skunk is a functional data access layer for Postgres.

    Skunk is a functional data access layer for Postgres.

    Design principles:

    • Skunk doesn't use JDBC. It speaks the Postgres wire protocol. It will not work with any other database back end.
    • Skunk is asynchronous all the way down, via cats-effect, fs2, and ultimately nio. The high-level network layers (Protocol and Session) are safe to use concurrently.
    • Serialization to and from schema types is not typeclass-based, so there are no implicit derivations. Codecs are explicit, like parser combinators.
    • I'm not sweating arity abstraction that much. Pass a ~ b ~ c for three args and Void if there are no args. This may change in the future but it's fine for now.
    • Skunk uses Resource for lifetime-managed objects, which means it takes some discipline to avoid leaks, especially when working concurrently. May or may not end up being problematic.
    • I'm trying to write good Scaladoc this time.

    A minimal example follows. We construct a Resource that yields a Session, then use it.

    package example
    
    import cats.effect._
    import skunk._
    import skunk.implicits._
    import skunk.codec.numeric._
    
    object Minimal extends IOApp {
    
      val session: Resource[IO, Session[IO]] =
        Session.single(
          host     = "localhost",
          port     = 5432,
          user     = "postgres",
          database = "world",
        )
    
      def run(args: List[String]): IO[ExitCode] =
        session.use { s =>
          for {
            n <- s.unique(sql"select 42".query(int4))
            _ <- IO(println(s"The answer is $n."))
          } yield ExitCode.Success
        }
    
    }

    Continue reading for an overview of the library. It's pretty small.

    Definition Classes
    root
  • package codec
    Definition Classes
    skunk
  • package data
    Definition Classes
    skunk
  • Completion
  • Identifier
  • Notification
  • TransactionStatus
  • Type
  • TypedRowDescription
  • package exception
    Definition Classes
    skunk
  • package net

    Skunk network stack, starting with BitVectorSocket at the bottom and ending with Protocol at the top (Session delegates all its work to Protocol).

    Skunk network stack, starting with BitVectorSocket at the bottom and ending with Protocol at the top (Session delegates all its work to Protocol). Everything is non-blocking.

    Definition Classes
    skunk
  • package syntax
    Definition Classes
    skunk
  • package util
    Definition Classes
    skunk

package data

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed abstract class Completion extends AnyRef
  2. sealed abstract case class Identifier extends Product with Serializable
  3. final case class Notification(pid: Int, channel: Identifier, value: String) extends Product with Serializable
  4. sealed abstract class TransactionStatus extends Product with Serializable

    Enumerated type of transaction status values.

    Enumerated type of transaction status values. See the companion object for more information.

  5. final case class Type(name: String, componentTypes: List[Type] = Nil) extends Product with Serializable

    A type has a name and a list of component types.

    A type has a name and a list of component types. So it's a rose tree, isomorphic to Cofree[List, String], but we specialize here for simplicity.

  6. final case class TypedRowDescription(fields: List[Field]) extends Product with Serializable

Value Members

  1. object Completion
  2. object Identifier extends Serializable
  3. object TransactionStatus extends Serializable
  4. object Type extends Serializable
  5. object TypedRowDescription extends Serializable

Ungrouped