diff options
author | Teddy Wing | 2021-05-30 18:10:00 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-30 18:10:00 +0200 |
commit | 850b2aadd402ab80c0d2c371fe7be3066271a1ab (patch) | |
tree | c3d5965a1887351d95401a792c2c333d33d35ec0 /src/database.rs | |
parent | b7c396b9db42f60d091755eed547c295edd970ac (diff) | |
download | reflectub-850b2aadd402ab80c0d2c371fe7be3066271a1ab.tar.bz2 |
Only update repository description if the description changed
Check the repository description that comes back from the GitHub API
against our cached description in the database. Only write the new
description if it changed so we can avoid writing to the file in that
case.
Diffstat (limited to 'src/database.rs')
-rw-r--r-- | src/database.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/database.rs b/src/database.rs index 1dac44f..ac5ef3b 100644 --- a/src/database.rs +++ b/src/database.rs @@ -12,6 +12,14 @@ pub struct Repo { updated_at: Option<String>, } +impl Repo { + pub fn description(&self) -> &str { + self.description + .as_deref() + .unwrap_or("") + } +} + impl From<&github::Repo> for Repo { fn from(repo: &github::Repo) -> Self { Self { |