Improve QueryResults

Make totalLength available on QueryResults promise and resolved results,
and make forEach available on QueryResults, and add tests, fixes #32