当前位置: 首页>>代码示例>>PHP>>正文


PHP Type::collection方法代码示例

本文整理汇总了PHP中Type::collection方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::collection方法的具体用法?PHP Type::collection怎么用?PHP Type::collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type::collection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nestedCassandraTypes

 /**
  * Nested composite Cassandra types (list, map, set, tuple, and UDT) to be
  * used by data providers
  */
 public function nestedCassandraTypes()
 {
     $compositeCassandraTypes = $this->compositeCassandraTypes();
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::collection($nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::set($nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::map($nestedType[0], $nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0], $nestedType[1][1])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::tuple($nestedType[0], $nestedType[0]);
         $nestedCassandraTypes[] = array($type, array($type->create($nestedType[1][0], $nestedType[1][1])));
     }
     foreach ($compositeCassandraTypes as $nestedType) {
         $type = Type::userType("a", $nestedType[0], "b", $nestedType[0]);
         $type = $type->withName(self::userTypeString($type));
         $nestedCassandraTypes[] = array($type, array($type->create("a", $nestedType[1][0], "b", $nestedType[1][1])));
     }
     return $nestedCassandraTypes;
 }
开发者ID:harley84,项目名称:php-driver,代码行数:30,代码来源:CollectionsIntegrationTest.php

示例2: compositeTypes

 public function compositeTypes()
 {
     $map_type = Type::map(Type::varchar(), Type::varchar());
     $set_type = Type::set(Type::varchar());
     $list_type = Type::collection(Type::varchar());
     $tuple_type = Type::tuple(Type::varchar(), Type::int());
     return array(array($map_type, $map_type->create("a", "1", "b", "2")), array($set_type, $set_type->create("a", "b", "c")), array($list_type, $list_type->create("a", "b", "c")), array($tuple_type, $tuple_type->create("a", 42)));
 }
开发者ID:datastax,项目名称:php-driver,代码行数:8,代码来源:TupleTest.php

示例3: notEqualTypes

 public function notEqualTypes()
 {
     $setType = Type::set(Type::int());
     return array(array(Type::collection(Type::int())->create(), Type::collection(Type::varchar())->create()), array(Type::collection(Type::int())->create(1, 2, 3), Type::collection(Type::int())->create(4, 5, 6)), array(Type::collection(Type::int())->create(1, 2, 3), Type::collection(Type::int())->create(1)), array(Type::collection(Type::varchar())->create('a', 'b', 'c'), Type::collection(Type::varchar())->create('a', 'b', 'd')), array(Type::collection($setType)->create($setType->create(1, 2, 3)), Type::collection($setType)->create($setType->create(4, 5, 6))));
 }
开发者ID:harley84,项目名称:php-driver,代码行数:5,代码来源:CollectionTest.php

示例4: compositeTypes

 public function compositeTypes()
 {
     return array(array(Type::map(Type::varchar(), Type::varchar())), array(Type::set(Type::varchar())), array(Type::collection(Type::varchar())));
 }
开发者ID:r3nat,项目名称:php-driver,代码行数:4,代码来源:SetTest.php

示例5: collectionWithNestedTypes

 /**
  * Data provider for lists with nested composite types
  */
 public function collectionWithNestedTypes()
 {
     return array_map(function ($cassandraType) {
         $listType = Type::collection($cassandraType[0]);
         $list = $listType->create();
         foreach ($cassandraType[1] as $value) {
             $list->add($value);
         }
         return array($listType, $list);
     }, $this->nestedCassandraTypes());
 }
开发者ID:harley84,项目名称:php-driver,代码行数:14,代码来源:CollectionIntegrationTest.php


注:本文中的Type::collection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。