Package

org

scanamo

Permalink

package scanamo

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. scanamo
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class ConditionNotMet(e: ConditionalCheckFailedException) extends ScanamoError with Product with Serializable

    Permalink
  2. sealed abstract class DeleteReturn extends Product with Serializable

    Permalink
  3. sealed abstract class DynamoArray extends Product with Serializable

    Permalink

    A DynamoArray is a pure representation of an array of AttributeValues

  4. trait DynamoFormat[T] extends AnyRef

    Permalink

    Type class for defining serialisation to and from DynamoDB's AttributeValue

    Type class for defining serialisation to and from DynamoDB's AttributeValue

    >>> val listOptionFormat = DynamoFormat[List[Option[Int]]]
    >>> listOptionFormat.read(listOptionFormat.write(List(Some(1), None, Some(3))))
    Right(List(Some(1), None, Some(3)))
    
    Also supports automatic and semi-automatic derivation for case classes
    >>> import org.scanamo.generic.auto._
    >>>
    >>> case class Farm(animals: List[String])
    >>> case class Farmer(name: String, age: Long, farm: Farm)
    >>> val farmerF = DynamoFormat[Farmer]
    >>> farmerF.read(farmerF.write(Farmer("McDonald", 156L, Farm(List("sheep", "cow")))))
    Right(Farmer(McDonald,156,Farm(List(sheep, cow))))

    and for sealed trait + case object hierarchies

    >>> sealed trait Animal
    >>> case object Aardvark extends Animal
    >>> case object Zebra extends Animal
    >>> case class Pet(name: String, animal: Animal)
    >>> val pet1 = Pet("Amy", Aardvark)
    >>> val pet2 = Pet("Zebediah", Zebra)
    >>> val petF = DynamoFormat[Pet]
    >>> petF.read(petF.write(pet1))
    Right(Pet(Amy,Aardvark))
    
    >>> petF.read(petF.write(pet2))
    Right(Pet(Zebediah,Zebra))

    Problems reading a value are detailed

    >>> import cats.syntax.either._
    
    >>> case class Developer(name: String, age: String, problems: Int)
    >>> val invalid = DynamoFormat[Farmer].read(DynamoFormat[Developer].write(Developer("Alice", "none of your business", 99)))
    >>> invalid
    Left(InvalidPropertiesError(NonEmptyList((age,NoPropertyOfType(N,DynString(none of your business))), (farm,MissingProperty))))
    
    >>> invalid.leftMap(cats.Show[DynamoReadError].show)
    Left('age': not of type: 'N' was 'DynString(none of your business)', 'farm': missing)

    Custom formats can often be most easily defined using DynamoFormat.coercedXmap, DynamoFormat.xmap or DynamoFormat.iso

  5. sealed abstract class DynamoObject extends Product with Serializable

    Permalink

    A DynamoObject is a map of strings to values that can be embedded into an AttributeValue.

  6. sealed abstract class DynamoReadError extends ScanamoError

    Permalink
  7. sealed abstract class DynamoValue extends Product with Serializable

    Permalink

    A DynamoValue is a pure representation of an AttributeValue from the AWS SDK.

  8. final case class InvalidPropertiesError(errors: NonEmptyList[(String, DynamoReadError)]) extends DynamoReadError with Product with Serializable

    Permalink
  9. final case class NoPropertyOfType(propertyType: String, actual: DynamoValue) extends DynamoReadError with Product with Serializable

    Permalink
  10. sealed abstract class PutReturn extends Product with Serializable

    Permalink
  11. class Scanamo extends AnyRef

    Permalink

    Provides a simplified interface for reading and writing case classes to DynamoDB

    Provides a simplified interface for reading and writing case classes to DynamoDB

    To avoid blocking, use org.scanamo.ScanamoAsync

  12. class ScanamoAsync extends AnyRef

    Permalink

    Provides the same interface as org.scanamo.Scanamo, except that it requires an implicit concurrent.ExecutionContext and returns a concurrent.Future

    Provides the same interface as org.scanamo.Scanamo, except that it requires an implicit concurrent.ExecutionContext and returns a concurrent.Future

    Note that that com.amazonaws.services.dynamodbv2.AmazonDynamoDBAsyncClient just uses an java.util.concurrent.ExecutorService to make calls asynchronously

  13. sealed abstract class ScanamoError extends AnyRef

    Permalink
  14. sealed abstract class SecondaryIndex[V] extends AnyRef

    Permalink

    Represents a secondary index on a DynamoDB table.

    Represents a secondary index on a DynamoDB table.

    Can be constructed via the index method on Table

  15. case class Table[V](name: String)(implicit evidence$1: DynamoFormat[V]) extends Product with Serializable

    Permalink

    Represents a DynamoDB table that operations can be performed against

    Represents a DynamoDB table that operations can be performed against

    >>> case class Transport(mode: String, line: String)
    
    >>> val client = LocalDynamoDB.client()
    >>> val scanamo = Scanamo(client)
    >>> import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType._
    
    >>> LocalDynamoDB.withRandomTable(client)("mode" -> S, "line" -> S) { t =>
    ...   import org.scanamo.syntax._
    ...   import org.scanamo.generic.auto._
    ...   val transport = Table[Transport](t)
    ...   val operations = for {
    ...     _ <- transport.putAll(Set(
    ...       Transport("Underground", "Circle"),
    ...       Transport("Underground", "Metropolitan"),
    ...       Transport("Underground", "Central")))
    ...     results <- transport.query("mode" -> "Underground" and ("line" beginsWith "C"))
    ...   } yield results.toList
    ...   scanamo.exec(operations)
    ... }
    List(Right(Transport(Underground,Central)), Right(Transport(Underground,Circle)))
  16. final case class TypeCoercionError(t: Throwable) extends DynamoReadError with Product with Serializable

    Permalink

Value Members

  1. object DeleteReturn extends Serializable

    Permalink
  2. object DynamoArray extends Serializable

    Permalink
  3. object DynamoFormat extends LowPriorityFormats

    Permalink
  4. object DynamoObject extends Serializable

    Permalink
  5. object DynamoReadError

    Permalink
  6. object DynamoValue extends Serializable

    Permalink
  7. object MissingProperty extends DynamoReadError with Product with Serializable

    Permalink
  8. object PutReturn extends Serializable

    Permalink
  9. object Scanamo

    Permalink
  10. object ScanamoAsync

    Permalink
  11. object ScanamoFree

    Permalink
  12. package generic

    Permalink
  13. package ops

    Permalink
  14. package query

    Permalink
  15. package request

    Permalink
  16. object syntax

    Permalink
  17. package update

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped