Use is_valid for Id
This commit is contained in:
1 parent
3cd7c12baa
commit
d3c28179b6
10 files changed
+36
-32
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use crate::lang::{WordData, WordGroup, INVALID_ID};
|
||||
use crate::lang::{INVALID_ID, WordData, WordGroup};
|
||||
use rusqlite::{Connection, params};
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -64,7 +64,7 @@ pub fn add_words(words: &mut [WordData], connection: &mut Connection) {
|
||||
}
|
||||
|
||||
pub fn update_word(word: &mut WordData, connection: &Connection) {
|
||||
if word.id == INVALID_ID {
|
||||
if !word.id.is_valid() {
|
||||
add_word(word, connection);
|
||||
} else {
|
||||
connection
|
||||
@@ -86,7 +86,7 @@ pub fn update_word(word: &mut WordData, connection: &Connection) {
|
||||
}
|
||||
|
||||
pub fn delete_word(word: &WordData, connection: &Connection) {
|
||||
if word.id == INVALID_ID {
|
||||
if !word.id.is_valid() {
|
||||
return;
|
||||
}
|
||||
connection
|
||||
@@ -160,7 +160,7 @@ pub fn add_group(group: &mut WordGroup, connection: &Connection) {
|
||||
}
|
||||
|
||||
pub fn update_group(group: &mut WordGroup, connection: &Connection) {
|
||||
if group.id == INVALID_ID {
|
||||
if !group.id.is_valid() {
|
||||
add_group(group, connection);
|
||||
} else {
|
||||
connection
|
||||
@@ -176,7 +176,7 @@ pub fn update_group(group: &mut WordGroup, connection: &Connection) {
|
||||
}
|
||||
|
||||
pub fn delete_group(group: &WordGroup, connection: &Connection) {
|
||||
if group.id == INVALID_ID {
|
||||
if !group.id.is_valid() {
|
||||
return;
|
||||
}
|
||||
connection
|
||||
|
||||
Reference in new issue
Block a user