Need example of a method to create paginated query on dynamoDb using scala's, Scanamo library
I am trying to create to create a method which performs paginated queries on dynamodb table using a query on secondary index. I tried using scanamo but this doesn't works.... Additionally I am not sure how queryPaginatedM() works, since there is not much documentation available for scala newbies.
protected def querySecondaryIndexPaginated[T, U](
query: Query[T],
table: Table[U],
indexName: String,
pageSize: Int,
lastEvaluatedKeyOpt: Option[Map[String, AttributeValue]]
)(implicit format: DynamoFormat[T]): Future[MyDynamoResult[U]] = {
val queryRequest: ScanamoOps[List[Either[DynamoReadError, U]]] = lastEvaluatedKeyOpt match {
case Some(lastEvaluatedKey) => table.index(indexName).limit(pageSize).from(UniqueKey(lastEvaluatedKey)).query(query = query)
case None => table.index(indexName).limit(pageSize).query(query = query)
}
scanamo
.execFuture(queryRequest)
.map....