Skip to content

0.4.0

Compare
Choose a tag to compare
@GlenDC GlenDC released this 18 Apr 23:17
· 6 commits to main since this release
1305a46

Breaking Changes:

  • [#7]: correct the behaviour of any filter map query values:
    • When using an any value as a query filter map value it will now only match rows
      which have an any value registered for the row;
    • Prior to this release it was matching on all rows, as if the filter wasn't defined.
      This seemed correct when deciding on it, but on hindsight is is incorrect behaviour.

New Features:

  • [#8]: support custom validations of rows prior to appending them

Example:

#[derive(Debug, VennDB)]
#[venndb(name = "MyDB", validator = my_validator_fn)]
pub struct Value {
   pub foo: String,
   pub bar: u32,
}

fn my_validator_fn(value: &Value) -> bool {
    !value.foo.is_empty() && value.bar > 0
}

let mut db = MyDB::default();
assert!(db.append(Value {
    foo: "".to_owned(),
    bar: 42,
}).is_err()); // fails because foo == empty