I am new to Datomic and I am trying to get my head around using the client API for my project. Specifically, I am looking for guidance on how to perform basic CRUD operations.
Create: What’s the best way to add a new entity to the database: ??
Read: How can I query the database efficiently? Are there any tips for optimizing queries: ??
Update: What’s the recommended approach for updating existing entities: ??
Delete: How do I safely remove entities from the database: ??
@chitramishra You are going to want to follow our client tutorial. I recommend getting Datomic Local which uses the Datomic Client API and starting with the client api page.
Here are some basic answers to your questions so you will know what to look for while working through the tutorial:
Create: What’s the best way to add a new entity to the database: ??
To add data to a Datomic database you use the transact api.
Read: How can I query the database efficiently? Are there any tips for optimizing queries: ??
To query data from a Datomic database you want to use the q api. For efficient queries follow the basic principal of most selective clause first in clause order. For more tips and details see: Executing Queries | Datomic
Update: What’s the recommended approach for updating existing entities: ??
Resolve the entity and supply new attribute values and you can perform either an implicit or explicit retraction of previous values and transact the new values. Discussed in this step of the tutorial: Retract | Datomic
Delete: How do I safely remove entities from the database: ??
There is no deletion in Datomic Cloud or Datomic Local. Where update-in-place databases would delete, Datomic instead adds a new retraction. Essentially saying, this fact is no longer true.
I hope this helps get you started! Welcome to Datomic. Please consult the reference sections of the documentation for more details on subjects you encounter during the tutorial.