Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.
/ scanamo-scrooge Public archive

Automatic DynamoDB serialisation of Scroge generated classes

guardian/scanamo-scrooge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScanamoScrooge Maven Central Build Status

Like Scanamo for interacting with DynamoDB and use Scrooge for working with Thrift? Then you'll love ScanamoScrooge!

ScanamoScrooge provides automatic derivation of DynamoFormat type classes for Scrooge generated classes based on Thrift struct and enum types.

Installation

Add scanamo-scrooge as a dependency to your build.sbt:

libraryDependencies ++= Seq(
  "org" %% "scanamo-scrooge" % "0.1.3"
)

Usage

To bring DynamoFormats for Scrooge generated classes into scope, simply

import org.scanamo.scrooge.ScroogeDynamoFormat._

While, there is normally no need to explicitly reference DynamoFormat, the following is an example of how it serialises classes based on the ChangeRecord thrift definition.

scala> import org.scanamo._
scala> import org.scanamo.scrooge.ScroogeDynamoFormat._
scala> import com.gu.contentatom.thrift._
scala> import cats.syntax.either._

scala> val changeRecord = ChangeRecord(1L, Some(User("email", Some("f"), None)))
scala> DynamoFormat[ChangeRecord].write(changeRecord)
res0: com.amazonaws.services.dynamodbv2.model.AttributeValue = {M: {date={N: 1,}, user={M: {email={S: email,}, firstName={S: f,}, lastName={NULL: true,}},}},}

scala> DynamoFormat[ChangeRecord].read(DynamoFormat[ChangeRecord].write(changeRecord))
res1: Either[error.DynamoReadError, ChangeRecord] = Right(ChangeRecord(1,Some(User(email,Some(f),None))))

About

Automatic DynamoDB serialisation of Scroge generated classes

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages