package lc.obscura;

import lc.esp.eo.EOClient;
import lc.esp.eo.EOTransaction;
import lc.esp.eo.sdk.EO;
import lc.esp.eo.sdk.EOId;

import java.util.Map;
import java.util.UUID;

public class TestCmd {
    public static void main(String[] args) {
        try (EOClient client = new EOClient()) {
            try (EOTransaction txn = client.getTransaction("obscura_" + UUID.randomUUID(), null)) {
                try {
                    EOId id = txn.objAdd("test", Map.of("first", "Alex"));
                    EO obj = txn.objGet(id);
                    assert (obj != null);
                    txn.rollback();
                    obj = txn.objGet(id);
                    assert (obj == null);
                } finally {
                    txn.drop();
                }
            }
        }
    }
}
