fix: change Connection parameter to be passed by reference
This commit is contained in:
parent
eee01a4941
commit
9cf526456a
@ -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,
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user