Molecule is a Scala eco-system to define your domain Data Model and use that as your query language.
Molecule uses the powerful Datomic database.
Scala macros transform a model of your domain data into query and transaction tokens that can be run directly against a server-side database to save and retrieve typed data:
Domain Data Model
trait Person {
val name = oneString
val age = oneInt
val address = one[Address]
}
trait Address {
val street = oneString
}
Typed transactions and queries with the tokens of your domain model
Person.name.age.Address.street insert List(
("Lisa", 20, "Broadway"),
("John", 24, "5th Avenue")
)
Person.name.age.Address.street.get === List(
("Lisa", 20, "Broadway"),
("John", 24, "5th Avenue")
)
Molecule is just a thin DataModel-to-query Scala translation layer on top of the heavy-weight Datomic database made by industry leaders like Rich Hickey, Stuart Halloway and more from Cognitect, the people behind the Clojure Language.
Datomic serves huge complex systems like Walmart, Nubank in Brasil and many more industries. If you want expressive power over a complex domain, Datomic and Molecule will serve you well.
Yes:
git clone https://github.com/scalamolecule/molecule-demo.git
Open the demo project in your IDE and run molecule queries with a ready-to-run in-memory database, no configuration. Make your own molecules and test straight away, or add new attributes to use. Or look at other database setups.