use edn_derive::Serialize;
use transistor::client::Crux;
use transistor::types::response::TxLogResponse;
use transistor::types::Actions;
use transistor::types::CruxId;
#[cfg(not(feature = "async"))]
fn evict() -> TxLogResponse {
let person = Person {
crux__db___id: CruxId::new("hello-evict"),
first_name: "Hello".to_string(),
last_name: "World".to_string(),
};
let client = Crux::new("localhost", "3000").http_client();
let actions = Actions::new().append_put(person.clone());
let _ = client.tx_log(actions).unwrap();
let actions = Actions::new().append_evict(person.crux__db___id);
let evict_body = client.tx_log(actions).unwrap();
return evict_body;
}
#[cfg(not(feature = "async"))]
fn main() {
let evict_body = evict();
println!("\n Evict Body = {:?}", evict_body);
}
#[test]
#[cfg(not(feature = "async"))]
fn test_evict() {
let evict = evict();
assert!(evict.tx___tx_id > 0);
}
#[derive(Debug, Clone, Serialize)]
#[allow(non_snake_case)]
pub struct Person {
crux__db___id: CruxId,
first_name: String,
last_name: String,
}