-
Notifications
You must be signed in to change notification settings - Fork 13
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
Put reused filenames in constants #194
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,15 @@ | |
pub mod butane_migrations; | ||
pub mod models; | ||
|
||
use butane::_filenames::{BUTANE_DIRNAME, CONNECTION_JSON_FILENAME}; | ||
use butane::db::{Connection, ConnectionSpec}; | ||
use butane::prelude::*; | ||
use models::{Blog, Post}; | ||
|
||
/// Load a [Connection]. | ||
pub fn establish_connection() -> Connection { | ||
butane::db::connect(&ConnectionSpec::load(".butane/connection.json").unwrap()).unwrap() | ||
let connspec = format!("{BUTANE_DIRNAME}/{CONNECTION_JSON_FILENAME}"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO the fact that the examples need to include these strings feels like a problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
butane::db::connect(&ConnectionSpec::load(connspec).unwrap()).unwrap() | ||
} | ||
|
||
/// Create a [Blog]. | ||
|
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.
Using
_
to indicate semi-private nature