From: Michael Wallner Date: Wed, 15 Oct 2014 13:48:31 +0000 (+0200) Subject: Rowset X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=ad7e7725e89db345df582aa07c563f24e95e357d;p=mdref%2Fmdref-pq-gateway Rowset --- diff --git a/pq-gateway/pq/Gateway/Rowset.md b/pq-gateway/pq/Gateway/Rowset.md index 2a43335..80d1762 100644 --- a/pq-gateway/pq/Gateway/Rowset.md +++ b/pq-gateway/pq/Gateway/Rowset.md @@ -1,4 +1,4 @@ -# class pq\Gateway\Rowset implements SeekableIterator, JsonSerialize, Countable +# class pq\Gateway\Rowset implements SeekableIterator, JsonSerializable, Countable The rowset gateway. diff --git a/pq-gateway/pq/Gateway/Rowset/__construct.md b/pq-gateway/pq/Gateway/Rowset/__construct.md new file mode 100644 index 0000000..f8a8b76 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/__construct.md @@ -0,0 +1,10 @@ +# void pq\Gateway\Rowset::__construct(pq\Gateway\Table $table[, pq\Result $result = NULL]) + +Create a new rowset gateway. + +## Params: + +* pq\Gateway\Table $table + The originating table. +* Optional pq\Result $result = NULL + A result to hydrate. diff --git a/pq-gateway/pq/Gateway/Rowset/__invoke.md b/pq-gateway/pq/Gateway/Rowset/__invoke.md new file mode 100644 index 0000000..96ad69a --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/__invoke.md @@ -0,0 +1,12 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::__invoke([pq\Result $result = NULL]) + +Copy constructor. + +## Params: + +* Optional pq\Result $result = NULL + The result the clone should hydrate. + +## Returns: + +* pq\Gateway\Rowset, clone. diff --git a/pq-gateway/pq/Gateway/Rowset/append.md b/pq-gateway/pq/Gateway/Rowset/append.md new file mode 100644 index 0000000..cff4b1b --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/append.md @@ -0,0 +1,12 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::append(pq\Gateway\Row $row) + +Append a row to the rowset. + +## Params: + +* pq\Gateway\Row $row + The row to append. + +## Returns: + +* pq\Gateway\Rowset, self. diff --git a/pq-gateway/pq/Gateway/Rowset/apply.md b/pq-gateway/pq/Gateway/Rowset/apply.md new file mode 100644 index 0000000..8ede9ab --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/apply.md @@ -0,0 +1,26 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::apply(callable $cb) + +Apply a callback to each row of this rowset. + +## Params: + +* callable $cb + A callback as function(pq\Gateway\Row $row, pq\Gateway\Rowset $rowset). + +## Returns: + +* pq\Gateway\Rowset, self. + +## Example: + + find()->apply(function($row) { + printf("Hello %s!\n", $row->name); + }); + + ?> + diff --git a/pq-gateway/pq/Gateway/Rowset/count.md b/pq-gateway/pq/Gateway/Rowset/count.md new file mode 100644 index 0000000..81babf3 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/count.md @@ -0,0 +1,11 @@ +# int pq\Gateway\Rowset::count() + +Implements Countable. + +## Params: + +None. + +## Returns: + +* int, the number of rows in this rowset. diff --git a/pq-gateway/pq/Gateway/Rowset/create.md b/pq-gateway/pq/Gateway/Rowset/create.md new file mode 100644 index 0000000..a20e706 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/create.md @@ -0,0 +1,12 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::create([mixed $txn = TRUE]) + +Create all rows in this rowset. + +## Params: + +* Optional mixed $txn = TRUE + Whether to perform the inserts within an transaction, could also be an instance of pq\Transaction to use. + +## Returns: + +* pq\Gateway\Rowset, self. diff --git a/pq-gateway/pq/Gateway/Rowset/current.md b/pq-gateway/pq/Gateway/Rowset/current.md new file mode 100644 index 0000000..2115d52 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/current.md @@ -0,0 +1,11 @@ +# pq\Gateway\Row pq\Gateway\Rowset::current() + +Implements Iterator. + +## Params: + +None. + +## Returns: + +* pq\Gateway\Row, the current iterator element. diff --git a/pq-gateway/pq/Gateway/Rowset/delete.md b/pq-gateway/pq/Gateway/Rowset/delete.md new file mode 100644 index 0000000..dc519b3 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/delete.md @@ -0,0 +1,12 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::delete([mixed $txn = TRUE]) + +Delete all rows in this rowset. + +## Params: + +* Optional mixed $txn = TRUE + Whether to perform the deletes within an transaction, could also be an instance of pq\Transaction to use. + +## Returns: + +* pq\Gateway\Rowset, self. diff --git a/pq-gateway/pq/Gateway/Rowset/filter.md b/pq-gateway/pq/Gateway/Rowset/filter.md new file mode 100644 index 0000000..def3a3c --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/filter.md @@ -0,0 +1,28 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::filter(callable $cb) + +Filter the rows a copy of the rowset should contain. + +## Params: + +* callable $cb + A filter callback which should return bool as function(pq\Gateway\Row $row) + +## Returns: + +* pq\Gateway\Rowset, clone. + +## Example: + + find() + ->apply(function($row) { + // ... + })->filter(function ($row) { + return $row->isDirty(); + })->update(); + + ?> diff --git a/pq-gateway/pq/Gateway/Rowset/getRowPrototype.md b/pq-gateway/pq/Gateway/Rowset/getRowPrototype.md new file mode 100644 index 0000000..554a63a --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/getRowPrototype.md @@ -0,0 +1,4 @@ +# mixed pq\Gateway\Rowset::getRowPrototype() + +Retrieve the row prototype. +See pq\Gatway\Rowset::setRowPrototype(). diff --git a/pq-gateway/pq/Gateway/Rowset/getRows.md b/pq-gateway/pq/Gateway/Rowset/getRows.md new file mode 100644 index 0000000..40ea179 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/getRows.md @@ -0,0 +1,11 @@ +# array pq\Gateway\Rowset::getRows() + +Retrieve the rows this rowset contains. + +## Params: + +None. + +## Returns: + +array, the rows of this rowset. diff --git a/pq-gateway/pq/Gateway/Rowset/getTable.md b/pq-gateway/pq/Gateway/Rowset/getTable.md new file mode 100644 index 0000000..4e64b36 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/getTable.md @@ -0,0 +1,11 @@ +# pq\Gateway\Table pq\Gateway\Rowset::getTable() + +Retrieve the table from which this rowset originates. + +## Params: + +None. + +## Returns: + +* pq\Gateway\Table, the originating table. diff --git a/pq-gateway/pq/Gateway/Rowset/hydrate.md b/pq-gateway/pq/Gateway/Rowset/hydrate.md new file mode 100644 index 0000000..ab68093 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/hydrate.md @@ -0,0 +1,12 @@ +# protected pq\Gateway\Rowset pq\Gateway\Rowset::hydrate([pq\Result $result = NULL]) + +Hydrate a result. + +## Params: + +* Optional pq\Result $result = NULL + The result from which to extract the rows into the rowset. + +## Returns: + +* pq\Gateway\Rowset, self. diff --git a/pq-gateway/pq/Gateway/Rowset/jsonSerialize.md b/pq-gateway/pq/Gateway/Rowset/jsonSerialize.md new file mode 100644 index 0000000..d99462d --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/jsonSerialize.md @@ -0,0 +1,11 @@ +# array pq\Gateway\Rowset::jsonSerialize() + +Implements JsonSerializable. + +## Params: + +None. + +## Returns: + +* array, list of rows, which have also been prepared for JSON serialization. diff --git a/pq-gateway/pq/Gateway/Rowset/key.md b/pq-gateway/pq/Gateway/Rowset/key.md new file mode 100644 index 0000000..88598a5 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/key.md @@ -0,0 +1,11 @@ +# int pq\Gateway\Rowset::key() + +Implements Iterator. + +## Params: + +None. + +## Returns: + +* int, the iterator index. diff --git a/pq-gateway/pq/Gateway/Rowset/next.md b/pq-gateway/pq/Gateway/Rowset/next.md new file mode 100644 index 0000000..9302884 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/next.md @@ -0,0 +1,7 @@ +# void pq\Gateway\Rowset::next() + +Implements Iterator. + +## Params: + +None. diff --git a/pq-gateway/pq/Gateway/Rowset/rewind.md b/pq-gateway/pq/Gateway/Rowset/rewind.md new file mode 100644 index 0000000..8798476 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/rewind.md @@ -0,0 +1,7 @@ +# void pq\Gateway\Rowset::rewind() + +Implements Iterator. + +## Params: + +None. diff --git a/pq-gateway/pq/Gateway/Rowset/seek.md b/pq-gateway/pq/Gateway/Rowset/seek.md new file mode 100644 index 0000000..fac1856 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/seek.md @@ -0,0 +1,12 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::seek(int $pos) + +Implements SeekableIterator. + +## Params: + +* int $pos + The position to seek to. + +## Returns: + +* pq\Gateway\Rowset, self. diff --git a/pq-gateway/pq/Gateway/Rowset/setRowPrototype.md b/pq-gateway/pq/Gateway/Rowset/setRowPrototype.md new file mode 100644 index 0000000..90bcda1 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/setRowPrototype.md @@ -0,0 +1,29 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::setRowPrototype(mixed $row) + +Set the row prototype. + +## Params: + +* mixed $row + The name of a class extending pq\Gateway\Row or a callable as function(array $data). + +## Returns: + +* pq\Gateway\Rowset, self. + +## Example: + + setRowsetPrototype( + (new gw\Rowset($table))->setRowPrototype(new Account($table)) + ); + + ?> diff --git a/pq-gateway/pq/Gateway/Rowset/update.md b/pq-gateway/pq/Gateway/Rowset/update.md new file mode 100644 index 0000000..3551e18 --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/update.md @@ -0,0 +1,12 @@ +# pq\Gateway\Rowset pq\Gateway\Rowset::update([mixed $txn = TRUE]) + +Update all rows in this rowset. + +## Params: + +* Optional mixed $txn = TRUE + Whether to perform the updates within an transaction, could also be an instance of pq\Transaction to use. + +## Returns: + +* pq\Gateway\Rowset, self. diff --git a/pq-gateway/pq/Gateway/Rowset/valid.md b/pq-gateway/pq/Gateway/Rowset/valid.md new file mode 100644 index 0000000..b84a25b --- /dev/null +++ b/pq-gateway/pq/Gateway/Rowset/valid.md @@ -0,0 +1,11 @@ +# bool pq\Gateway\Rowset::valid() + +Implements Iterator. + +## Params: + +None. + +## Returns: + +* bool, whether the iterator's state is valid.