本文整理汇总了PHP中UUID::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP UUID::convert方法的具体用法?PHP UUID::convert怎么用?PHP UUID::convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UUID
的用法示例。
在下文中一共展示了UUID::convert方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSuper
/**
* Helper function to add a Super Column instance to this Super Column Family
* addSuper overrides the parent container reference in the object instance
* To add the same supercolumn instance to multiple columnfamilies, use object clones
* instead.
* @param PandraSuperColumn $scObj
* @return PandraSuperColumn
*/
public function addSuper(PandraSuperColumn $scObj)
{
$superName = $scObj->getName();
if ($this->getType() == self::TYPE_UUID && !UUID::isBinary($scObj->getName())) {
$scObj->setName(UUID::convert($scObj->getName(), UUID::UUID_FMT_BIN));
}
$scObj->setParent($this, false);
$this->_columns[$superName] = $scObj;
return $this->getColumn($superName);
}
示例2: remove
public static function remove($id)
{
try {
self::$cfAddress->remove('hasan', UUID::convert($id, UUID::FMT_STRING, UUID::FMT_BINARY));
return true;
} catch (Exception $e) {
var_dump($e);
return false;
}
}
示例3: testUUID
static function testUUID()
{
$id = UUID::generate(UUID::UUID_TIME, UUID::FMT_STRING, 'node', 'ns');
echo "{$id}\n";
$id = UUID::generate(UUID::UUID_TIME, UUID::FMT_STRING, 'node', 'ns');
echo "{$id}\n";
$id = UUID::generate(UUID::UUID_TIME, UUID::FMT_STRING, 'node', 'ns');
echo "{$id}\n";
$packid = UUID::convert($id, UUID::FMT_STRING, UUID::FMT_BINARY);
echo strlen($packid) . "\n";
echo UUID::convert($packid, UUID::FMT_BINARY, UUID::FMT_STRING) . "\n";
}
示例4: testSaveLoadDeleteUUID
public function testSaveLoadDeleteUUID()
{
$cf = new PandraColumnFamily($this->_keyID, 'Keyspace1', 'StandardByUUID1', PandraColumnContainer::TYPE_UUID);
$column = $cf->addColumn(UUID::v1());
$uuidName = UUID::convert($column->getName(), UUID_FMT_STR);
$cValue = 'test value';
$column->setValue($cValue);
$this->assertTrue($cf->save());
unset($cf);
$newCF = new PandraColumnFamily($this->_keyID, 'Keyspace1', 'StandardByUUID1', PandraColumnContainer::TYPE_UUID);
$newCF->load();
$this->assertEquals($cValue, $newCF[$uuidName]);
}
示例5: columnIn
/**
* Determins if column name exists in children at depth 1
* @param string $columnName column name
* @return bool column exists
*/
public function columnIn($columnName)
{
if (UUID::isBinary($columnName)) {
$columnName = UUID::convert($columnName, UUID::UUID_FMT_STR);
}
return array_key_exists($columnName, $this->_columns);
}
示例6: toGUID
public function toGUID()
{
return UUID::convert($this->id, UUID::FMT_BINARY, UUID::FMT_STRING);
}
示例7: unparse_column_name
public function unparse_column_name($column_name, $is_column = true)
{
if (!$this->parse_columns) {
return $column_name;
}
if (!$column_name) {
return NULL;
}
$type = $is_column ? $this->column_type : $this->subcolumn_type;
if ($type == "LexicalUUIDType" || $type == "TimeUUIDType") {
return UUID::convert($column_name, UUID::FMT_STRING, UUID::FMT_BINARY);
} else {
if ($type == "LongType") {
return pack("LL", $column_name, 0);
// FIXME: currently only supports 32 bit unsigned
} else {
return $column_name;
}
}
}
示例8: unparse_column_name
public function unparse_column_name($column_name, $is_column = true)
{
if (!$this->parse_columns) {
return $column_name;
}
if (!$column_name) {
return NULL;
}
$type = $is_column ? $this->column_type : $this->subcolumn_type;
if ($type == "LexicalUUIDType" || $type == "TimeUUIDType") {
return UUID::convert($column_name, UUID::FMT_STRING, UUID::FMT_BINARY);
} else {
if ($type == "LongType") {
return $this->pack_longtype($column_name);
} else {
return $column_name;
}
}
}
示例9: unparse_column_name
protected static function unparse_column_name($column_name, $type = CassandraCF::CT_BytesType)
{
if (!$column_name) {
return NULL;
}
if (UUID::isBinary($column_name)) {
return $column_name;
}
if ($type == self::CT_TimeUUIDType || $type == self::CT_LexicalUUIDType) {
return UUID::convert($column_name, UUID::FMT_STRING, UUID::FMT_BINARY);
} else {
if ($type == self::CT_LongType) {
return pack("N2", $column_name, 0);
// FIXME: currently only supports 32 bit unsigned
} else {
return $column_name;
}
}
}