hyper opinions primary key data port #244
Replies: 5 comments 4 replies
-
https://docs.hyper.io/create-a-document
document ids should meet these standards. |
Beta Was this translation helpful? Give feedback.
-
A common pattern for uri key value pars with multiple values is |
Beta Was this translation helpful? Give feedback.
-
Thanks for taking the time to respond. I believe that purely from the adapter contributor's perspective, an array is a better choice for several reasons. The contributor does not have to read through docs to find the string format. I realize the string may be there for historical reasons and make a challenging update to the port for apps currently using hyper. Tyler proposed the idea of it working for both in a conversation we had. |
Beta Was this translation helpful? Give feedback.
-
I highly recommend we review standards, the one I lean to is
Here are more discussions: https://stackoverflow.com/questions/6243051/how-to-pass-an-array-within-a-query-string I know couchdb prefers |
Beta Was this translation helpful? Give feedback.
-
Is it a breaking change? I thought additions would be minor changes, because it does not currently break functionality and actually your could argue it is a patch, because it is specified to support the property keys, it is just ports and/or adapters don’t validate which is not a new feature but a bug
Those are my thoughts
…Sent from my iPhone
On Jul 6, 2021, at 11:35 PM, Tyler Hall ***@***.***> wrote:
Agree. 👍
We can see the hyper opine app passes req.query directly into the data service listDocuments here
This ultimately get's spread into the object passed to the adapter by hyper core here
I think we can make the change to app-opine to parse the req.query.keys into an array, which would just be a patch version bump. Then core wouldn't need to change. Finally the Data port definition would need to be updated, which would be a breaking change. Then each data port adapter would need to be updated as a breaking change.
TL;DR:
update app-opine (surprised it's not already performing this parsing 🤔 ) PATCH BUMP
update port-data listDocuments to accept keys as an array of strings MAJOR BUMP
update implementations of each data adapter MAJOR BUMP
Thoughts?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
The listDocument params contain startkey, endkey, and descending. This implies that the primary keys are sortable.
Does hyper have an opinion about what a primary key should look like? The docs usually use incrementing ints. Semantic strings could also be sortable. But is it acceptable in general within hyper to define a primary key as a random string or int? If so, the listDocuments may not use all the params regardless of adapter because startkey, endkey, and descending don't have any valuable meaning.
Assuming the "keys" param on the port is an array of keys, documents can be listed that way. Right now the type specified for "keys" is string. I wonder if this is supposed to be an array of strings, or if the adapter should split at a special character.
Beta Was this translation helpful? Give feedback.
All reactions