longevity

A Persistence Framework for Scala and NoSQL

View project on GitHub

project setup

scala version

We currently publish artifacts for Scala versions 2.11 and 2.12, so be sure your project is using a compatible Scala version. For example, your build.sbt file may have:

scalaVersion := "2.11.11"

or:

scalaVersion := "2.12.2"

using sonatype artifacts

Include the following two lines in your build.sbt to declare the dependency:

resolvers += Resolver.sonatypeRepo("releases")

libraryDependencies += "org.longevityframework" %% "longevity" % "0.25.1"

Include one of the following lines to bring in the library dependencies for the back end of your choice:

libraryDependencies += "org.longevityframework" %% "longevity-cassandra-deps" % "0.25.1"

libraryDependencies += "org.longevityframework" %% "longevity-mongodb-deps" % "0.25.1"

libraryDependencies += "org.longevityframework" %% "longevity-sqlite-deps" % "0.25.1"

enabling macro annotations

You will most likely want to use the macro annotations provided in package longevity.model.annotations. To do so, you will need to add Macro Paradise to your build, like so:

addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)

supplying optional dependencies

There are a number of optional longevity features that require you to bring in other library dependencies yourself. If you want to use cats.effect.IO as an effect, you will need cats-effect:

libraryDependencies += "org.typelevel" %% "cats-effect" % "0.3"

If you want to stream query results to Akka Streams:

libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.5.3"

If you want to stream query results to FS2:

libraryDependencies += "co.fs2" %% "fs2-core" % "0.9.6"

If you want to stream query results to iteratee.io:

libraryDependencies += "io.iteratee" %% "iteratee-core" % "0.12.0"

If you want to stream query results to Play enumerators:

libraryDependencies += "com.typesafe.play" %% "play-iteratees" % "2.6.1"

If you want to use longevity.test.RepoCrudSpec or longevity.test.QuerySpec to build integration tests, you will need ScalaTest:

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1"
prev: what is longevity
up: preliminaries
next: the domain model