//! use datom::{backends::SledStorage, Connection, EntityResult, Transaction, Value, ID};
// Use the sled storage backend to create a temporary database
let storage = SledStorage::connect_temp()?;
// Create a connection from that backend
let conn = Connection::new(storage);
// Create an ID to use for the username attribute
let username = ID::new();
// Create an ID to use for the user's entity
let user = ID::new();
// Create a transaction setting the username attribute on the user
// entity to "pmc"
let mut tx = Transaction::new();
tx.add(user.into(), username.into(), "pmc".into());
// Execute the transaction using the connection
conn.transact(tx)?;
// Get a view of the database in the current point in time
let db = conn.db()?;
// Get the value of the username attribute on the user entity
if let EntityResult::Value(Value::String(u)) = db.entity(user.into())?.get(username.into())? {
println!("The user's username is {}.", u);
}