diff --git a/src/app.rs b/src/app.rs index 91455b52..64c62143 100644 --- a/src/app.rs +++ b/src/app.rs @@ -47,7 +47,7 @@ impl App { match connection.unchecked_transaction() { Ok(transaction) => { // Restore previous session from DB - match database::records(&transaction) { + match database::select(&transaction) { Ok(records) => { // Restore child components for record in records { @@ -82,7 +82,7 @@ impl App { // Create transaction match connection.transaction() { Ok(transaction) => { - match database::records(&transaction) { + match database::select(&transaction) { Ok(records) => { // Cleanup previous session records for record in records { @@ -100,7 +100,7 @@ impl App { } // Save current session to DB - match database::add(&transaction) { + match database::insert(&transaction) { Ok(_) => { // Delegate save action to childs if let Err(e) = browser.save( diff --git a/src/app/browser.rs b/src/app/browser.rs index 0a872537..723dd412 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -104,7 +104,7 @@ impl Browser { // Actions pub fn clean(&self, transaction: &Transaction, app_id: &i64) -> Result<(), String> { - match database::records(transaction, app_id) { + match database::select(transaction, app_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -127,7 +127,7 @@ impl Browser { } pub fn restore(&self, transaction: &Transaction, app_id: &i64) -> Result<(), String> { - match database::records(transaction, app_id) { + match database::select(transaction, app_id) { Ok(records) => { for record in records { // Delegate restore action to childs @@ -145,7 +145,7 @@ impl Browser { } pub fn save(&self, transaction: &Transaction, app_id: &i64) -> Result<(), String> { - match database::add(transaction, app_id) { + match database::insert(transaction, app_id) { Ok(_) => { let id = database::last_insert_id(transaction); diff --git a/src/app/browser/database.rs b/src/app/browser/database.rs index 5d4362b4..4de281ad 100644 --- a/src/app/browser/database.rs +++ b/src/app/browser/database.rs @@ -16,11 +16,11 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add(tx: &Transaction, app_id: &i64) -> Result { +pub fn insert(tx: &Transaction, app_id: &i64) -> Result { tx.execute("INSERT INTO `app_browser` (`app_id`) VALUES (?)", [app_id]) } -pub fn records(tx: &Transaction, app_id: &i64) -> Result, Error> { +pub fn select(tx: &Transaction, app_id: &i64) -> Result, Error> { let mut stmt = tx.prepare("SELECT `id`, `app_id` FROM `app_browser` WHERE `app_id` = ?")?; let result = stmt.query_map([app_id], |row| { diff --git a/src/app/browser/widget.rs b/src/app/browser/widget.rs index fa97bb4a..64f2b92e 100644 --- a/src/app/browser/widget.rs +++ b/src/app/browser/widget.rs @@ -42,7 +42,7 @@ impl Widget { // Actions pub fn clean(&self, transaction: &Transaction, app_browser_id: &i64) -> Result<(), String> { - match database::records(transaction, app_browser_id) { + match database::select(transaction, app_browser_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -61,7 +61,7 @@ impl Widget { } pub fn restore(&self, transaction: &Transaction, app_browser_id: &i64) -> Result<(), String> { - match database::records(transaction, app_browser_id) { + match database::select(transaction, app_browser_id) { Ok(records) => { for record in records { // Restore widget @@ -80,7 +80,7 @@ impl Widget { } pub fn save(&self, transaction: &Transaction, app_browser_id: &i64) -> Result<(), String> { - match database::add( + match database::insert( transaction, app_browser_id, &self.gobject.default_width(), diff --git a/src/app/browser/widget/database.rs b/src/app/browser/widget/database.rs index d1514d10..55374edc 100644 --- a/src/app/browser/widget/database.rs +++ b/src/app/browser/widget/database.rs @@ -22,7 +22,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, app_browser_id: &i64, default_width: &i32, @@ -45,7 +45,7 @@ pub fn add( ) } -pub fn records(tx: &Transaction, app_browser_id: &i64) -> Result, Error> { +pub fn select(tx: &Transaction, app_browser_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, `app_browser_id`, diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 7ad19cd7..f949d536 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -107,7 +107,7 @@ impl Window { } pub fn clean(&self, transaction: &Transaction, app_browser_id: &i64) -> Result<(), String> { - match database::records(transaction, app_browser_id) { + match database::select(transaction, app_browser_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -126,7 +126,7 @@ impl Window { } pub fn restore(&self, transaction: &Transaction, app_browser_id: &i64) -> Result<(), String> { - match database::records(transaction, app_browser_id) { + match database::select(transaction, app_browser_id) { Ok(records) => { for record in records { // Delegate restore action to childs @@ -140,7 +140,7 @@ impl Window { } pub fn save(&self, transaction: &Transaction, app_browser_id: &i64) -> Result<(), String> { - match database::add(transaction, app_browser_id) { + match database::insert(transaction, app_browser_id) { Ok(_) => { // Delegate save action to childs if let Err(e) = self diff --git a/src/app/browser/window/database.rs b/src/app/browser/window/database.rs index 01662c8b..8ce6f69b 100644 --- a/src/app/browser/window/database.rs +++ b/src/app/browser/window/database.rs @@ -16,14 +16,14 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add(tx: &Transaction, app_browser_id: &i64) -> Result { +pub fn insert(tx: &Transaction, app_browser_id: &i64) -> Result { tx.execute( "INSERT INTO `app_browser_window` (`app_browser_id`) VALUES (?)", [app_browser_id], ) } -pub fn records(tx: &Transaction, app_browser_id: &i64) -> Result, Error> { +pub fn select(tx: &Transaction, app_browser_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, `app_browser_id` FROM `app_browser_window` diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index f27850fe..eac3f048 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -248,7 +248,7 @@ impl Tab { transaction: &Transaction, app_browser_window_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_id) { + match database::select(transaction, app_browser_window_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -273,7 +273,7 @@ impl Tab { transaction: &Transaction, app_browser_window_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_id) { + match database::select(transaction, app_browser_window_id) { Ok(records) => { for record in records { match Item::restore( @@ -306,7 +306,7 @@ impl Tab { transaction: &Transaction, app_browser_window_id: &i64, ) -> Result<(), String> { - match database::add(transaction, app_browser_window_id) { + match database::insert(transaction, app_browser_window_id) { Ok(_) => { // Delegate save action to childs let id = database::last_insert_id(transaction); diff --git a/src/app/browser/window/tab/database.rs b/src/app/browser/window/tab/database.rs index 8acd69c4..2750f2ad 100644 --- a/src/app/browser/window/tab/database.rs +++ b/src/app/browser/window/tab/database.rs @@ -16,7 +16,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add(tx: &Transaction, app_browser_window_id: &i64) -> Result { +pub fn insert(tx: &Transaction, app_browser_window_id: &i64) -> Result { tx.execute( "INSERT INTO `app_browser_window_tab` ( `app_browser_window_id` @@ -25,7 +25,7 @@ pub fn add(tx: &Transaction, app_browser_window_id: &i64) -> Result Result, Error> { +pub fn select(tx: &Transaction, app_browser_window_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, `app_browser_window_id` FROM `app_browser_window_tab` diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 67727654..1e2714cb 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -108,7 +108,7 @@ impl Item { transaction: &Transaction, app_browser_window_tab_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_id) { + match database::select(transaction, app_browser_window_tab_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -139,7 +139,7 @@ impl Item { ) -> Result>, String> { let mut items = Vec::new(); - match database::records(transaction, app_browser_window_tab_id) { + match database::select(transaction, app_browser_window_tab_id) { Ok(records) => { for record in records { // Construct new item object @@ -182,7 +182,7 @@ impl Item { is_selected: &bool, is_attention: &bool, ) -> Result<(), String> { - match database::add( + match database::insert( transaction, app_browser_window_tab_id, page_position, diff --git a/src/app/browser/window/tab/item/database.rs b/src/app/browser/window/tab/item/database.rs index 5cd832cd..402896d4 100644 --- a/src/app/browser/window/tab/item/database.rs +++ b/src/app/browser/window/tab/item/database.rs @@ -23,7 +23,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, app_browser_window_tab_id: &i64, page_position: &i32, @@ -49,7 +49,7 @@ pub fn add( ) } -pub fn records(tx: &Transaction, app_browser_window_tab_id: &i64) -> Result, Error> { +pub fn select(tx: &Transaction, app_browser_window_tab_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, `app_browser_window_tab_id`, diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 1c99634e..f57f023b 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -295,7 +295,7 @@ impl Page { transaction: &Transaction, app_browser_window_tab_item_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_id) { + match database::select(transaction, app_browser_window_tab_item_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -323,7 +323,7 @@ impl Page { self.meta.set_status(Status::SessionRestore); // Begin page restore - match database::records(transaction, app_browser_window_tab_item_id) { + match database::select(transaction, app_browser_window_tab_item_id) { Ok(records) => { for record in records { // Delegate restore action to the item childs @@ -345,7 +345,7 @@ impl Page { transaction: &Transaction, app_browser_window_tab_item_id: &i64, ) -> Result<(), String> { - match database::add(transaction, app_browser_window_tab_item_id) { + match database::insert(transaction, app_browser_window_tab_item_id) { Ok(_) => { let id = database::last_insert_id(transaction); diff --git a/src/app/browser/window/tab/item/page/database.rs b/src/app/browser/window/tab/item/page/database.rs index 77ced91e..9c02a787 100644 --- a/src/app/browser/window/tab/item/page/database.rs +++ b/src/app/browser/window/tab/item/page/database.rs @@ -16,7 +16,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add(tx: &Transaction, app_browser_window_tab_item_id: &i64) -> Result { +pub fn insert(tx: &Transaction, app_browser_window_tab_item_id: &i64) -> Result { tx.execute( "INSERT INTO `app_browser_window_tab_item_page` ( `app_browser_window_tab_item_id` @@ -25,10 +25,7 @@ pub fn add(tx: &Transaction, app_browser_window_tab_item_id: &i64) -> Result Result, Error> { +pub fn select(tx: &Transaction, app_browser_window_tab_item_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, `app_browser_window_tab_item_id` diff --git a/src/app/browser/window/tab/item/page/meta.rs b/src/app/browser/window/tab/item/page/meta.rs index 2b6b9c76..67863baf 100644 --- a/src/app/browser/window/tab/item/page/meta.rs +++ b/src/app/browser/window/tab/item/page/meta.rs @@ -111,7 +111,7 @@ impl Meta { transaction: &Transaction, app_browser_window_tab_page_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_page_id) { + match database::select(transaction, app_browser_window_tab_page_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -134,7 +134,7 @@ impl Meta { transaction: &Transaction, app_browser_window_tab_page_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_page_id) { + match database::select(transaction, app_browser_window_tab_page_id) { Ok(records) => { for record in records { // Record value can be stored as NULL @@ -160,7 +160,7 @@ impl Meta { // Keep value in memory until operation complete let title = self.title(); - match database::add( + match database::insert( transaction, app_browser_window_tab_page_id, match title.is_empty() { diff --git a/src/app/browser/window/tab/item/page/meta/database.rs b/src/app/browser/window/tab/item/page/meta/database.rs index 8b7a8033..707f4cb9 100644 --- a/src/app/browser/window/tab/item/page/meta/database.rs +++ b/src/app/browser/window/tab/item/page/meta/database.rs @@ -18,7 +18,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, app_browser_window_tab_item_page_id: &i64, title: Option<&str>, @@ -32,7 +32,7 @@ pub fn add( ) } -pub fn records( +pub fn select( tx: &Transaction, app_browser_window_tab_item_page_id: &i64, ) -> Result, Error> { diff --git a/src/app/browser/window/tab/item/page/navigation.rs b/src/app/browser/window/tab/item/page/navigation.rs index fe61d952..b1d882ca 100644 --- a/src/app/browser/window/tab/item/page/navigation.rs +++ b/src/app/browser/window/tab/item/page/navigation.rs @@ -74,7 +74,7 @@ impl Navigation { transaction: &Transaction, app_browser_window_tab_item_page_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_page_id) { + match database::select(transaction, app_browser_window_tab_item_page_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -97,7 +97,7 @@ impl Navigation { transaction: &Transaction, app_browser_window_tab_item_page_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_page_id) { + match database::select(transaction, app_browser_window_tab_item_page_id) { Ok(records) => { for record in records { // Delegate restore action to the item childs @@ -115,7 +115,7 @@ impl Navigation { transaction: &Transaction, app_browser_window_tab_item_page_id: &i64, ) -> Result<(), String> { - match database::add(transaction, app_browser_window_tab_item_page_id) { + match database::insert(transaction, app_browser_window_tab_item_page_id) { Ok(_) => { let id = database::last_insert_id(transaction); diff --git a/src/app/browser/window/tab/item/page/navigation/database.rs b/src/app/browser/window/tab/item/page/navigation/database.rs index 036e4c73..68f9e491 100644 --- a/src/app/browser/window/tab/item/page/navigation/database.rs +++ b/src/app/browser/window/tab/item/page/navigation/database.rs @@ -16,7 +16,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add(tx: &Transaction, app_browser_window_tab_item_page_id: &i64) -> Result { +pub fn insert(tx: &Transaction, app_browser_window_tab_item_page_id: &i64) -> Result { tx.execute( "INSERT INTO `app_browser_window_tab_item_page_navigation` ( `app_browser_window_tab_item_page_id` @@ -25,7 +25,7 @@ pub fn add(tx: &Transaction, app_browser_window_tab_item_page_id: &i64) -> Resul ) } -pub fn records( +pub fn select( tx: &Transaction, app_browser_window_tab_item_page_id: &i64, ) -> Result, Error> { diff --git a/src/app/browser/window/tab/item/page/navigation/request.rs b/src/app/browser/window/tab/item/page/navigation/request.rs index 3aa96d22..0c6a4886 100644 --- a/src/app/browser/window/tab/item/page/navigation/request.rs +++ b/src/app/browser/window/tab/item/page/navigation/request.rs @@ -34,7 +34,7 @@ impl Request { transaction: &Transaction, app_browser_window_tab_item_page_navigation_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_page_navigation_id) { + match database::select(transaction, app_browser_window_tab_item_page_navigation_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -57,7 +57,7 @@ impl Request { transaction: &Transaction, app_browser_window_tab_item_page_navigation_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_page_navigation_id) { + match database::select(transaction, app_browser_window_tab_item_page_navigation_id) { Ok(records) => { for record in records { // Delegate restore action to the item childs @@ -75,7 +75,7 @@ impl Request { transaction: &Transaction, app_browser_window_tab_item_page_navigation_id: &i64, ) -> Result<(), String> { - match database::add(transaction, app_browser_window_tab_item_page_navigation_id) { + match database::insert(transaction, app_browser_window_tab_item_page_navigation_id) { Ok(_) => { let id = database::last_insert_id(transaction); diff --git a/src/app/browser/window/tab/item/page/navigation/request/database.rs b/src/app/browser/window/tab/item/page/navigation/request/database.rs index bd7980b1..4b0d0e67 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/database.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/database.rs @@ -16,7 +16,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, app_browser_window_tab_item_page_navigation_id: &i64, ) -> Result { @@ -28,7 +28,7 @@ pub fn add( ) } -pub fn records( +pub fn select( tx: &Transaction, app_browser_window_tab_item_page_navigation_id: &i64, ) -> Result, Error> { diff --git a/src/app/browser/window/tab/item/page/navigation/request/widget.rs b/src/app/browser/window/tab/item/page/navigation/request/widget.rs index 3a59bc51..234bd67f 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/widget.rs @@ -80,7 +80,7 @@ impl Widget { transaction: &Transaction, app_browser_window_tab_item_page_navigation_request_id: &i64, ) -> Result<(), String> { - match database::records( + match database::select( transaction, app_browser_window_tab_item_page_navigation_request_id, ) { @@ -106,7 +106,7 @@ impl Widget { transaction: &Transaction, app_browser_window_tab_item_page_navigation_request_id: &i64, ) -> Result<(), String> { - match database::records( + match database::select( transaction, app_browser_window_tab_item_page_navigation_request_id, ) { @@ -134,7 +134,7 @@ impl Widget { // Keep value in memory until operation complete let text = self.gobject.text(); - match database::add( + match database::insert( transaction, app_browser_window_tab_item_page_navigation_request_id, match text.is_empty() { diff --git a/src/app/browser/window/tab/item/page/navigation/request/widget/database.rs b/src/app/browser/window/tab/item/page/navigation/request/widget/database.rs index 522a8363..dbbce7de 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/widget/database.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/widget/database.rs @@ -18,7 +18,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, app_browser_window_tab_item_page_navigation_request_id: &i64, text: Option<&str>, @@ -32,7 +32,7 @@ pub fn add( ) } -pub fn records( +pub fn select( tx: &Transaction, app_browser_window_tab_item_page_navigation_request_id: &i64, ) -> Result, Error> { diff --git a/src/app/browser/window/tab/item/widget.rs b/src/app/browser/window/tab/item/widget.rs index 8ea8fdc1..e79b9d80 100644 --- a/src/app/browser/window/tab/item/widget.rs +++ b/src/app/browser/window/tab/item/widget.rs @@ -60,7 +60,7 @@ impl Widget { transaction: &Transaction, app_browser_window_tab_item_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_id) { + match database::select(transaction, app_browser_window_tab_item_id) { Ok(records) => { for record in records { match database::delete(transaction, &record.id) { @@ -83,7 +83,7 @@ impl Widget { transaction: &Transaction, app_browser_window_tab_item_id: &i64, ) -> Result<(), String> { - match database::records(transaction, app_browser_window_tab_item_id) { + match database::select(transaction, app_browser_window_tab_item_id) { Ok(records) => { for record in records { // Record value can be stored as NULL @@ -109,7 +109,7 @@ impl Widget { // Keep value in memory until operation complete let title = self.gobject.title(); - match database::add( + match database::insert( transaction, app_browser_window_tab_item_id, match title.is_empty() { diff --git a/src/app/browser/window/tab/item/widget/database.rs b/src/app/browser/window/tab/item/widget/database.rs index 943a583a..eab96004 100644 --- a/src/app/browser/window/tab/item/widget/database.rs +++ b/src/app/browser/window/tab/item/widget/database.rs @@ -18,7 +18,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, app_browser_window_tab_item_id: &i64, title: Option<&str>, @@ -32,10 +32,7 @@ pub fn add( ) } -pub fn records( - tx: &Transaction, - app_browser_window_tab_item_id: &i64, -) -> Result, Error> { +pub fn select(tx: &Transaction, app_browser_window_tab_item_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, `app_browser_window_tab_item_id`, diff --git a/src/app/database.rs b/src/app/database.rs index 82e67f69..3c46cc7d 100644 --- a/src/app/database.rs +++ b/src/app/database.rs @@ -14,11 +14,11 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add(tx: &Transaction) -> Result { +pub fn insert(tx: &Transaction) -> Result { tx.execute("INSERT INTO `app` DEFAULT VALUES", []) } -pub fn records(tx: &Transaction) -> Result, Error> { +pub fn select(tx: &Transaction) -> Result, Error> { let mut stmt = tx.prepare("SELECT `id` FROM `app`")?; let result = stmt.query_map([], |row| Ok(Table { id: row.get(0)? }))?; diff --git a/src/profile/bookmark/database.rs b/src/profile/bookmark/database.rs index b3e7f3b6..55b72e35 100644 --- a/src/profile/bookmark/database.rs +++ b/src/profile/bookmark/database.rs @@ -12,6 +12,8 @@ pub struct Bookmark { // nothing yet.. } +// Low-level DB API + pub fn init(tx: &Transaction) -> Result { tx.execute( "CREATE TABLE IF NOT EXISTS `profile_bookmark` @@ -25,7 +27,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, profile_id: &i64, time: &DateTime, @@ -41,7 +43,7 @@ pub fn add( ) } -pub fn records( +pub fn select( tx: &Transaction, profile_id: &i64, request: Option<&str>, diff --git a/src/profile/history/database.rs b/src/profile/history/database.rs index 57deb4a7..7f161dd8 100644 --- a/src/profile/history/database.rs +++ b/src/profile/history/database.rs @@ -12,6 +12,8 @@ pub struct History { // nothing yet.. } +// Low-level DB API + pub fn init(tx: &Transaction) -> Result { tx.execute( "CREATE TABLE IF NOT EXISTS `profile_history` @@ -25,7 +27,7 @@ pub fn init(tx: &Transaction) -> Result { ) } -pub fn add( +pub fn insert( tx: &Transaction, profile_id: &i64, time: &DateTime, @@ -41,7 +43,7 @@ pub fn add( ) } -pub fn records( +pub fn select( tx: &Transaction, profile_id: &i64, request: Option<&str>, diff --git a/src/profile/identity/database.rs b/src/profile/identity/database.rs index a6164ca1..8fb98a7a 100644 --- a/src/profile/identity/database.rs +++ b/src/profile/identity/database.rs @@ -5,6 +5,8 @@ pub struct Table { //pub profile_id: i64, } +// Low-level DB API + pub fn init(tx: &Transaction) -> Result { tx.execute( "CREATE TABLE IF NOT EXISTS `profile_identity`