feat: moving associated type working into the repository
This commit is contained in:
@@ -10,6 +10,14 @@ impl Repository {}
|
||||
impl AdminRepository for Repository {
|
||||
type Key = i64;
|
||||
|
||||
fn key_from_string(&self, s: String) -> Option<Self::Key> {
|
||||
if let Ok(i) = s.parse::<i64>() {
|
||||
Some(i)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
async fn info(&self, _: &RepositoryContext) -> RepositoryInfo {
|
||||
RepoInfo {
|
||||
name: "My Empty Repository",
|
||||
|
||||
@@ -38,6 +38,14 @@ impl MyStaticRepository {
|
||||
impl AdminRepository for MyStaticRepository {
|
||||
type Key = i64;
|
||||
|
||||
fn key_from_string(&self, s: String) -> Option<Self::Key> {
|
||||
if let Ok(i) = s.parse::<i64>() {
|
||||
Some(i)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
async fn info(&self, _: &RepositoryContext) -> RepositoryInfo {
|
||||
RepoInfo {
|
||||
name: "My Static Repository",
|
||||
|
||||
@@ -21,6 +21,14 @@ impl UserRepository {
|
||||
impl AdminRepository for UserRepository {
|
||||
type Key = i64;
|
||||
|
||||
fn key_from_string(&self, s: String) -> Option<Self::Key> {
|
||||
if let Ok(i) = s.parse::<i64>() {
|
||||
Some(i)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
async fn info(&self, _: &RepositoryContext) -> RepositoryInfo {
|
||||
RepoInfo {
|
||||
name: "User",
|
||||
|
||||
Reference in New Issue
Block a user