khonsulabs / bonsaidb

A developer-friendly document database that grows with you, written in Rust
https://bonsaidb.io/
Apache License 2.0
1.02k stars 37 forks source link

Support retrieivng mapped/projected data from a document #194

Open ecton opened 2 years ago

ecton commented 2 years ago

We should offer a way to return data that is a query within the documents.

My current thoughts on this is to adopt an approach similar to GraphQL. A simple "Queryable" trait that allows a collection to respond to individual field queries, and a "Mutable" trait that allows mutation operations to be written.

When designing the traits, we should consider how a proc-macro could be used to generate the traits automatically by annotating a type with the extra information needed.

ecton commented 2 years ago

As per Discord, a proc-macro that allowed mapping/projecting data would also be able to provide basic View code generation.