Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Simple, type-safe, and efficient access to DynamoDB

License

NotificationsYou must be signed in to change notification settings

sideeffffect/zio-dynamodb

 
 

Repository files navigation

Simple, type-safe, and efficient access to DynamoDB

ExperimentalCI BadgeSonatype ReleasesSonatype SnapshotsjavadocZIO DynamoDB

Introduction

ZIO DynamoDB is a library that is used for type-safe, efficient, and boilerplate free access to AWS's DynamoDB service. It provides a type-safe API for many query types and the number of type-safe APIs is expanding. ZIO DynamoDB will automatically batch queries and execute unbatchable queries in parallel.

Under the hood we use the excellentZIO AWS library for type-safe DynamoDB access, and the awesomeZIO Schema library for schema derived codecs (see here for documentation on how tocustomise these through annotations).

Installation

To use ZIO DynamoDB, we need to add the following lines to ourbuild.sbt file:

libraryDependencies++=Seq("dev.zio"%%"zio-dynamodb"%"0.2.4")

Example

For examples please seeexamples sbt module. Below isMain.scala from that module:

importzio.aws.core.configimportzio.aws.{dynamodb,netty }importzio.dynamodb.DynamoDBQuery.{get,put }importzio.dynamodb.{DynamoDBExecutor,PrimaryKey }importzio.schema.{DeriveSchema,Schema }importzio.ZIOAppDefaultobjectMainextendsZIOAppDefault {finalcaseclassPerson(id:Int,firstName:String)objectPerson {implicitlazyvalschema:Schema[Person]=DeriveSchema.gen[Person]  }valexamplePerson=Person(1,"avi")privatevalprogram=for {    _<- put("personTable", examplePerson).execute    person<- get[Person]("personTable",PrimaryKey("id"->1)).execute    _<- zio.Console.printLine(s"hello$person")  }yield ()overridedefrun=    program.provide(      netty.NettyHttpClient.default,      config.AwsConfig.default,// uses real AWS dynamodb      dynamodb.DynamoDb.live,DynamoDBExecutor.live    )}

For examples on how to use the DynamoDBLocal in memory database please see theintegration testsandStudentZioDynamoDbExample .Note before you run these you must first run the DynamoDBLocal docker container using the provided docker-compose file:

docker-compose -f docker/docker-compose.yml up -d

Don't forget to shut down the container after you have finished

docker-compose -f docker/docker-compose.yml down

Documentation

Learn more on theZIO DynamoDB homepage!

Contributing

For the general guidelines, see ZIOcontributor's guide.

Code of Conduct

See theCode of Conduct

Support

Come chat with us onBadge-Discord.

License

License

About

Simple, type-safe, and efficient access to DynamoDB

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala100.0%

[8]ページ先頭

©2009-2025 Movatter.jp