use transistor::client::Crux;
use transistor::edn_rs::{ser_struct, Serialize};
use transistor::types::http::Action;
use transistor::types::CruxId;
fn main() {
let person = Person {
crux__db___id: CruxId::new("hello-evict"),
first_name: "Hello".to_string(),
last_name: "World".to_string(),
};
println!("{:?}", person.clone().serialize());
let client = Crux::new("localhost", "3000").http_client();
let put_person = Action::Put(person.clone().serialize());
let body = client.tx_log(vec![put_person]).unwrap();
println!("\n Body = {:?}", body);
let evict_person = Action::Evict(person.crux__db___id.serialize());
let evict_body = client.tx_log(vec![evict_person]).unwrap();
println!("\n Evict Body = {:?}", evict_body);
}
ser_struct! {
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct Person {
crux__db___id: CruxId,
first_name: String,
last_name: String
}
}