diff --git a/src/db.rs b/src/db.rs new file mode 100644 index 0000000..1229eab --- /dev/null +++ b/src/db.rs @@ -0,0 +1,14 @@ +use chrono::{DateTime, Utc}; + +pub struct CacheRecord { + pub cache_name: CacheName, + pub uploaded: DateTime, + // This uses i32 because of how sqlx decodes unsigned integers to sqlite + // See: https://docs.rs/sqlx/latest/sqlx/sqlite/types/index.html + pub downloads: i32, + pub max_downloads: i32, +} + +#[derive(sqlx::Type)] +#[sqlx(transparent)] +pub struct CacheName(i32); diff --git a/src/lib.rs b/src/lib.rs index 560d3f5..4874d87 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ pub mod cache; +pub mod db; pub mod router; pub mod state; pub mod util;