fix: change Connection parameter to be passed by reference

This commit is contained in:
Mariano Riefolo 2024-08-10 12:04:28 +02:00
parent eee01a4941
commit 9cf526456a
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use rusqlite::{Connection, Result}; use rusqlite::{Connection, Result};
pub fn init(conn: Connection) -> Result<()> { pub fn init(conn: &Connection) -> Result<()> {
conn.execute( conn.execute(
"CREATE TABLE accounts ( "CREATE TABLE accounts (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,

View File

@ -4,5 +4,5 @@ mod db;
fn main() { fn main() {
let connection = Connection::open("database.db").expect("Failed to open database"); let connection = Connection::open("database.db").expect("Failed to open database");
db::init(connection).expect("Failed to create database"); db::init(&connection).expect("Failed to create database");
} }