Move database implementation out of core
This commit is contained in:
parent
bd7e9ceb4d
commit
6d1194226d
@ -1,10 +1,5 @@
|
|||||||
//! Module for storing MusicHoard data in a database.
|
//! Module for storing MusicHoard data in a database.
|
||||||
|
|
||||||
#[cfg(feature = "database-json")]
|
|
||||||
pub mod json;
|
|
||||||
#[cfg(feature = "database-json")]
|
|
||||||
mod serde;
|
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
@ -3,7 +3,7 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::core::database::json::IJsonDatabaseBackend;
|
use crate::database::json::IJsonDatabaseBackend;
|
||||||
|
|
||||||
/// JSON database backend that uses a local file for persistent storage.
|
/// JSON database backend that uses a local file for persistent storage.
|
||||||
pub struct JsonDatabaseFileBackend {
|
pub struct JsonDatabaseFileBackend {
|
4
src/database/mod.rs
Normal file
4
src/database/mod.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#[cfg(feature = "database-json")]
|
||||||
|
pub mod json;
|
||||||
|
#[cfg(feature = "database-json")]
|
||||||
|
mod serde;
|
@ -1,11 +1,13 @@
|
|||||||
//! MusicHoard - a music collection manager.
|
//! MusicHoard - a music collection manager.
|
||||||
|
|
||||||
mod core;
|
mod core;
|
||||||
|
pub mod database;
|
||||||
|
|
||||||
pub use core::collection;
|
pub use core::collection;
|
||||||
pub use core::database;
|
|
||||||
pub use core::library;
|
pub use core::library;
|
||||||
|
|
||||||
|
pub use core::database::{IDatabase, NullDatabase};
|
||||||
|
|
||||||
pub use core::musichoard::{
|
pub use core::musichoard::{
|
||||||
musichoard::{MusicHoard, NoDatabase, NoLibrary},
|
musichoard::{MusicHoard, NoDatabase, NoLibrary},
|
||||||
musichoard_builder::MusicHoardBuilder,
|
musichoard_builder::MusicHoardBuilder,
|
||||||
|
@ -10,10 +10,7 @@ use ratatui::{backend::CrosstermBackend, Terminal};
|
|||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
use musichoard::{
|
use musichoard::{
|
||||||
database::{
|
database::json::{backend::JsonDatabaseFileBackend, JsonDatabase},
|
||||||
json::{backend::JsonDatabaseFileBackend, JsonDatabase},
|
|
||||||
IDatabase, NullDatabase,
|
|
||||||
},
|
|
||||||
library::{
|
library::{
|
||||||
beets::{
|
beets::{
|
||||||
executor::{ssh::BeetsLibrarySshExecutor, BeetsLibraryProcessExecutor},
|
executor::{ssh::BeetsLibrarySshExecutor, BeetsLibraryProcessExecutor},
|
||||||
@ -21,7 +18,7 @@ use musichoard::{
|
|||||||
},
|
},
|
||||||
ILibrary, NullLibrary,
|
ILibrary, NullLibrary,
|
||||||
},
|
},
|
||||||
MusicHoardBuilder, NoDatabase, NoLibrary,
|
IDatabase, MusicHoardBuilder, NoDatabase, NoLibrary, NullDatabase,
|
||||||
};
|
};
|
||||||
|
|
||||||
use tui::{App, EventChannel, EventHandler, EventListener, Tui, Ui};
|
use tui::{App, EventChannel, EventHandler, EventListener, Tui, Ui};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use musichoard::{collection::Collection, database::IDatabase, library::ILibrary, MusicHoard};
|
use musichoard::{collection::Collection, library::ILibrary, IDatabase, MusicHoard};
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use mockall::automock;
|
use mockall::automock;
|
||||||
|
@ -5,10 +5,8 @@ use tempfile::NamedTempFile;
|
|||||||
|
|
||||||
use musichoard::{
|
use musichoard::{
|
||||||
collection::{album::AlbumDate, artist::Artist, Collection},
|
collection::{album::AlbumDate, artist::Artist, Collection},
|
||||||
database::{
|
database::json::{backend::JsonDatabaseFileBackend, JsonDatabase},
|
||||||
json::{backend::JsonDatabaseFileBackend, JsonDatabase},
|
IDatabase,
|
||||||
IDatabase,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::testlib::COLLECTION;
|
use crate::testlib::COLLECTION;
|
||||||
|
Loading…
Reference in New Issue
Block a user