CI Coverage Release Issues Users Chat
Build Status Coverage Status Release Artifacts Average time to resolve an issue Scaladex dependencies badge Gitter

Scanamo is a library to make using DynamoDB with Scala simpler and less error-prone.

The main focus is on making it easier to avoid mistakes and typos by leveraging Scala’s type system and some higher level abstractions.

Quick start

Note: the LocalDynamoDB object is provided by the scanamo-testkit package.

Scanamo is published for Scala 2.13 and 2.12 to Maven Central, so just add the following to your build.sbt:

libraryDependencies += "org.scanamo" %% "scanamo" % "1.0.0-M20+15-9f5b0f94-SNAPSHOT"

then, given a table and some case classes

import org.scanamo._
import org.scanamo.syntax._

val client = LocalDynamoDB.syncClient()
val scanamo = Scanamo(client)
val farmersTableResult = LocalDynamoDB.createTable(client)("farmer")("name" -> S)

case class Farm(animals: List[String])
case class Farmer(name: String, age: Long, farm: Farm)

we can simply put and get items from Dynamo, without boilerplate or reflection

val table = Table[Farmer]("farmer")
// table: Table[Farmer] = Table("farmer")

scanamo.exec(table.put(Farmer("McDonald", 156L, Farm(List("sheep", "cow")))))
scanamo.exec(table.get("name" === "McDonald"))
// res1: Option[Either[DynamoReadError, Farmer]] = Some(
//   Right(Farmer("McDonald", 156L, Farm(List("sheep", "cow"))))
// )

Scanamo supports most other DynamoDB operations, beyond the basic Put and Get.

The translation between Dynamo items and Scala types is handled by a type class called DynamoFormat.

Licensed under the Apache License, Version 2.0.