uonedb-qt team mailing list archive
-
uonedb-qt team
-
Mailing list archive
-
Message #00011
Re: How to: Retrieving all docId in database
On 03/12/2013 07:52 AM, Kevin Wright wrote:
Today while trying to find a way of retrieving all the docId values in
the database I stumbled upon database.listDocs().
I forgot to mention the "how to" part of my how to.
listDocs() returns an array containing all the docId values in the
database. While very simple once the developer is aware of this it is
now also demonstrated in examples/u1db-qt-example-3.qml.
In the most recent update of the example (still waiting to be merged)
two functions loop through the docId values to identify the document
previous or next to the active document in the database.
Kevin
I was wondering if "listDocs" matches the principles outlined in the
"Six Characteristics of Good APIs" (http://bit.ly/15JhbaZ)?
It is said that APIs should not use abbreviations and should be intuitive.
I might have assumed something more along the lines of "getDocumentIds"
or possibly also an object (e.g. "documents" / "documentIds" -- not sure
if these semantics are correct).
Those suggested objects might contain either the document ID values or
the documents themselves (although the latter might consume more memory).
Perhaps at the end of this week we should review the current API
implementation before people start actively using it.
Kevin
Follow ups
References