aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.rs
AgeCommit message (Collapse)Author
2021-06-06database: Add documentation headersTeddy Wing
2021-05-30Only update repository description if the description changedTeddy Wing
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.
2021-05-30database::repo_update(): Fix SQL `UPDATE` queryTeddy Wing
Forgot to add commas when I added the additional fields.
2021-05-30database: Always try to create the database and tablesTeddy Wing
This is simpler, and means we don't have to check if the database file exists and only initialise if it doesn't. Here, we can just run the code and trust it will do the right thing in both cases.
2021-05-30database: Add repo description to `repositories` tableTeddy Wing
Store the repository description so we can check whether the description was updated and copy it in our mirror accordingly.
2021-05-30main: Mirror new repositoriesTeddy Wing
If we haven't encountered a repository yet, mirror it to the filesystem. Change `From<github::Repo>` to `From<&github::Repo>` so we don't consume the repo and can use it later in the repo list loop.
2021-05-30main: If repo was updated, save new `updated_at` valueTeddy Wing
If the repo was updated since we last cached it, update the `updated_at` column to the new value so we know that we fetched the latest.
2021-05-30database::repo_is_updated: Use `fetch_optional`Teddy Wing
I think I like this better than checking the `RowNotFound` error.
2021-05-30Check if repo was updated based on `updated_at` timestampTeddy Wing
Find out if the latest copy is more recent than the cached value in our database.
2021-05-30database: Use a custom `Error` typeTeddy Wing
Get rid of the boxed errors to make matching on errors easier.
2021-05-30database: Implement `From<github::Repo>` for `database::Repo`Teddy Wing
2021-05-30database: Change `GithubRepo` arguments to `Repo`Teddy Wing
Also change `repo_insert()` to take only a single repo instead of a slice of them.
2021-05-30database::Repo: Make `id` non-optionalTeddy Wing
2021-05-30database::repo_get: Don't need my own error for empty rowTeddy Wing
Sqlx already returns an appropriate error if no row was found.
2021-05-30database: Add a way to get a single repoTeddy Wing
2021-05-29Create SQLite databaseTeddy Wing
Set up the database with a table for repositories so we can cache when they were last updated.
2021-05-29Start setting up database interfaceTeddy Wing