Skip to content
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

Unifies SQLite and Postgres backend into a single docker image #397

Merged
merged 9 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed clippy.
  • Loading branch information
SamTV12345 committed Nov 8, 2023
commit e9157cc921c4acbea052c70a657e6e7d560b83cb
2 changes: 1 addition & 1 deletion src/dbconfig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ macro_rules! execute_with_conn {
($conn:expr, $diesel_func:expr) => {
match $conn {
DbConnection::Sqlite(conn) => {
return $diesel_func(conn)
return $diesel_func(conn)
},
DbConnection::Postgresql(conn) => {
return $diesel_func(conn)
Expand Down
6 changes: 3 additions & 3 deletions src/models/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ impl Device {
}
}

#[allow(clippy::redundant_closure_call)]
pub fn save(&self, conn: &mut DbConnection) -> Result<Device, diesel::result::Error> {
use crate::dbconfig::schema::devices::dsl::*;

execute_with_conn!(
conn, |conn| diesel::insert_into(devices)
.values(self)
.get_result(conn)
);
.values(self)
.get_result(conn));
}

pub fn get_devices_of_user(conn: &mut DbConnection, username_to_insert: String) ->
Expand Down
2 changes: 2 additions & 0 deletions src/models/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl Filter{
}
}

#[allow(clippy::redundant_closure_call)]
pub fn save_filter(self, conn: &mut DbConnection) -> Result<(), CustomError>{
use crate::dbconfig::schema::filters::dsl::*;

Expand All @@ -43,6 +44,7 @@ impl Filter{
.map_err(map_db_error)?;
},
None=>{

execute_with_conn!(conn, |conn| {diesel::insert_into(filters)
.values(self)
.execute(conn)
Expand Down
1 change: 1 addition & 0 deletions src/models/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct Playlist {
}

impl Playlist {
#[allow(clippy::redundant_closure_call)]
pub fn insert_playlist(&self, conn: &mut DbConnection) -> Result<Playlist, CustomError> {
use crate::dbconfig::schema::playlists::dsl::*;

Expand Down
1 change: 1 addition & 0 deletions src/models/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl Session{
}
}

#[allow(clippy::redundant_closure_call)]
pub fn insert_session(&self, conn: &mut DbConnection) -> Result<Self, diesel::result::Error>{

execute_with_conn!(conn,|conn|diesel::insert_into(sessions::table)
Expand Down
Loading