Skip to main content
Version: 2.x

CRUD Operations

The High Level API mirrors the CRUD operations of DDB but with a high level of type safety.

We have to start of with a Scala model of the table and add an implicit schema reference in the companion object together with some convenience ProjectionExpression's via the accessors function.

final case class Person(id: String, name: String, age: Int)
object Person {
implicit val schema: Schema.CaseClass3[String, String, Int, Person] = DeriveSchema.gen[Person]
val (id, name, age) = ProjectionExpression.accessors[Person]
}

A summary is shown below and detailed sections can be found for each operation.

object DynamoDBQuery {

// CRUD operations

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]] = ???

}

ZIO Chat

๐Ÿ”ฅ Ignite your ZIO journey with ZIO Chat! ๐Ÿ”ฅ Ready to unravel the intricacies of ZIO? As your trusty sidekick, I'm here to light the way. No matter if you're wandering through functional forests or traversing effectful landscapes, I've got answers to keep you on track. Your ZIO adventure starts here โ€“ ask me anything and let's explore together!