PartitionQuery
class PartitionQuery
PartitionQuery can be used to build a query with a window function See https://dev.mysql.com/doc/refman/8.0/en/window-functions.html for more details about window functions
TLDR: for each row from a query, perform a calculation using rows related to that row.
Practical example:
- show me the last 2 articles in each news category
- tell me the total articles in each category
$partitionQuery = PartitionQuery::fromQuery($articleQuery->withAutoSelects(),'category_id'); $partitionQuery->orderBy('published_at','DESC'); $partitionQuery->limit(2);
Note:
- when using the result in model context, you should make use of Query::withAutoSelects() otherwise timestamp and binary columns will not be converted as expected
Methods
No description
OrderBy without ALIAS as these will NOT be available internally
No description
No description
No description
No description
No description
No description
No description
Details
at line 162
array
execute()
No description
at line 52
static PartitionQuery
fromQuery(Query $query, string $partitionColumn)
No description
at line 88
string
getInternalOrderBySQL()
OrderBy without ALIAS as these will NOT be available internally
at line 80
string
getPartitionColumn()
No description
at line 179
array
getPartitionCounts()
No description
at line 175
string
getSQL()
No description
at line 97
array
getScopeLimit()
No description
at line 74
PartitionQuery
limit($length, $offset = 0)
No description
at line 64
PartitionQuery
orderBy(string $field, string $sortDirection = Query::SORT_ASCENDING)
No description
at line 59
PartitionQuery
setPartitionColumn(string $partitionColumn)
No description