From f2f820370efbd5c6d0f304f781284a9f68990e21 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 11 Sep 2024 22:43:14 -0400 Subject: Wrap the database pool in an App struct. This is a jumping-off point for adding logic that needs more than just the DB for state, such as chat message handling. The name sucks, but it's the best I've got. --- src/app.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/app.rs (limited to 'src/app.rs') diff --git a/src/app.rs b/src/app.rs new file mode 100644 index 0000000..eff1b5e --- /dev/null +++ b/src/app.rs @@ -0,0 +1,12 @@ +use sqlx::sqlite::SqlitePool; + +#[derive(Clone)] +pub struct App { + pub db: SqlitePool, +} + +impl App { + pub fn from(db: SqlitePool) -> Self { + Self { db } + } +} -- cgit v1.2.3