Skip to content

Add SQL expression to Sort config #129

@olegbaturin

Description

@olegbaturin

Proposed new feature or change

Add the ability to provide array|string|ExpressionInterface as the sort direction, which will be used as a parameter for Query::orderBy().

'name' => [
    'asc' => new Expression("(substring(name, '^[0-9]+'))::int ASC, lower(name) ASC, LENGTH(name) ASC, split_part(name, '/', 2) ASC"),
    'desc' => new Expression("(substring(name, '^[0-9]+'))::int DESC, lower(name) DESC, LENGTH(name) DESC, split_part(name, '/', 2) DESC"),
],

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions