Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
improved documentation for hash key as instance
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Jan 10, 2019
1 parent 8d69dff commit 077c777
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions docs/dynamodb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ interface DynamoDBItemDBService {
range { between DynamoDBEntity.DATE_INDEX, after, before }
}
})
Flowable<DynamoDBEntity> queryByDates(String hashKey, Date after, Date before)
List<DynamoDBEntity> queryByDates(String hashKey, Date after, Date before)
void delete(DynamoDBEntity entity)
void delete(String hashKey, String rangeKey)
Expand Down Expand Up @@ -228,7 +228,7 @@ public interface DynamoDBEntityService {
Flowable<DynamoDBEntity> queryByRangeIndex(String hashKey, String rangeKey);
@Query(BetweenDateIndex.class)
Flowable<DynamoDBEntity> queryByDates(String hashKey, Date after, Date before);
List<DynamoDBEntity> queryByDates(String hashKey, Date after, Date before);
void delete(DynamoDBEntity entity);
Expand Down Expand Up @@ -320,7 +320,7 @@ The following table summarizes the supported method signatures:
|
`Flowable<DynamoDBEntity> query(String hashKey)`

`Flowable<DynamoDBEntity> query(String hashKey, String rangeKey)`
`List<DynamoDBEntity> query(String hashKey, String rangeKey)`

| Queries for all entities with given hash key and/or range key.

Expand Down Expand Up @@ -367,7 +367,7 @@ include::../micronaut-aws-sdk/src/test/groovy/com/agorapulse/micronaut/aws/dynam
<5> Specify some range key criteria with the method's `rangeKey` argument (see https://agorapulse.github.io/micronaut-libraries/docs/javadoc/micronaut-aws-sdk/com/agorapulse/micronaut/aws/dynamodb/builder/RangeConditionCollector.html[RangeConditionCollector] for full reference)
<6> You can limit which properties are returned from the query
<7> Only `rangeIndex` property will be populated in the entities returned
<8> The arguments have no special meaning but you can use them in the query. The method must return `Flowable` of entities.
<8> The arguments have no special meaning but you can use them in the query. The method must return either `Flowable` or `List` of entities.


[source,java,indent=0,options="nowrap",role="secondary"]
Expand All @@ -388,7 +388,7 @@ include::../micronaut-aws-sdk/src/test/groovy/com/agorapulse/micronaut/aws/dynam
<5> Specify some range key criteria with the method's `rangeKey` argument (see https://agorapulse.github.io/micronaut-libraries/docs/javadoc/micronaut-aws-sdk/com/agorapulse/micronaut/aws/dynamodb/builder/RangeConditionCollector.html[RangeConditionCollector] for full reference)
<6> Only `rangeIndex` property will be populated in the entities returned
<7> `@Query` annotation accepts a class which implements `Function<Map<String, Object>, DetachedQuery>`
<8> The arguments have no special meaning but you can use them in the query using `arguments` map. The method must return `Flowable` of entities.
<8> The arguments have no special meaning but you can use them in the query using `arguments` map. The method must return either `Flowable` or `List` of entities.


===== Scanning
Expand All @@ -414,7 +414,7 @@ include::../micronaut-aws-sdk/src/test/groovy/com/agorapulse/micronaut/aws/dynam
<2> Annotate an interface with `@Service` with the type of the entity as its `value`
<3> `@Scan` annotation accepts a closure which returns a scan builder (see https://agorapulse.github.io/micronaut-libraries/docs/javadoc/micronaut-aws-sdk/com/agorapulse/micronaut/aws/dynamodb/builder/ScanBuilder.html[ScanBuilder] for full reference)
<4> Specify some filter criteria with the method's `foo` argument (see https://agorapulse.github.io/micronaut-libraries/docs/javadoc/micronaut-aws-sdk/com/agorapulse/micronaut/aws/dynamodb/builder/RangeConditionCollector.html[RangeConditionCollector] for full reference)
<5> The arguments have no special meaning but you can use them in the scan definition. The method must return `Flowable` of entities.
<5> The arguments have no special meaning but you can use them in the scan definition. The method must return either `Flowable` or `List` of entities.


[source,java,indent=0,options="nowrap",role="secondary"]
Expand All @@ -433,7 +433,7 @@ include::../micronaut-aws-sdk/src/test/groovy/com/agorapulse/micronaut/aws/dynam
<3> Use `Builders` class to create a scan builder for given DynamoDB entity (see https://agorapulse.github.io/micronaut-libraries/docs/javadoc/micronaut-aws-sdk/com/agorapulse/micronaut/aws/dynamodb/builder/ScanBuilder.html[ScanBuilder] for full reference)
<4> Specify some filter criteria with the method's `foo` argument (see https://agorapulse.github.io/micronaut-libraries/docs/javadoc/micronaut-aws-sdk/com/agorapulse/micronaut/aws/dynamodb/builder/RangeConditionCollector.html[RangeConditionCollector] for full reference)
<5> `@Scan` annotation accepts a class which implements `Function<Map<String, Object>, DetachedScan>`
<6> The arguments have no special meaning but you can use them in the scan definition. The method must return `Flowable` of entities.
<6> The arguments have no special meaning but you can use them in the scan definition. The method must return either `Flowable` or `List` of entities.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private Object doIntercept(MethodInvocationContext<Object, Object> context, Clas
}

if (methodName.startsWith("query") || methodName.startsWith("findAll") || methodName.startsWith("list")) {
return simpleHashAndRangeQuery(type, context).query(mapper);
return flowableOrList(simpleHashAndRangeQuery(type, context).query(mapper), context.getReturnType().getType());
}

throw new UnsupportedOperationException("Cannot implement method " + context.getExecutableMethod());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface QueryBuilder<T> extends DetachedQuery<T> {
*
* This parameter is required for every query.
*
* @param key the hash key of the query
* @param key the hash key of the query or an instance of the object with the hash key set
* @return self
*/
QueryBuilder<T> hash(Object key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface UpdateBuilder<T> extends DetachedUpdate<T> {

/**
* Sets the hash key value of the updated entity.
* @param key the hash key of the updated entity
* @param key the hash key of the query or an instance of the object with the hash key set
* @return self
*/
UpdateBuilder<T> hash(Object key);
Expand Down

0 comments on commit 077c777

Please sign in to comment.