-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Moving client code to lib.rs #8
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, you moved the code to db/mod.rs
instead of lib.rs
.
Also, these won't be independent functions but methods on the Task
struct itself.
So, this would look something like:
impl Task {
pub fn create(...) -> Self {}
pub fn update(&mut self, ...) {}
}
But if they are functions on the database, then shouldn't they be in db module? |
I guess you could do it that way too. I prefer putting it in |
src/db/mod.rs
Outdated
dotenv().ok(); | ||
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've initialised a configuration module.
dotenv().ok(); | |
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); | |
let database_url = get_configuration().connection_string(); |
And cleanup the remaining code (like removing dotenv from cargo
No description provided.