本文整理汇总了PHP中Aws\DynamoDb\DynamoDbClient::formatValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DynamoDbClient::formatValue方法的具体用法?PHP DynamoDbClient::formatValue怎么用?PHP DynamoDbClient::formatValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aws\DynamoDb\DynamoDbClient
的用法示例。
在下文中一共展示了DynamoDbClient::formatValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* {@inheritDoc}
*/
public function update($storageName, $key, array $data)
{
$this->prepareData($key, $data);
unset($data['id']);
foreach ($data as $k => $v) {
$data[$k] = ['Value' => $this->client->formatValue($v)];
}
$result = $this->client->updateItem(['TableName' => $storageName, 'Key' => ['id' => ['S' => $key]], 'AttributeUpdates' => $data]);
}
示例2: update
/**
* {@inheritDoc}
*/
public function update($storageName, $key, array $data)
{
$this->prepareData($key, $data);
unset($data['id']);
foreach ($data as $k => $v) {
$data[$k] = array("Value" => $this->client->formatValue($v));
}
$result = $this->client->updateItem(array('TableName' => $storageName, 'Key' => array("id" => array('S' => $key)), "AttributeUpdates" => $data));
}
示例3: formatValue
/**
* Formats a value as a DynamoDB attribute
*
* @param mixed $value The value to format for DynamoDB.
* @param string $format The type of format (e.g. put, update).
*
* @return array The formatted value
*/
public function formatValue($value, $format = Attribute::FORMAT_PUT)
{
return $this->client->formatValue($value, $format);
}