A Persistence Framework for Scala and NoSQL

View project on GitHub

opening and closing the connection

Before you do much work with your repository, you will need to connect to the database. Also, it is a good idea to close the connection when you are done, to conserve resources. You can open the connection like so:

val openResult: Future[Unit] = repo.openConnection

You can close the connection like so:

val closeResult: Future[Unit] = repo.closeConnection

An alternative way to open the connection is to set the configuration flag longevity.autoOpenConnection to true. In this case, the connection will be opened when the Repo is first accessed. Unlike calling Repo.openConnection, automatically opening the connection happens in a synchronous, blocking manner (i.e., outside of your effect).

prev: the repository
up: the repository
next: schema creation