repox
Introduction
repox::is a trait interface framework for building repositories with different kinds of data access needs. This crate has three main goals:
- Provide application developers simple traits that describe what kind data access interface they need between entities and a repository.
- Supply tooling to make implementing and defining repositories and entities much easier by removing a lot of needless boilerplate.
- Maintain thorough, high-quality, documentation to lower the cognitive load on needing to remember constantly how to use features of this crate.
Simple Blog Example
Let's say you want to model blog posts for authors. Here is a simple example of how you might use
repox::to define your entities and repository interface for your application. This example demonstrates how to use the various traits and how they are used.// Define some simple entities for a blog application // Define the repository interface for the blog entities // <- Testing as a first-class citizen with mockall // Example usage of the BlogRepo async // Now bear witness to the power of documentation. Behold how we // can mock out the BlogRepo and test our example usage function // with nary a line of implementation code written! let mut blog = new; // I personally like to import these helpers, but you do you use ; // an author is born blog.expect_create_with .returning; // their first post... will be created blog.expect_create_with .returning; // an update will be made to the post, as it was foretold in the example blog. .returning; // data will be extracted for verification of the post and author blog.expect_fetch_with_parent_by_id .returning; // in a blind rage of drunken power; a deletion will occur... blog. .returning; // Now all will happen as it was documented, and our example // usage will be verified by these tests... That's Hawt 🔥 # block_on;
Documentation Prayer
By the documentation, they shall be known. With the documentation, they will be used. May the documented features of this project be a beacon to both man **and** machine. Let us rejoice as we read detailed documentation, and let us rejoice even more as we write it. By the Holy Documentation of the Omnissiah, may our code be free of heresy and our features catalogued in the Codex Repox. For the Machine Spirit rejoices in well-commented functions, and the Tech-Priests sing praises to the README eternal! By the documentation, they shall be known. With the documentation, they will be used.