sealed abstract class SecondaryIndex[V] extends AnyRef
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- SecondaryIndex
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Abstract Value Members
- abstract def descending: SecondaryIndex[V]
-
abstract
def
filter[C](condition: C)(implicit arg0: ConditionExpression[C]): SecondaryIndex[V]
Filter the results of
scanorquerywithin DynamoDBFilter the results of
scanorquerywithin DynamoDBNote that rows filtered out still count towards your consumed capacity
>>> case class Transport(mode: String, line: String, colour: String) >>> val client = LocalDynamoDB.client() >>> val scanamo = Scanamo(client) >>> import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType._ >>> import org.scanamo.syntax._ >>> import org.scanamo.auto._ >>> LocalDynamoDB.withRandomTableWithSecondaryIndex(client)( ... 'mode -> S, 'line -> S)('mode -> S, 'colour -> S ... ) { (t, i) => ... val transport = Table[Transport](t) ... val operations = for { ... _ <- transport.putAll(Set( ... Transport("Underground", "Circle", "Yellow"), ... Transport("Underground", "Metropolitan", "Magenta"), ... Transport("Underground", "Central", "Red"), ... Transport("Underground", "Picadilly", "Blue"), ... Transport("Underground", "Northern", "Black"))) ... somethingBeginningWithC <- transport.index(i) ... .filter('line beginsWith ("C")) ... .query('mode -> "Underground") ... } yield somethingBeginningWithC.toList ... scanamo.exec(operations) ... } List(Right(Transport(Underground,Central,Red)), Right(Transport(Underground,Circle,Yellow)))
- abstract def from[K](key: UniqueKey[K])(implicit arg0: UniqueKeyCondition[K]): SecondaryIndex[V]
-
abstract
def
limit(n: Int): SecondaryIndex[V]
Query or scan an index, limiting the number of items evaluated by Dynamo
Query or scan an index, limiting the number of items evaluated by Dynamo
>>> case class Transport(mode: String, line: String, colour: String) >>> val client = LocalDynamoDB.client() >>> val scanamo = Scanamo(client) >>> import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType._ >>> import org.scanamo.syntax._ >>> import org.scanamo.auto._ >>> LocalDynamoDB.withRandomTableWithSecondaryIndex(client)( ... 'mode -> S, 'line -> S)('mode -> S, 'colour -> S ... ) { (t, i) => ... val transport = Table[Transport](t) ... val operations = for { ... _ <- transport.putAll(Set( ... Transport("Underground", "Circle", "Yellow"), ... Transport("Underground", "Metropolitan", "Magenta"), ... Transport("Underground", "Central", "Red"), ... Transport("Underground", "Picadilly", "Blue"), ... Transport("Underground", "Northern", "Black"))) ... somethingBeginningWithBl <- transport.index(i).limit(1).descending.query( ... ('mode -> "Underground" and ('colour beginsWith "Bl")) ... ) ... } yield somethingBeginningWithBl.toList ... scanamo.exec(operations) ... } List(Right(Transport(Underground,Picadilly,Blue)))
-
abstract
def
query(query: Query[_]): ScanamoOps[List[Either[DynamoReadError, V]]]
Run a query against keys in a secondary index
Run a query against keys in a secondary index
>>> case class GithubProject(organisation: String, repository: String, language: String, license: String) >>> val client = LocalDynamoDB.client() >>> val scanamo = Scanamo(client) >>> import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType._ >>> import org.scanamo.syntax._ >>> import org.scanamo.auto._ >>> LocalDynamoDB.withRandomTableWithSecondaryIndex(client)('organisation -> S, 'repository -> S)('language -> S, 'license -> S) { (t, i) => ... val githubProjects = Table[GithubProject](t) ... val operations = for { ... _ <- githubProjects.putAll(Set( ... GithubProject("typelevel", "cats", "Scala", "MIT"), ... GithubProject("localytics", "sbt-dynamodb", "Scala", "MIT"), ... GithubProject("tpolecat", "tut", "Scala", "MIT"), ... GithubProject("guardian", "scanamo", "Scala", "Apache 2") ... )) ... scalaMIT <- githubProjects.index(i).query('language -> "Scala" and ('license -> "MIT")) ... } yield scalaMIT.toList ... scanamo.exec(operations) ... } List(Right(GithubProject(typelevel,cats,Scala,MIT)), Right(GithubProject(tpolecat,tut,Scala,MIT)), Right(GithubProject(localytics,sbt-dynamodb,Scala,MIT)))
-
abstract
def
scan(): ScanamoOps[List[Either[DynamoReadError, V]]]
Scan a secondary index
Scan a secondary index
This will only return items with a value present in the secondary index
>>> case class Bear(name: String, favouriteFood: String, antagonist: Option[String]) >>> val client = LocalDynamoDB.client() >>> val scanamo = Scanamo(client) >>> import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType._ >>> import org.scanamo.auto._ >>> LocalDynamoDB.withRandomTableWithSecondaryIndex(client)('name -> S)('antagonist -> S) { (t, i) => ... val table = Table[Bear](t) ... val ops = for { ... _ <- table.put(Bear("Pooh", "honey", None)) ... _ <- table.put(Bear("Yogi", "picnic baskets", Some("Ranger Smith"))) ... _ <- table.put(Bear("Paddington", "marmalade sandwiches", Some("Mr Curry"))) ... antagonisticBears <- table.index(i).scan() ... } yield antagonisticBears ... scanamo.exec(ops) ... } List(Right(Bear(Paddington,marmalade sandwiches,Some(Mr Curry))), Right(Bear(Yogi,picnic baskets,Some(Ranger Smith))))
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )