Comments (5)
@cinnamon-bun Yes, this makes sense to me too!
I could implement this the way you suggest, but I have two thoughts:
- This approach hinges on the client having all documents available to sort.
- Sorting documents by the original publication date seems like a pattern that clients will want regularly, and requiring them to implement it themselves every time seems like it could be prone to error.
To expand on point one: at some point earthstar-graphql is going to return paginated connections for documents rather than any array with every document ever in it. There will still be ways to get every result in a single request, and I think this can be a valid approach with a client-side schema, but there are definitely UIs and situations you'll want only a portion of a workspace's documents at a time. At that point, you can't do things like client-side sorting of documents by publication date, because you won't have all docs available.
Secondly, if clients do this themselves they'll always have to store the timestamp somewhere, either in the document path or content, and for such a common use-case that seems a bit much to me.
I guess what I'm driving at is: could/should earthstar documents have an original publication date field?
from earthstar-lobby.
You're right! There will be a lot of cases like this where clients want to query by something that's not part of the core Document schema yet. Tags, categories, threads, creation timestamp, ...
I want to keep the core schema as small as possible, just what's needed for replication, so the specification can be stable.
I was considering adding a metadata
object that you could easily query:
{
path: "/posts/[email protected]/a93nhf-23jf9f-faj093j",
content: "OMG so true",
timestamp: 15000000077777, // when updated
metadata: {
// put your own data here and it will be queryable
creationTimestamp: 15000000000001,
category: "intros",
parentPost: "/posts/[email protected]/d923j-ajw049f-j328fa",
}
}
More details in earthstar-project/earthstar#9
from earthstar-lobby.
Oh, nice. How do you imagine querying for that, would that be an extra field on QueryOpts
?
from earthstar-lobby.
Yes, some built-in way to query and sort by this metadata. (Although we're on the verge of creating a full-fledged query language and I'd love to avoid that complexity.)
from earthstar-lobby.
I will do this the naive way by sorting all documents for now 😄
from earthstar-lobby.
Related Issues (9)
- Deleted posts come back HOT 3
- Input fields for logging in with author name and secret HOT 4
- Display name details HOT 3
- Deleted workspaces don't quite go away HOT 1
- A couple of workflow ideas HOT 1
- Preserve linebreaks in messages?
- Specification for lobby messages
- Can change anyone's displayNames because paths are missing the "~" for permissions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from earthstar-lobby.