make generic DB implementation using macros... or ??? #3
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
see heromodels
make work for /Users/despiegk/code/git.ourworld.tf/herocode/db/heromodels/src/herodb = ourdb + tss
but also for other db Fjall
binary encoding
a performance test
branch db2
Pushed new branch https://git.ourworld.tf/herocode/db/src/branch/alternative_db_interface, which contains an altenrative implementation of DB (generic trait which can be implemented by multiple different backends if needed), and an implementation for OurDB + TST. The implementations uses generics to specify collections at compile time. Also added an Index trait linked to model implementations, which can be implemented on marker structs to specify index fields when doing get/delete operations. This could be extended to a procedural macro to auto generate the implementation of index marker structs if needed.
One issue in this implementation is that ourdb currently does not seem to support different keyspaces, so the object ID is shared between all different model types, and updating an object with one of a different type causes an error.
heromodels_core
. This is needed to allow procedural macro to work in any crate (both in heromodels itself, as well as potential other crates).heromodels_derive
crate which exposes amodel
procedural macro. This macro can be applied to structs to automatically generate theModel
implementation and the index implementations.#[index]
attributes can be applied to the required fields. The index markers are genrated in a public submodule to avoid name collisions, since the markers are generated snake case (to match the field declerations)The User and Comment implementation are updated to now use the procedural macro.
Check heromodels/example/basic_user_example.rs to see how to use it as a client
Check
heromodels/src/models/userxample/user.rs
to see the macro (or the new examples)All on branch alternative_db_implementation