feat: moving associated type working into the repository

This commit is contained in:
2024-06-01 17:37:50 +02:00
parent d1abc6b6c2
commit 1eea8b58c1
5 changed files with 92 additions and 78 deletions

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",