chore: upgrade rusqlite dependency to 0.38.0

This commit is contained in:
2026-01-12 14:25:18 +01:00
parent 3b3e495254
commit b59cb0fb56
17 changed files with 183 additions and 52 deletions

View File

@@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024"
[dependencies]
rusqlite = { version = "0.37.0", features = ["bundled"] }
rusqlite = { version = "0.38.0", features = ["bundled"] }

View File

@@ -8,7 +8,7 @@ struct Component {
pub id: String,
pub part_number: String,
pub kind: String,
pub value: u64,
pub value: u32,
pub package: String,
pub in_stock: bool,
}

View File

@@ -8,21 +8,21 @@ use std::path::Path;
struct Laptop {
pub id: String,
pub model: String,
pub price: u64,
pub price: u32,
}
#[derive(PartialEq, Clone)]
struct Display {
pub id: String,
pub model: String,
pub resolution: f64,
pub price: u64,
pub price: u32,
}
#[derive(PartialEq, Clone)]
struct Mouse {
pub id: String,
pub model: String,
pub wireless: bool,
pub price: u64,
pub price: u32,
}
#[derive(PartialEq, Clone)]
enum Product {

View File

@@ -4,7 +4,7 @@ pub fn run(row: &rusqlite::Row) -> rusqlite::Result<Attribute> {
let id: String = row.get(0)?;
let _entity_id: String = row.get(1)?;
let signed_int: Option<i64> = row.get(2)?;
let unsigned_int: Option<u64> = row.get(3)?;
let unsigned_int: Option<u32> = row.get(3)?;
let real: Option<f64> = row.get(4)?;
let text: Option<String> = row.get(5)?;
let bool: Option<bool> = row.get(6)?;

View File

@@ -4,7 +4,7 @@ pub fn run(row: &rusqlite::Row) -> rusqlite::Result<Entity> {
let id: String = row.get(0)?;
let class: String = row.get(1)?;
let subclass: Option<String> = row.get(2)?;
let ref_date: Option<u64> = row.get(3)?;
let ref_date: Option<u32> = row.get(3)?;
let entity = Entity {
id,
state: EntityState::Loaded,

View File

@@ -22,7 +22,6 @@ pub mod i32_try_from_value;
pub mod i64_try_from_value;
pub mod string_try_from_value;
pub mod u32_try_from_value;
pub mod u64_try_from_value;
pub mod value_from_bool;
pub mod value_from_f64;
pub mod value_from_i32;
@@ -30,4 +29,3 @@ pub mod value_from_i64;
pub mod value_from_str;
pub mod value_from_string;
pub mod value_from_u32;
pub mod value_from_u64;

View File

@@ -4,7 +4,7 @@ impl TryFrom<Value> for u32 {
type Error = ();
fn try_from(value: Value) -> Result<u32, Self::Error> {
match value {
Value::UnsignedInt(value) => value.try_into().map_err(|_| ()),
Value::UnsignedInt(value) => Ok(value),
_ => Err(()),
}
}

View File

@@ -1,11 +0,0 @@
use crate::*;
impl TryFrom<Value> for u64 {
type Error = ();
fn try_from(value: Value) -> Result<u64, Self::Error> {
match value {
Value::UnsignedInt(value) => Ok(value),
_ => Err(()),
}
}
}

View File

@@ -1,7 +0,0 @@
use crate::*;
impl From<u64> for Value {
fn from(value: u64) -> Self {
Self::UnsignedInt(value)
}
}

View File

@@ -34,6 +34,9 @@
//!
//! ```rust,no_run
//! use heave::*;
//! use heave::eav::*;
//! use heave::catalog::*;
//! use heave::filter::*;
//! use std::convert::{From, TryFrom};
//! use std::result::Result;
//!
@@ -42,7 +45,7 @@
//! struct Product {
//! pub id: String,
//! pub name: String,
//! pub price: u64,
//! pub price: u32,
//! pub in_stock: bool,
//! }
//!

View File

@@ -10,7 +10,7 @@ pub struct O {
pub(crate) state: EntityState,
/// An optional timestamp or version number, typically used for optimistic
/// locking or tracking when the entity was last referenced or modified.
pub(crate) ref_date: Option<u64>,
pub(crate) ref_date: Option<u32>,
/// A string identifying the "type" or "class" of the entity (e.g., "product", "user").
/// This is used to group and query entities of the same kind.
pub(crate) class: String,
@@ -77,7 +77,7 @@ impl Entity {
/// # Returns
///
/// The entity with the updated reference date.
pub fn with_ref_date(mut self, ref_date: u64) -> Self {
pub fn with_ref_date(mut self, ref_date: u32) -> Self {
self.ref_date = Some(ref_date);
self
}

View File

@@ -5,9 +5,9 @@ use crate::*;
#[derive(Debug, Default, PartialEq, Clone)]
pub struct O {
pub id: String,
pub first_seen: u64,
pub first_seen: u32,
pub name: String,
pub price: u64,
pub price: u32,
pub discount: f64,
pub sell_trend: i64,
pub in_stock: bool,

View File

@@ -15,7 +15,7 @@ pub enum Value {
/// A UTF-8 encoded string.
Text(String),
/// An unsigned 64-bit integer.
UnsignedInt(u64),
UnsignedInt(u32),
}
impl std::fmt::Display for Value {

View File

@@ -34,7 +34,7 @@ mod tests {
.unwrap();
assert_eq!(entity1.state, EntityState::New);
assert_eq!(entity1.value_of("name"), Some(&Value::from("Item 1")));
assert_eq!(entity1.value_of("price"), Some(&Value::from(10u64)));
assert_eq!(entity1.value_of("price"), Some(&Value::from(10u32)));
assert_eq!(entity1.value_of("sell_trend"), Some(&Value::from(0i64)));
let entity2 = catalog
.with_items(|items| {
@@ -44,7 +44,7 @@ mod tests {
.unwrap();
assert_eq!(entity2.state, EntityState::New);
assert_eq!(entity2.value_of("name"), Some(&Value::from("Item 2")));
assert_eq!(entity2.value_of("price"), Some(&Value::from(20u64)));
assert_eq!(entity2.value_of("price"), Some(&Value::from(20u32)));
assert_eq!(entity2.value_of("sell_trend"), Some(&Value::from(0i64)));
}
}

View File

@@ -43,7 +43,7 @@ mod tests {
loaded_entity.value_of("name"),
Some(&Value::from("Test Item"))
);
assert_eq!(loaded_entity.value_of("price"), Some(&Value::from(123u64)));
assert_eq!(loaded_entity.value_of("price"), Some(&Value::from(123u32)));
assert_eq!(
loaded_entity.value_of("sell_trend"),
Some(&Value::from(0i64))
@@ -113,7 +113,7 @@ mod tests {
);
assert_eq!(
entity_after_load.value_of("price"),
Some(&Value::from(100u64))
Some(&Value::from(100u32))
);
assert_eq!(
entity_after_load.value_of("sell_trend"),

View File

@@ -22,7 +22,7 @@ mod tests {
assert_eq!(entity.state, EntityState::New);
assert_eq!(entity.class, "item");
assert_eq!(entity.value_of("name"), Some(&Value::from("Test Item")));
assert_eq!(entity.value_of("price"), Some(&Value::from(100u64)));
assert_eq!(entity.value_of("price"), Some(&Value::from(100u32)));
assert_eq!(entity.value_of("sell_trend"), Some(&Value::from(0i64)));
assert_eq!(entity.value_of("in_stock"), Some(&Value::from(true)));
}
@@ -54,7 +54,7 @@ mod tests {
.with_items(|items| Ok(items.get(&item_id).unwrap().clone()))
.unwrap();
assert_eq!(entity.value_of("name"), Some(&Value::from("Second Item")));
assert_eq!(entity.value_of("price"), Some(&Value::from(200u64)));
assert_eq!(entity.value_of("price"), Some(&Value::from(200u32)));
assert_eq!(entity.value_of("sell_trend"), Some(&Value::from(10i64)));
assert_eq!(entity.value_of("in_stock"), Some(&Value::from(false)));
assert_eq!(entity.state, EntityState::Updated);