本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::execute方法的具体用法?PHP DynamoDbClient::execute怎么用?PHP DynamoDbClient::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\DynamoDb\DynamoDbClient
的用法示例。
在下文中一共展示了DynamoDbClient::execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeCommand
/**
* Executes a synchronous command.
*
* @param CommandInterface $command Command to execute.
*
* @return AwsDynamoDbResponse
*/
protected function executeCommand(CommandInterface $command)
{
try {
$result = $this->client->execute($command);
} catch (AwsException $e) {
/* Return an error response. */
return new AwsDynamoDbResponse(null, $e);
}
return new AwsDynamoDbResponse($result, null);
}
示例2: listTables
/**
* @param string $pattern a pattern that table name should match, if emtpy, all tables will be returned
*
* @return array
*/
public function listTables($pattern = '/.*/')
{
$tables = [];
$lastEvaluatedTableName = null;
do {
$args = ["Limit" => 30];
if ($lastEvaluatedTableName) {
$args['ExclusiveStartTableName'] = $lastEvaluatedTableName;
}
$cmd = $this->db->getCommand('ListTables', $args);
$result = $this->db->execute($cmd);
if (isset($result['LastEvaluatedTableName'])) {
$lastEvaluatedTableName = $result['LastEvaluatedTableName'];
} else {
$lastEvaluatedTableName = null;
}
foreach ($result['TableNames'] as $tableName) {
if (preg_match($pattern, $tableName)) {
$tables[] = $tableName;
}
}
} while ($lastEvaluatedTableName != null);
return $tables;
}