microrm 0.6.3

Lightweight ORM using sqlite as a backend
Documentation
use microrm::prelude::*;
use test_log::test;

mod common;

// this used to conflict with the microrm metadata table
#[derive(Entity)]
struct Meta {
    _ghost: bool,
}

#[derive(Schema)]
struct MetaConflictDB {
    #[allow(unused)]
    pub meta_list: microrm::IDMap<Meta>,
}

#[test]
fn builtin_name_conflict() {
    let (_pool, _db): (_, MetaConflictDB) = common::open_test_db!();
}

#[derive(Entity)]
struct OrdinaryEntity {
    v: usize,
}

#[derive(Schema)]
struct ConflictingDB {
    pub map1: microrm::IDMap<OrdinaryEntity>,
    pub map2: microrm::IDMap<OrdinaryEntity>,
}

#[test]
#[should_panic(expected = "duplicate IDMap for entity ordinary_entity")]
fn multimap_conflict() {
    let (pool, db): (_, ConflictingDB) = common::open_test_db!();
    let mut txn = pool.start().unwrap();

    assert_eq!(db.map1.count(&mut txn).unwrap(), 0);
    assert_eq!(db.map2.count(&mut txn).unwrap(), 0);

    db.map1.insert(&mut txn, OrdinaryEntity { v: 0 }).unwrap();

    assert_eq!(db.map1.count(&mut txn).unwrap(), 1);
    assert_eq!(db.map2.count(&mut txn).unwrap(), 0);
}