Doobie

Learn how to integrate the database with Doobie.

We'll cover the following...

Repository base

As we have already started using a tagless final approach, we will continue with it and define a base for our repository.

Press + to interact
trait Repository[F[_]] {
def loadProduct(id: ProductId): F[Seq[(ProductId, LanguageCode, ProductName)]]
def loadProducts(): Stream[F, (ProductId, LanguageCode, ProductName)]
def saveProduct(p: Product): F[Int]
def updateProduct(p: Product): F[Int]
}

We are feeling braver now and are attempting to use proper refined types in our database functions. This is possible due to the usage of the doobie-refined module.

To be able to map the UUID data type ...