Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scanamo/scanamo
Simpler DynamoDB access for Scala
https://github.com/scanamo/scanamo
dynamodb scala
Last synced: 2 days ago
JSON representation
Simpler DynamoDB access for Scala
- Host: GitHub
- URL: https://github.com/scanamo/scanamo
- Owner: scanamo
- License: apache-2.0
- Created: 2016-02-01T10:58:52.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-11-07T11:16:11.000Z (3 months ago)
- Last Synced: 2024-12-06T21:10:29.766Z (2 months ago)
- Topics: dynamodb, scala
- Language: Scala
- Homepage: https://www.scanamo.org
- Size: 36.7 MB
- Stars: 320
- Watchers: 34
- Forks: 125
- Open Issues: 67
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-scala - Scanamo ★ 92 ⧗ 1 - A library to make using DynamoDB with Scala simpler and less error-prone. (Database)
- awesome-zio - scanamo
- awesome-scala - scanamo - activity/y/scanamo/scanamo) (Table of Contents / Database)
README
# Scanamo
[![scanamo Scala version support](https://index.scala-lang.org/scanamo/scanamo/scanamo/latest-by-scala-version.svg?platform=jvm)](https://index.scala-lang.org/scanamo/scanamo/scanamo)
[![CI](https://github.com/scanamo/scanamo/actions/workflows/ci.yml/badge.svg)](https://github.com/scanamo/scanamo/actions/workflows/ci.yml)Scanamo is a library to make using [DynamoDB](https://aws.amazon.com/documentation/dynamodb/) with Scala
simpler and less error-prone. The library is currently maintained by Roberto Tyley (@rtyley).The main focus is on making it easier to avoid mistakes and typos by leveraging Scala's type system and some
higher level abstractions.Installation
------------```scala
libraryDependencies += "org.scanamo" %% "scanamo" % "1.0.0"
```Basic Usage
-----------```scala
scala> import org.scanamo._
scala> import org.scanamo.syntax._
scala> import org.scanamo.generic.auto._
scala> val client = LocalDynamoDB.client()
scala> import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType._
scala> val farmersTableResult = LocalDynamoDB.createTable(client)("farmer")("name" -> S)scala> case class Farm(animals: List[String])
scala> case class Farmer(name: String, age: Long, farm: Farm)
scala> val table = Table[Farmer]("farmer")scala> val ops = for {
| _ <- table.putAll(Set(
| Farmer("McDonald", 156L, Farm(List("sheep", "cow"))),
| Farmer("Boggis", 43L, Farm(List("chicken")))
| ))
| mcdonald <- table.get("name" -> "McDonald")
| } yield mcdonald
scala> Scanamo.exec(client)(ops)
res1: Option[Either[error.DynamoReadError, Farmer]] = Some(Right(Farmer(McDonald,156,Farm(List(sheep, cow)))))
```_Note: the `LocalDynamoDB` object is provided by the `scanamo-testkit` package._
For more details, please see the [Scanamo site](http://www.scanamo.org).
License
-------Scanamo is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) (the "License");
you may not use this software except in compliance with the License.Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.