mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
move is_needs_attention state to page, reorganize TabView access levels
This commit is contained in:
parent
8356c432c1
commit
25db274d2e
5 changed files with 158 additions and 191 deletions
|
|
@ -3,6 +3,7 @@ use sqlite::{Error, Transaction};
|
|||
pub struct Table {
|
||||
pub id: i64,
|
||||
// pub app_browser_window_tab_item_id: i64, not in use,
|
||||
pub is_needs_attention: bool,
|
||||
pub title: Option<String>,
|
||||
}
|
||||
|
||||
|
|
@ -10,11 +11,12 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
|||
tx.execute(
|
||||
"CREATE TABLE IF NOT EXISTS `app_browser_window_tab_item_page`
|
||||
(
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`app_browser_window_tab_item_id` INTEGER NOT NULL,
|
||||
`title` VARCHAR(1024),
|
||||
`is_needs_attention` INTEGER NOT NULL,
|
||||
`title` TEXT,
|
||||
|
||||
FOREIGN KEY (`app_browser_window_tab_item_id`) REFERENCES `app_browser_window_tab_item`(`id`)
|
||||
FOREIGN KEY (`app_browser_window_tab_item_id`) REFERENCES `app_browser_window_tab_item` (`id`)
|
||||
)",
|
||||
[],
|
||||
)
|
||||
|
|
@ -23,14 +25,16 @@ pub fn init(tx: &Transaction) -> Result<usize, Error> {
|
|||
pub fn insert(
|
||||
tx: &Transaction,
|
||||
app_browser_window_tab_item_id: i64,
|
||||
is_needs_attention: bool,
|
||||
title: Option<&str>,
|
||||
) -> Result<usize, Error> {
|
||||
tx.execute(
|
||||
"INSERT INTO `app_browser_window_tab_item_page` (
|
||||
`app_browser_window_tab_item_id`,
|
||||
`is_needs_attention`,
|
||||
`title`
|
||||
) VALUES (?, ?)",
|
||||
(app_browser_window_tab_item_id, title),
|
||||
) VALUES (?, ?, ?)",
|
||||
(app_browser_window_tab_item_id, is_needs_attention, title),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -38,6 +42,7 @@ pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<V
|
|||
let mut stmt = tx.prepare(
|
||||
"SELECT `id`,
|
||||
`app_browser_window_tab_item_id`,
|
||||
`is_needs_attention`,
|
||||
`title`
|
||||
FROM `app_browser_window_tab_item_page`
|
||||
WHERE `app_browser_window_tab_item_id` = ?",
|
||||
|
|
@ -47,7 +52,8 @@ pub fn select(tx: &Transaction, app_browser_window_tab_item_id: i64) -> Result<V
|
|||
Ok(Table {
|
||||
id: row.get(0)?,
|
||||
// app_browser_window_tab_item_id: row.get(1)?, not in use
|
||||
title: row.get(2)?,
|
||||
is_needs_attention: row.get(2)?,
|
||||
title: row.get(3)?,
|
||||
})
|
||||
})?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue