I'm building a web service that uses Diesel to access a MySQL database. Everything is setup correctly and Diesel is generating the schema.rs file with content that reflects my database schema:
table! {
user (id) {
// ...
}
}
I created a store.rs file that resides next to main.rs. If my understanding of modules is correct, any code I put in the store.rs file, will belong to a module named store that is a child of the crate module. My intention is to put all the code that deals with database stuff in the store module. However, I can't seem to be able to use the stuff from the schema module in my store module to start doing some querying using the Diesel APIs.
I tried:
use schema;use crate::schema;use super::schema;use super::schema::user;
Nothing works. The compiler always says that it cannot resolve one piece of the path or another.
What is the proper way to reference a sibling module in Rust?