本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::formatAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::formatAttributes方法的具体用法?PHP DynamoDbClient::formatAttributes怎么用?PHP DynamoDbClient::formatAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\DynamoDb\DynamoDbClient
的用法示例。
在下文中一共展示了DynamoDbClient::formatAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
/**
* {@inheritdoc}
*/
protected function write(array $record)
{
$filtered = $this->filterEmptyFields($record['formatted']);
if ($this->version === 3) {
$formatted = $this->marshaler->marshalItem($filtered);
} else {
$formatted = $this->client->formatAttributes($filtered);
}
$this->client->putItem(['TableName' => $this->table, 'Item' => $formatted]);
}
示例2: testImplementsCustomExponentialBackoffStrategy
/**
* @depends testIteratesOverScan
*/
public function testImplementsCustomExponentialBackoffStrategy()
{
self::log('Getting an item a bunch of times in parallel');
$batch = BatchBuilder::factory()->transferCommands(100)->build();
$s = microtime(true);
$total = 300;
for ($i = 0; $i < $total; $i++) {
$command = $this->client->getCommand('GetItem', array('TableName' => $this->table, 'Key' => $this->client->formatAttributes(array('HashKeyElement' => 'Test', 'RangeKeyElement' => 10))));
$batch->add($command);
}
$retries = 0;
foreach ($batch->flush() as $command) {
$retries += $command->getRequest()->getParams()->get(BackoffPlugin::RETRY_PARAM);
}
$elapsed = microtime(true) - $s;
self::log("Got the item {$total} times with {$retries} retries in {$elapsed} seconds");
}
示例3: insert
/**
* {@inheritDoc}
*/
public function insert($storageName, $key, array $data)
{
$this->createTable($storageName);
$this->prepareData($key, $data);
$result = $this->client->putItem(['TableName' => $storageName, 'Item' => $this->client->formatAttributes($data), 'ReturnConsumedCapacity' => 'TOTAL']);
}
示例4: write
/**
* {@inheritdoc}
*/
protected function write(array $record)
{
$filtered = $this->filterEmptyFields($record['formatted']);
$formatted = $this->client->formatAttributes($filtered);
$this->client->putItem(array('TableName' => $this->table, 'Item' => $formatted));
}
示例5: formatAttributes
/**
* Formats an array of values as DynamoDB attributes.
*
* @param array $values The values to format for DynamoDB.
* @param string $format The type of format (e.g. put, update).
*
* @return array The formatted values
*/
public function formatAttributes(array $values, $format = Attribute::FORMAT_PUT)
{
return $this->client->formatAttributes($values, $format);
}