mirror of
https://github.com/danog/postgres.git
synced 2024-11-27 04:24:45 +01:00
42 lines
785 B
PHP
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;
|
|
}
|