Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Querying is only half the battle. We also need to be able to add data to and modify existing data in the database.
It’s all well and good to be able to play with data in the database, but how does it get
there in the first place? The answer is the insert
function. You just give it a value, and it gives back an ID.
At this point, it makes sense to explain a bit of the philosophy behind Persistent. In many other ORM solutions, the data types used to hold data are opaque: you need to go through their defined interfaces to get at and modify the data. That’s not the case with Persistent: we’re using plain old Algebraic Data Types for the whole thing. This means you still get all the great benefits of pattern matching, currying, and everything else you’re used to.