Skip to content

allow objects in .orderBy #39

@Janpot

Description

@Janpot

If you want to order your result by 1 category at the top you can do something like

SELECT * FROM users ORDER BY country = 'US' DESC

or even

SELECT * FROM users ORDER BY country IN ('US', 'CA') DESC

It would be nice if we could specify these in an object like so

sql.select().from('users').orderBy({ country: 'US' });
sql.select().from('users').orderBy({ country: ['US', 'CA'] });

(There also doesn't seem to be a way to describe DESC or ASC)

now I have to do

sql.select().from('users').orderBy('country = "US" DESC');
sql.select().from('users').orderBy('country IN ("US", "CA") DESC');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions