1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-30 04:29:12 +01:00
postgres/lib/TupleResult.php
2017-05-25 22:47:49 -05:00

42 lines
785 B
PHP

<?php
namespace Amp\Postgres;
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}
*
* @return mixed[] Map of column values.
*/
public function getCurrent(): array {
return $this->iterator->getCurrent();
}
/**
* Returns the number of fields (columns) in each row.
*
* @return int
*/
abstract public function numFields(): int;
}