-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/nanocld: namespace repository (#730)
* refactor/nanocld: namespace repository * refactor/nanocld: split repository delete
- Loading branch information
Showing
13 changed files
with
101 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,6 @@ async fn main() -> std::io::Result<()> { | |
} | ||
} | ||
} | ||
log::info!("shutdown"); | ||
log::info!("main: shutdown"); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod cargo; | ||
mod process; | ||
mod namespace; | ||
|
||
pub mod generic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use diesel::prelude::*; | ||
use nanocl_stubs::generic::GenericFilter; | ||
|
||
use crate::{models::NamespaceDb, schema::namespaces}; | ||
|
||
use super::generic::*; | ||
|
||
impl RepositoryBase for NamespaceDb {} | ||
|
||
impl RepositoryCreate for NamespaceDb {} | ||
|
||
impl RepositoryDelByPk for NamespaceDb {} | ||
|
||
impl RepositoryRead for NamespaceDb { | ||
type Output = NamespaceDb; | ||
type Query = namespaces::BoxedQuery<'static, diesel::pg::Pg>; | ||
|
||
fn gen_read_query(filter: &GenericFilter, is_multiple: bool) -> Self::Query { | ||
let mut query = namespaces::dsl::namespaces.into_boxed(); | ||
if is_multiple { | ||
query = query.order(namespaces::dsl::created_at.desc()); | ||
let limit = filter.limit.unwrap_or(100); | ||
query = query.limit(limit as i64); | ||
if let Some(offset) = filter.offset { | ||
query = query.offset(offset as i64); | ||
} | ||
} | ||
query | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.