reindeer 🦌 is a small entity-based embedded database with a minimal no-SQL relationnal model, written in pure Rust.
reindeer 🦌 lifts your
It relies on a trait,
Entity, to provide basic document store capabilities to any
serde-serializable struct that implements it.
You can then use
Entity::savemethod to save your struct instance to the database
Entity::getmethod to get any entity from the database using its unique key
Entity::get_allmethod to get all entities from the database using its unique key
Entity::get_with_filtermethod to get all entities that match a condition (O(n))
- … And much more!
Three types of relationships can be achieved :
- Sibling relationship : two or more
Entitystructs that share the same key type for which each entity has 0 or 1 counterpart in their sibling Entity stores (one-to-zero-or-one)
- Parent-Child relationship : An entity has a collection of matching entities in another Entity Store (one-to-many)
- Free relationship : Any two entities can be linked together as a two-way link. (many-to-many)
Those provide integrity checks in the form of a
DeletionBehaviour enum, that can either be :
DeletionBehaviour::Cascade: related entities are also removed if this one is removed
DeletionBehaviour::Error: Trying to remove this entity as related entities still exist will cause an error and abort
DeletionBehaviour::BreakLink: Remove this entity and the links with its related entites, leaving the other ones untouched
sleddatabase struct. It can be copied and used accross threads and is a central item to store entities. This is a re-export of
- Error type for
QueryBuilderis a convenient way to build query to target several conditions without the need to immediately serialize/deserialize data from disk. For simplicity’s sake, ids are expressed as
&[u8]. To get the key of an entity using this type, just use
- Enum for use in relation description, defining how the database must behave if one end of the relation is removed.
- Error kind enum for Reindeer-related errors.
- Trait allowing values to be converted to
Vec<u8>. This trait is not meant to be implemented, but you can if you need to.
AutoIncrementEntityis a trait aimed to automatically be implemented on Entities that have
Entitytrait provides document store capabilities for any struct that implements it.
- Opens a
sleddatabase to store Entities. The resulting Db object can be copied accross threads. This is a re-export of
- Type definition to simplify the use of Result everywhere in the library
- Derive macro for