-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom dbms pagination support through PaginatedQueryInterface
- Loading branch information
Showing
7 changed files
with
99 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of YaEtl | ||
* (c) Fabrice de Stefanis / https://github.com/fab2s/YaEtl | ||
* This source file is licensed under the MIT license which you will | ||
* find in the LICENSE file or at https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
namespace fab2s\YaEtl\Extractors; | ||
|
||
interface PaginatedQueryInterface | ||
{ | ||
/** | ||
* @return string the paginated query with current offset and limit | ||
*/ | ||
public function getPaginatedQuery(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of YaEtl | ||
* (c) Fabrice de Stefanis / https://github.com/fab2s/YaEtl | ||
* This source file is licensed under the MIT license which you will | ||
* find in the LICENSE file or at https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
namespace fab2s\YaEtl\Laravel\Extractors; | ||
|
||
use fab2s\NodalFlow\YaEtlException; | ||
use fab2s\YaEtl\Extractors\DbExtractorAbstract; | ||
use Illuminate\Database\Query\Builder; | ||
|
||
trait DelayedExtractQueryTrait | ||
{ | ||
/** | ||
* Set the extract query | ||
* | ||
* @param Builder $extractQuery | ||
* | ||
* @throws YaEtlException | ||
* | ||
* @return static | ||
*/ | ||
public function setExtractQuery($extractQuery): DbExtractorAbstract | ||
{ | ||
if (!($extractQuery instanceof Builder)) { | ||
throw new YaEtlException('Argument 1 passed to ' . __METHOD__ . ' must be an instance of ' . Builder::class . ', ' . \gettype($extractQuery) . ' given'); | ||
} | ||
|
||
if (!isset($this->pdo)) { | ||
$this->configurePdo($extractQuery->getConnection()->getPdo()); | ||
} | ||
|
||
parent::setExtractQuery($extractQuery); | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters