mirror of
https://github.com/eliasrenman/r-database.git
synced 2026-03-16 20:46:08 +01:00
chore: cleanup
This commit is contained in:
@@ -42,11 +42,11 @@ impl Index {
|
|||||||
if index_row.is_none() {
|
if index_row.is_none() {
|
||||||
// Insert the new row into the index
|
// Insert the new row into the index
|
||||||
self.index_rows.insert(key, vec![pk_value]);
|
self.index_rows.insert(key, vec![pk_value]);
|
||||||
return Result::Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.unique {
|
if self.unique {
|
||||||
return Result::Err("Index is unique!");
|
return Err("Index is unique!");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut vector = index_row.unwrap().clone();
|
let mut vector = index_row.unwrap().clone();
|
||||||
@@ -61,7 +61,7 @@ impl Index {
|
|||||||
|
|
||||||
self.index_rows.insert(key, vector);
|
self.index_rows.insert(key, vector);
|
||||||
|
|
||||||
return Result::Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_pks_by_value(&self, value: Value) -> Option<&Vec<u64>> {
|
pub fn get_pks_by_value(&self, value: Value) -> Option<&Vec<u64>> {
|
||||||
|
|||||||
11
src/main.rs
11
src/main.rs
@@ -1,11 +1,3 @@
|
|||||||
macro_rules! hashmapJson {
|
|
||||||
($( $key: expr => $val: expr ),*) => {{
|
|
||||||
let mut map: ::std::collections::HashMap<String, ::serde_json::Value> = ::std::collections::HashMap::new();
|
|
||||||
$( map.insert($key.to_string(), serde_json::to_value($val).unwrap()); )*
|
|
||||||
map
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! row {
|
macro_rules! row {
|
||||||
($( $key: expr => $val: expr ),*) => {{
|
($( $key: expr => $val: expr ),*) => {{
|
||||||
let mut map: crate::database::row::Row = ::std::collections::HashMap::new();
|
let mut map: crate::database::row::Row = ::std::collections::HashMap::new();
|
||||||
@@ -16,8 +8,9 @@ macro_rules! row {
|
|||||||
|
|
||||||
macro_rules! hashmap {
|
macro_rules! hashmap {
|
||||||
($( $key: expr => $val: expr ),*) => {{
|
($( $key: expr => $val: expr ),*) => {{
|
||||||
|
#[allow(unused_mut)]
|
||||||
let mut map = ::std::collections::HashMap::new();
|
let mut map = ::std::collections::HashMap::new();
|
||||||
$( map.insert($key.to_string(), $val );)*
|
$( map.insert($key.to_string(), $val ); )*
|
||||||
map
|
map
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user