mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
make transactionable mathods static
This commit is contained in:
parent
bd6138fced
commit
a1f2d57b6d
12 changed files with 52 additions and 128 deletions
|
|
@ -11,10 +11,6 @@ pub struct Database {
|
|||
}
|
||||
|
||||
impl Database {
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
|
||||
pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
||||
tx.execute(
|
||||
"CREATE TABLE IF NOT EXISTS `app_browser_window_tab_label`
|
||||
|
|
@ -28,7 +24,6 @@ impl Database {
|
|||
}
|
||||
|
||||
pub fn add(
|
||||
&self,
|
||||
tx: &Transaction,
|
||||
app_browser_window_tab_id: &i64,
|
||||
is_pinned: &bool,
|
||||
|
|
@ -42,11 +37,7 @@ impl Database {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn records(
|
||||
&self,
|
||||
tx: &Transaction,
|
||||
app_browser_window_tab_id: &i64,
|
||||
) -> Result<Vec<Table>, Error> {
|
||||
pub fn records(tx: &Transaction, app_browser_window_tab_id: &i64) -> Result<Vec<Table>, Error> {
|
||||
let mut stmt = tx.prepare(
|
||||
"SELECT `id`,
|
||||
`app_browser_window_tab_id`,
|
||||
|
|
@ -72,7 +63,7 @@ impl Database {
|
|||
Ok(records)
|
||||
}
|
||||
|
||||
pub fn delete(&self, tx: &Transaction, id: &i64) -> Result<usize, Error> {
|
||||
pub fn delete(tx: &Transaction, id: &i64) -> Result<usize, Error> {
|
||||
tx.execute(
|
||||
"DELETE FROM `app_browser_window_tab_label` WHERE `id` = ?",
|
||||
[id],
|
||||
|
|
@ -80,7 +71,7 @@ impl Database {
|
|||
}
|
||||
|
||||
/* not in use
|
||||
pub fn last_insert_id(&self, tx: &Transaction) -> i64 {
|
||||
pub fn last_insert_id(tx: &Transaction) -> i64 {
|
||||
tx.last_insert_rowid()
|
||||
} */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue