Skip to content

Added support for Nulls First / Nulls Last#142

Closed
jcristovao wants to merge 2 commits intoPostgREST:masterfrom
jcristovao:nullsFirst
Closed

Added support for Nulls First / Nulls Last#142
jcristovao wants to merge 2 commits intoPostgREST:masterfrom
jcristovao:nullsFirst

Conversation

@jcristovao
Copy link
Copy Markdown
Contributor

So, this adds support for an optional nullsfirst or nullslast (verbose, I know, but it keeps in line with postgres terminology) parameter to the order parameters.

So, we can have:

GET /people?order=age.desc.nullsfirst,height.asc.nullslast

This is grouped with the previous PR, but as soon as you accept it I can make the necessary adjustments to this one.

I can also add tests, of course, I just would like to know which table should I use... can I add a nullable field to items?

Hope you find this useful,
Cheers

PS: I am also thinking about adding a isnull / isnotnull to the Filters, seems good?

@begriffs
Copy link
Copy Markdown
Member

This looks great! Just add some tests and I think it's good to merge. The no_pk table would work well for tests. It has two string columns a and b, either of which can be null.

@begriffs
Copy link
Copy Markdown
Member

If you're too busy right now to add tests and update the docs I can take care of it. Let me know.

@jcristovao
Copy link
Copy Markdown
Contributor Author

Hi, sorry, had a rather busy past week.
I'll try to add them this monday, I'll let you know then how it goes :)

Thanks

@jcristovao
Copy link
Copy Markdown
Contributor Author

Ok, added some tests, add to do some refactoring, please let me know if you are ok with it
Thanks!

@begriffs
Copy link
Copy Markdown
Member

begriffs commented Mar 4, 2015

Cool, thanks for the tests. Could you also rebase these commits against the new stuff on master? It no longer merges cleanly. I'd like to get this change into the next minor release which I'll be making soon.

@begriffs
Copy link
Copy Markdown
Member

I rebased this and merged to master. Thanks for the feature!

@begriffs begriffs closed this Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants