Skip to main content
Version: 2.x

High Level API

High Level API constructors for CRUD operations are found on the DynamoDBQuery companion object. They rely on a ZIO Schema for a particular type being in implicit scope. This is achieved using the DeriveSchema.gen macro. Internally codecs are automatically generated for the case classes based on the meta-data provided by the Schema's.

object DynamoDBQuery {

// CRUD operation constructors

def put[A: Schema](tableName: String, a: A): DynamoDBQuery[A, Option[A]] = ???

def get[From: Schema](tableName: String)(
primaryKeyExpr: KeyConditionExpr.PrimaryKeyExpr[From]
): DynamoDBQuery[From, Either[ItemError, From]] = ???

def update[From: Schema](tableName: String)(primaryKeyExpr: KeyConditionExpr.PrimaryKeyExpr[From])(
action: Action[From]
): DynamoDBQuery[From, Option[From]] = ???

def deleteFrom[From: Schema](
tableName: String
)(
primaryKeyExpr: KeyConditionExpr.PrimaryKeyExpr[From]
): DynamoDBQuery[Any, Option[From]] = ???

// Scan/Query operations

def scanAll[A: Schema](
tableName: String
): DynamoDBQuery[A, Stream[Throwable, A]] = ???

def scanSome[A: Schema](
tableName: String,
limit: Int
): DynamoDBQuery[A, (Chunk[A], LastEvaluatedKey)] = ???

def queryAll[A: Schema](
tableName: String
): DynamoDBQuery[A, Stream[Throwable, A]] = ???

def querySome[A: Schema](
tableName: String,
limit: Int
): DynamoDBQuery[A, (Chunk[A], LastEvaluatedKey)] = ???
}

Once we have constructed a type safe query we can execute it.

Methods that need a primary key expression take a KeyConditionExpr.PrimaryKeyExpr[From] as an argument, however rather than create one directly we can create one using a ProjectionExpression as a springboard

ZIO Chat

๐ŸŽ‰ Hey there, ZIO aficionado! ๐ŸŽ‰ Step into the ZIO wonderland with me as your guide. Whether you're a functional fanatic or just dipping your toes into the ZIO ecosystem, I'm here to make your journey smooth. Got ZIO questions? I've got answers! Let's navigate the ZIO universe together and unlock its infinite possibilities!