本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.Select类的典型用法代码示例。如果您正苦于以下问题:Java Select类的具体用法?Java Select怎么用?Java Select使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Select类属于com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了Select类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: details
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Directive> details(final long time) throws IOException {
final Iterator<Item> items = this.table()
.frame()
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(1)
)
.where("url", Conditions.equalTo(this.url))
.where("time", Conditions.equalTo(time))
.iterator();
if (!items.hasNext()) {
throw new IllegalArgumentException(
String.format(
"Request at %d for %s not found",
time, this.url
)
);
}
return DyStatus.xembly(items.next(), true);
}
开发者ID:yegor256,项目名称:rehttp,代码行数:23,代码来源:DyStatus.java
示例2: expired
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Take> expired() {
return new Mapped<>(
this.table()
.frame()
.through(
new QueryValve()
.withIndexName("expired")
.withConsistentRead(false)
.withSelect(Select.ALL_ATTRIBUTES)
)
.where("success", Conditions.equalTo(Boolean.toString(false)))
.where(
"when",
new Condition()
.withComparisonOperator(ComparisonOperator.LT)
.withAttributeValueList(
new AttributeValue().withN(
Long.toString(System.currentTimeMillis())
)
)
),
item -> new DyTake(item, this.delay)
);
}
开发者ID:yegor256,项目名称:rehttp,代码行数:26,代码来源:DyBase.java
示例3: scripts
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Iterable<Directive>> scripts() {
return new Mapped<Item, Iterable<Directive>>(
item -> new Directives()
.add("script")
.add("name").set(item.get("name").getS()).up()
.add("bash").set(item.get("bash").getS()).up()
.add("paid").set(item.get("paid").getN()).up()
.add("used").set(item.get("used").getN()).up()
.add("hour").set(item.get("hour").getN()).up()
.add("day").set(item.get("day").getN()).up()
.add("week").set(item.get("week").getN()).up()
.up(),
this.region.table("scripts")
.frame()
.through(
new QueryValve()
// @checkstyle MagicNumber (1 line)
.withLimit(10)
.withSelect(Select.ALL_ATTRIBUTES)
)
.where("login", this.login)
);
}
开发者ID:yegor256,项目名称:threecopies,代码行数:25,代码来源:DyUser.java
示例4: logs
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Iterable<Directive>> logs() {
return new Mapped<Item, Iterable<Directive>>(
item -> new Directives()
.add("log")
.add("group").set(item.get("group").getS()).up()
.add("start").set(item.get("start").getN()).up()
.add("finish").set(item.get("finish").getN()).up()
.add("period").set(item.get("period").getS()).up()
.add("ocket").set(item.get("ocket").getS()).up()
.add("exit").set(item.get("exit").getN()).up()
.up(),
this.region.table("logs")
.frame()
.through(
new QueryValve()
.withIndexName("mine")
// @checkstyle MagicNumber (1 line)
.withLimit(20)
.withConsistentRead(false)
.withScanIndexForward(false)
.withSelect(Select.ALL_ATTRIBUTES)
)
.where("login", this.login)
);
}
开发者ID:yegor256,项目名称:threecopies,代码行数:27,代码来源:DyUser.java
示例5: mine
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Domain> mine() {
return this.table()
.frame()
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(Tv.HUNDRED)
.withConsistentRead(false)
.withIndexName("mine")
)
.where("user", Conditions.equalTo(this.handle))
.stream()
.map(DyDomain::new)
.map(Domain.class::cast)
.collect(Collectors.toList());
}
开发者ID:yegor256,项目名称:jare,代码行数:18,代码来源:DyUser.java
示例6: domain
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Domain> domain(final String name) {
return this.table()
.frame()
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(1)
.withConsistentRead(true)
)
.where(
"domain",
Conditions.equalTo(name.toLowerCase(Locale.ENGLISH))
)
.stream()
.map(DyDomain::new)
.map(Domain.class::cast)
.collect(Collectors.toList());
}
开发者ID:yegor256,项目名称:jare,代码行数:20,代码来源:DyBase.java
示例7: iterate
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Pipe> iterate() {
return () -> this.table()
.frame()
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(Tv.HUNDRED)
.withConsistentRead(true)
)
.where("urn", Conditions.equalTo(this.urn))
.stream()
.map(DyPipe::new)
.map(Pipe.class::cast)
.iterator();
}
开发者ID:yegor256,项目名称:wring,代码行数:17,代码来源:DyPipes.java
示例8: iterate
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Event> iterate() {
return () -> this.table()
.frame()
.through(
new QueryValve()
.withLimit(Tv.TWENTY)
.withIndexName("top")
.withSelect(Select.ALL_ATTRIBUTES)
.withScanIndexForward(false)
.withConsistentRead(false)
)
.where("urn", Conditions.equalTo(this.urn))
.stream()
.map(DyEvent::new)
.map(Event.class::cast)
.iterator();
}
开发者ID:yegor256,项目名称:wring,代码行数:19,代码来源:DyEvents.java
示例9: getDictionaryEntry
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
/**
* Generate a list of attribute names found in the Aggregator's dynamo
* table. Assumes that all Items in the Aggregator table are of the same
* structure.
*
* @param dynamoClient
* Dynamo DB Client to use for connection to Dynamo DB.
* @param dynamoTable
* The Dynamo Table for the Aggregator
* @return A list of attribute names from the Dynamo table
* @throws Exception
*/
public static List<String> getDictionaryEntry(
final AmazonDynamoDB dynamoClient, final String dynamoTable)
throws Exception {
// get a list of all columns in the table, with keys first
List<String> columns = new ArrayList<>();
List<KeySchemaElement> keys = dynamoClient.describeTable(dynamoTable)
.getTable().getKeySchema();
for (KeySchemaElement key : keys) {
columns.add(key.getAttributeName());
}
ScanResult scan = dynamoClient.scan(new ScanRequest()
.withTableName(dynamoTable).withSelect(Select.ALL_ATTRIBUTES)
.withLimit(1));
List<Map<String, AttributeValue>> scannedItems = scan.getItems();
for (Map<String, AttributeValue> map : scannedItems) {
for (String s : map.keySet()) {
if (!columns.contains(s))
columns.add(s);
}
}
return columns;
}
开发者ID:awslabs,项目名称:amazon-kinesis-aggregators,代码行数:36,代码来源:DynamoUtils.java
示例10: getDictionaryEntry
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
/**
* Generate a list of attribute names found in the Aggregator's dynamo
* table. Assumes that all Items in the Aggregator table are of the same
* structure.
*
* @param dynamoClient Dynamo DB Client to use for connection to Dynamo DB.
* @param dynamoTable The Dynamo Table for the Aggregator
* @return A list of attribute names from the Dynamo table
* @throws Exception
*/
protected List<String> getDictionaryEntry() throws Exception {
// get a list of all columns in the table, with keys first
List<String> columns = new ArrayList<>();
List<KeySchemaElement> keys = dynamoClient.describeTable(this.tableName).getTable().getKeySchema();
for (KeySchemaElement key : keys) {
columns.add(key.getAttributeName());
}
ScanResult scan = dynamoClient.scan(new ScanRequest().withTableName(this.tableName).withSelect(
Select.ALL_ATTRIBUTES).withLimit(1));
List<Map<String, AttributeValue>> scannedItems = scan.getItems();
for (Map<String, AttributeValue> map : scannedItems) {
for (String s : map.keySet()) {
if (!columns.contains(s))
columns.add(s);
}
}
return columns;
}
开发者ID:awslabs,项目名称:amazon-kinesis-aggregators,代码行数:30,代码来源:DynamoDataStore.java
示例11: iterate
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Iterable<Deck> iterate() {
return Iterables.transform(
this.region.table(DyDeck.TBL)
.frame()
.through(new QueryValve().withSelect(Select.ALL_ATTRIBUTES))
.where(DyDeck.HASH, this.user),
new Function<Item, Deck>() {
@Override
public Deck apply(final Item input) {
try {
return DyDecks.this.get(input.get(DyDeck.RANGE).getS());
} catch (final IOException ex) {
throw new IllegalStateException(ex);
}
}
}
);
}
开发者ID:yegor256,项目名称:thindeck,代码行数:20,代码来源:DyDecks.java
示例12: item
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
/**
* Item.
* @return Item
*/
private Item item() {
final Iterator<Item> items = this.region
.table(DyDeck.TBL)
.frame()
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(1)
)
.where(DyDeck.HASH, this.user)
.where(DyDeck.RANGE, this.deck)
.iterator();
if (!items.hasNext()) {
throw new IllegalArgumentException(
String.format("deck '%s' not found", this.deck)
);
}
return items.next();
}
开发者ID:yegor256,项目名称:thindeck,代码行数:24,代码来源:DyDeck.java
示例13: target
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public Take target(final URL url, final long time) throws IOException {
final Iterator<Item> items = this.table()
.frame()
.through(
new QueryValve()
.withSelect(Select.ALL_ATTRIBUTES)
.withLimit(1)
)
.where("url", Conditions.equalTo(url))
.where("time", Conditions.equalTo(time))
.iterator();
final Item item;
if (items.hasNext()) {
item = items.next();
} else {
item = this.table().put(
new Attributes()
.with("url", url)
.with("time", time)
.with("code", 0)
.with("attempts", 0)
.with("when", System.currentTimeMillis())
.with(
"ttl",
(System.currentTimeMillis()
+ TimeUnit.DAYS.toMillis(1L))
/ TimeUnit.SECONDS.toMillis(1L)
)
);
}
return new DyTake(item, this.delay);
}
开发者ID:yegor256,项目名称:rehttp,代码行数:34,代码来源:DyBase.java
示例14: worst
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
/**
* Worst metrics.
* @return List of them
* @throws IOException If fails
*/
public Iterable<Iterable<Directive>> worst() throws IOException {
return new Mapped<>(
item -> new Directives()
.add("metric")
.attr("id", item.get("metric").getS())
.add("pos").set(item.get("pos").getN()).up()
.add("neg").set(item.get("neg").getN()).up()
.add("psum").set(new DyNum(item, "psum").doubleValue()).up()
.add("pavg").set(new DyNum(item, "pavg").doubleValue()).up()
.add("nsum").set(new DyNum(item, "nsum").doubleValue()).up()
.add("navg").set(new DyNum(item, "navg").doubleValue()).up()
.add("avg").set(new DyNum(item, "avg").doubleValue()).up()
.add("champions").set(item.get("champions").getN()).up()
.add("artifact").set(item.get("artifact").getS()).up()
.add("mean").set(new DyNum(item, "mean").doubleValue()).up()
.add("sigma").set(new DyNum(item, "sigma").doubleValue()).up()
.up(),
this.table.frame()
.where("version", new Version().value())
.through(
new QueryValve()
.withScanIndexForward(false)
.withIndexName("mistakes")
.withConsistentRead(false)
// @checkstyle MagicNumber (1 line)
.withLimit(20)
.withSelect(Select.ALL_ATTRIBUTES)
)
);
}
开发者ID:yegor256,项目名称:jpeek,代码行数:36,代码来源:Mistakes.java
示例15: QueryValve
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
/**
* Public ctor.
*/
public QueryValve() {
this(
Tv.TWENTY, true, new ArrayList<String>(0),
"", Select.SPECIFIC_ATTRIBUTES.toString(), true
);
}
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:10,代码来源:QueryValve.java
示例16: getLatestTweetsForScreenName
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
public QueryResult getLatestTweetsForScreenName(String screenName,
long timestamp) throws Exception {
try {
long startDateMilli = System.currentTimeMillis();
Map<String, Condition> keyConditions = new HashMap<String, Condition>();
keyConditions.put(
COL_SCREENNAME,
new Condition().withComparisonOperator(
ComparisonOperator.EQ).withAttributeValueList(
new AttributeValue().withS(screenName)));
keyConditions.put(
COL_CREATEDAT,
new Condition().withComparisonOperator(
ComparisonOperator.BETWEEN)
.withAttributeValueList(
new AttributeValue().withN(Long
.toString(timestamp)),
new AttributeValue().withN(Long
.toString(startDateMilli))));
QueryRequest queryRequest = new QueryRequest()
.withTableName(TABLE_NAME).withIndexName(INDEX_SCREENNAME)
.withKeyConditions(keyConditions)
.withSelect(Select.ALL_ATTRIBUTES)
.withScanIndexForward(true);
QueryResult result = dynamoDB.query(queryRequest);
return result;
} catch (Exception e) {
handleException(e);
}
return null;
}
开发者ID:dselman,项目名称:tweetamo,代码行数:38,代码来源:PersistentStore.java
示例17: add
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
/**
* Add one metric.
* @param metric XML with metric
* @throws IOException If fails
*/
private void add(final XML metric) throws IOException {
final Item item;
final Iterator<Item> items = this.table.frame()
.through(
new QueryValve()
.withLimit(1)
.withSelect(Select.ALL_ATTRIBUTES)
)
.where("metric", metric.xpath("@name").get(0))
.where("version", new Version().value())
.iterator();
if (items.hasNext()) {
item = items.next();
} else {
item = this.table.put(
new Attributes()
.with("metric", metric.xpath("@name").get(0))
.with("version", new Version().value())
.with("artifact", "?")
.with("champions", 0L)
// @checkstyle MagicNumber (2 lines)
.with("mean", new DyNum(0.5d).longValue())
.with("sigma", new DyNum(0.1d).longValue())
);
}
final double mean = Double.parseDouble(
metric.xpath("mean/text()").get(0)
);
final double sigma = Double.parseDouble(
metric.xpath("sigma/text()").get(0)
);
final boolean reverse = Boolean.parseBoolean(
metric.xpath("reverse/text()").get(0)
);
final double mbefore = new DyNum(item, "mean").doubleValue();
final double sbefore = new DyNum(item, "sigma").doubleValue();
// @checkstyle BooleanExpressionComplexityCheck (1 line)
if (sigma < sbefore || mean < mbefore && reverse
|| mean > mbefore && !reverse) {
item.put(
new AttributeUpdates()
.with("artifact", metric.xpath("/index/@artifact").get(0))
.with(
"champions",
new AttributeValueUpdate()
.withValue(new AttributeValue().withN("1"))
.withAction(AttributeAction.ADD)
)
.with("mean", new DyNum(mean).update())
.with("sigma", new DyNum(sigma).update())
);
}
}
开发者ID:yegor256,项目名称:jpeek,代码行数:59,代码来源:Sigmas.java
示例18: countItems
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
@Override
public int countItems(PageIterator pageIterator) {
return toCount(scan(new ScanSpec().withSelect(Select.COUNT), pageIterator));
}
开发者ID:Distelli,项目名称:java-persistence,代码行数:5,代码来源:DdbIndex.java
示例19: query
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
public static void query(String indexName) {
System.out.println("\n***********************************************************\n");
System.out.println("Querying table " + tableName + "...");
QueryRequest queryRequest = new QueryRequest()
.withTableName(tableName)
.withConsistentRead(true).withScanIndexForward(true)
.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
HashMap<String, Condition> keyConditions = new HashMap<String, Condition>();
keyConditions.put(
"CustomerId",
new Condition()
.withComparisonOperator(ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue()
.withS("[email protected]")));
if (indexName == "IsOpenIndex") {
System.out.println("\nUsing index: '" + indexName
+ "': Bob's orders that are open.");
System.out.println("Only a user-specified list of attributes are returned\n");
queryRequest.setIndexName(indexName);
keyConditions.put(
"IsOpen",
new Condition()
.withComparisonOperator(ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue().withN("1")));
// ProjectionExpression
queryRequest.setProjectionExpression("OrderCreationDate, ProductCategory, ProductName, OrderStatus");
} else if (indexName == "OrderCreationDateIndex") {
System.out.println("\nUsing index: '" + indexName
+ "': Bob's orders that were placed after 01/31/2013.");
System.out.println("Only the projected attributes are returned\n");
queryRequest.setIndexName(indexName);
keyConditions.put("OrderCreationDate", new Condition()
.withComparisonOperator(ComparisonOperator.GT)
.withAttributeValueList(new AttributeValue()
.withN("20130131")));
// Select
queryRequest.setSelect(Select.ALL_PROJECTED_ATTRIBUTES);
} else {
System.out.println("\nNo index: All of Bob's orders, by OrderId:\n");
}
queryRequest.setKeyConditions(keyConditions);
QueryResult result = client.query(queryRequest);
List<Map<String, AttributeValue>> items = result.getItems();
Iterator<Map<String, AttributeValue>> itemsIter = items.iterator();
while (itemsIter.hasNext()) {
Map<String, AttributeValue> currentItem = itemsIter.next();
Iterator<String> currentItemIter = currentItem.keySet().iterator();
while (currentItemIter.hasNext()) {
String attr = (String) currentItemIter.next();
if (attr == "OrderId" || attr == "IsOpen"
|| attr == "OrderCreationDate") {
System.out.println(attr + "---> "
+ currentItem.get(attr).getN());
} else {
System.out.println(attr + "---> "
+ currentItem.get(attr).getS());
}
}
System.out.println();
}
System.out.println("\nConsumed capacity: " + result.getConsumedCapacity() + "\n");
}
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:78,代码来源:LowLevelLocalSecondaryIndexExample.java
示例20: queryIndex
import com.amazonaws.services.dynamodbv2.model.Select; //导入依赖的package包/类
public static void queryIndex(String indexName) {
System.out.println
("\n***********************************************************\n");
System.out.print("Querying index " + indexName + "...");
QueryRequest queryRequest = new QueryRequest()
.withTableName(tableName)
.withIndexName(indexName)
.withScanIndexForward(true);
HashMap<String, Condition> keyConditions = new HashMap<String, Condition>();
if (indexName == "CreateDateIndex") {
System.out.println("Issues filed on 2013-11-01");
keyConditions.put("CreateDate",new Condition()
.withComparisonOperator(ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue()
.withS("2013-11-01")));
keyConditions.put("IssueId",new Condition()
.withComparisonOperator(ComparisonOperator.BEGINS_WITH)
.withAttributeValueList(new AttributeValue().withS("A-")));
} else if (indexName == "TitleIndex") {
System.out.println("Compilation errors");
keyConditions.put("Title",new Condition()
.withComparisonOperator( ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue()
.withS("Compilation error")));
keyConditions.put("IssueId", new Condition()
.withComparisonOperator(ComparisonOperator.BEGINS_WITH)
.withAttributeValueList(new AttributeValue().withS("A-")));
// Select
queryRequest.setSelect(Select.ALL_PROJECTED_ATTRIBUTES);
} else if (indexName == "DueDateIndex") {
System.out.println("Items that are due on 2013-11-30");
keyConditions.put("DueDate",new Condition()
.withComparisonOperator(ComparisonOperator.EQ)
.withAttributeValueList(new AttributeValue().withS("2013-11-30")));
// Select
queryRequest.setSelect(Select.ALL_PROJECTED_ATTRIBUTES);
} else {
System.out.println("\nNo valid index name provided");
return;
}
queryRequest.setKeyConditions(keyConditions);
QueryResult result = client.query(queryRequest);
List<Map<String, AttributeValue>> items = result.getItems();
Iterator<Map<String, AttributeValue>> itemsIter = items.iterator();
System.out.println();
while (itemsIter.hasNext()) {
Map<String, AttributeValue> currentItem = itemsIter.next();
Iterator<String> currentItemIter = currentItem.keySet().iterator();
while (currentItemIter.hasNext()) {
String attr = (String) currentItemIter.next();
if (attr == "Priority" ) {
System.out.println(attr + "---> " + currentItem.get(attr).getN());
} else {
System.out.println(attr + "---> " + currentItem.get(attr).getS());
}
}
System.out.println();
}
}
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:78,代码来源:LowLevelGlobalSecondaryIndexExample.java
注:本文中的com.amazonaws.services.dynamodbv2.model.Select类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论