本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::scan方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::scan方法的具体用法?PHP DynamoDbClient::scan怎么用?PHP DynamoDbClient::scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\DynamoDb\DynamoDbClient
的用法示例。
在下文中一共展示了DynamoDbClient::scan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJobsToFetchStatsFor
/**
* Scans table for specific items we want to update
* @return array
*/
private function getJobsToFetchStatsFor()
{
$params = ['TableName' => $this->tableName, 'FilterExpression' => <<<EXPR
attribute_exists(sapiProjectId)
and attribute_not_exists(componentName)
and not begins_with(runId, :notBeginsWith)
and (
attribute_not_exists(syrupJobId)
or
(attribute_exists(syrupJobId) and syrupJobId <> :syrupJobIdSyncAction)
)
and attribute_not_exists(hasSyrupJob)
EXPR
, 'Limit' => self::MAX_DOCUMENTS_TO_PROCESS, 'ExpressionAttributeValues' => [':notBeginsWith' => ['S' => 'p'], ':syrupJobIdSyncAction' => ['S' => '0']]];
$ids = [];
$marshaler = new Marshaler();
do {
if (isset($response) && isset($response['LastEvaluatedKey'])) {
$params['ExclusiveStartKey'] = $response['LastEvaluatedKey'];
}
$response = $this->dynamoDbClient->scan($params);
foreach ($response['Items'] as $item) {
$ids[] = $marshaler->unmarshalValue($item['runId']);
}
} while (isset($response['LastEvaluatedKey']) && count($ids) <= 5000);
return $ids;
}
示例2: scan
/**
* Get items via the scan call
* @param string $table The item table
* @param Context\Scan|null $context The call context
* @return Collection
*/
public function scan($table, Context\Scan $context = null)
{
if (null !== $this->logger) {
$this->log('Scan on table ' . $table);
}
$parameters = array('TableName' => $table);
if (null !== $context) {
$parameters += $context->getForDynamoDB();
}
if (null !== $this->logger) {
$this->log('Scan request paramaters : ' . print_r($parameters, true), Logger::DEBUG);
}
$response = $this->connector->scan($parameters);
if (null !== $this->logger) {
$this->log('Scan request response : ' . print_r($response, true), Logger::DEBUG);
$this->log($response['ScannedCount'] . ' scanned items');
}
$this->addConsumedReadUnits($table, floatval($response['ConsumedCapacityUnits']));
if (isset($response['LastEvaluatedKey'])) {
if (null === $context) {
$nextContext = new Context\Scan();
} else {
$nextContext = clone $context;
}
$nextContext->setExclusiveStartKey($response['LastEvaluatedKey']);
if (null !== $this->logger) {
$this->log('More Items to retrieve');
}
} else {
$nextContext = null;
}
$items = new Collection($nextContext, $response['Count']);
if (!empty($response['Items'])) {
foreach ($response['Items'] as $responseItem) {
$item = new Item($table);
$item->populateFromDynamoDB($responseItem);
$items->add($item);
}
}
if (null !== $this->logger) {
$this->log('Find ' . count($items) . ' Items');
}
return $items;
}
示例3: scan
/**
* Executes the Scan operation.
*
* @param string $tableName The name of the table containing the requested items.
* @param array $args Arguments of the query
*
* @return Guzzle\Service\Resource\Model
*
* @see http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.DynamoDb.DynamoDbClient.html#_scan
*/
public function scan($tableName, array $args)
{
$args['TableName'] = $tableName;
return $this->client->scan($args);
}