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
  • package exception
    Definition Classes
    skunk
  • ColumnAlignmentException
  • CopyNotSupportedException
  • DecodeException
  • EmptyStatementException
  • EofException
  • NoDataException
  • PostgresErrorException
  • ProtocolError
  • SCRAMProtocolException
  • SkunkException
  • StartupException
  • TooManyParametersException
  • UnexpectedDataException
  • UnexpectedRowsException
  • UnknownOidException
  • UnknownTypeException
  • UnsupportedAuthenticationSchemeException
  • UnsupportedSASLMechanismsException
  • 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
p

skunk

exception

package exception

Source
package.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. exception
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. case class ColumnAlignmentException(query: Query[_, _], rd: TypedRowDescription) extends SkunkException with Product with Serializable
  2. class CopyNotSupportedException extends SkunkException
  3. class DecodeException[F[_], A, B] extends SkunkException
  4. class EmptyStatementException extends SkunkException
  5. case class EofException(bytesRequested: Int, bytesRead: Int) extends SkunkException with Product with Serializable
  6. final case class NoDataException(query: Query[_, _]) extends SkunkException with Product with Serializable
  7. class PostgresErrorException extends SkunkException
  8. class ProtocolError extends Error with NoStackTrace
  9. class SCRAMProtocolException extends SkunkException
  10. class SkunkException extends Exception with Fields
  11. class StartupException extends PostgresErrorException
  12. final case class TooManyParametersException(query: Statement[_]) extends SkunkException with Product with Serializable
  13. final case class UnexpectedDataException(command: Command[_]) extends SkunkException with Product with Serializable
  14. case class UnexpectedRowsException(command: Command[_], rd: TypedRowDescription) extends SkunkException with Product with Serializable
  15. case class UnknownOidException(query: Query[_, _], types: List[(Field, Option[Field])], strategy: Strategy) extends SkunkException with Product with Serializable
  16. case class UnknownTypeException(query: Statement[_], types: List[(Type, Option[Int])], strategy: util.Typer.Strategy) extends SkunkException with Product with Serializable
  17. class UnsupportedAuthenticationSchemeException extends SkunkException
  18. class UnsupportedSASLMechanismsException extends SkunkException

Value Members

  1. object PostgresErrorException extends Serializable
  2. object SkunkException extends Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped