1
0
mirror of https://github.com/danog/postgres.git synced 2024-12-15 19:07:26 +01:00
postgres/lib/TupleResult.php

42 lines
785 B
PHP
Raw Normal View History

2016-12-30 06:21:17 +01:00
<?php
2016-09-14 16:27:39 +02:00
namespace Amp\Postgres;
2017-05-16 06:14:02 +02:00
use Amp\Iterator;
use Amp\Promise;
abstract class TupleResult implements Iterator {
/** @var \Amp\Iterator */
private $iterator;
/**
* @param \Amp\Iterator $iterator
*/
public function __construct(Iterator $iterator) {
$this->iterator = $iterator;
}
/**
* {@inheritdoc}
*/
public function advance(): Promise {
return $this->iterator->advance();
}
/**
* {@inheritdoc}
2017-05-26 05:47:49 +02:00
*
* @return mixed[] Map of column values.
2017-05-16 06:14:02 +02:00
*/
2017-05-26 05:47:49 +02:00
public function getCurrent(): array {
2017-05-16 06:14:02 +02:00
return $this->iterator->getCurrent();
}
2016-09-14 16:27:39 +02:00
/**
* Returns the number of fields (columns) in each row.
*
* @return int
*/
abstract public function numFields(): int;
}