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-entity"),
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 tx_body = client.entity_tx(person.crux__db___id.serialize()).unwrap();
println!("\n Tx Body = {:#?}", tx_body);
}
ser_struct! {
#[derive(Debug, Clone)]
#[allow(non_snake_case)]
pub struct Person {
crux__db___id: CruxId,
first_name: String,
last_name: String
}
}