add db structs
This commit is contained in:
parent
66a59df6ab
commit
805723f10d
2 changed files with 15 additions and 0 deletions
14
src/db.rs
Normal file
14
src/db.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
use chrono::{DateTime, Utc};
|
||||||
|
|
||||||
|
pub struct CacheRecord {
|
||||||
|
pub cache_name: CacheName,
|
||||||
|
pub uploaded: DateTime<Utc>,
|
||||||
|
// 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);
|
|
@ -1,4 +1,5 @@
|
||||||
pub mod cache;
|
pub mod cache;
|
||||||
|
pub mod db;
|
||||||
pub mod router;
|
pub mod router;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
Loading…
Reference in a new issue