Skip to content
This repository has been archived by the owner on Mar 31, 2019. It is now read-only.

Support for OrderBy StartAt EndAt #34

Merged
merged 3 commits into from
Dec 16, 2015
Merged

Conversation

crystalin
Copy link
Contributor

There is probably a better way to write it but this one is effective and easy to understand.

@crystalin
Copy link
Contributor Author

Maybe it worth including that the OrderBy requires quotes, Ex:
...OrderBy(""user_id"").StartAt("123456").EndAt("123456")

@zabawaba99
Copy link
Owner

Maybe it worth including that the OrderBy requires quotes

Looking at the firebase docs it looks like we don't need the escaped quotes when using OrderBy

curl 'https://dinosaur-facts.firebaseio.com/dinosaurs.json?orderBy="weight"&limitToLast=2&print=pretty' -v
*   Trying 104.197.145.189...
* Connected to dinosaur-facts.firebaseio.com (104.197.145.189) port 443 (#0)
* TLS 1.2 connection using TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.firebaseio.com
* Server certificate: RapidSSL SHA256 CA - G3
* Server certificate: GeoTrust Global CA
> GET /dinosaurs.json?orderBy="weight"&limitToLast=2&print=pretty HTTP/1.1
> Host: dinosaur-facts.firebaseio.com
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Length: 346
< Content-Type: application/json; charset=utf-8
< Cache-Control: no-cache
< Strict-Transport-Security: max-age=31556926; includeSubDomains; preload
<
{
  "bruhathkayosaurus" : {
    "appeared" : -70000000,
    "height" : 25,
    "length" : 44,
    "order" : "saurischia",
    "vanished" : -70000000,
    "weight" : 135000
  },
  "triceratops" : {
    "appeared" : -68000000,
    "height" : 3,
    "length" : 8,
    "order" : "ornithischia",
    "vanished" : -66000000,
    "weight" : 11000
  }
}

@zabawaba99
Copy link
Owner

There is probably a better way to write it but this one is effective and easy to understand.

I think that this is a great first step and get's the functionality out the door. Even if we decide to restructure this the API would end up staying the same. Could you please add a few tests similar to the shallow test?

@crystalin
Copy link
Contributor Author

I changed to use the param const as it was done for Shadow, and added some tests

@zabawaba99
Copy link
Owner

LGTM. Thanks for your contribution @crystalin

zabawaba99 added a commit that referenced this pull request Dec 16, 2015
Support for OrderBy StartAt EndAt
@zabawaba99 zabawaba99 merged commit 62badc7 into zabawaba99:master Dec 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants