|
|
|
How many lines of C++ does a minimal CRUD database application need?
|
|
2 points
by greenrobot
2191 days ago
|
|
Check this example; two lines for initialization, one line for each operation: obx::Store store(create_obx_model());
obx::Box<Task> taskBox(store);
obx_id id = box.put({.text = "Buy milk"}); // Create
std::unique_ptr<Task> task = box.get(id); // Read
if (task) {
task->text += " & some bread";
box.put(*task); // Update
...
box.remove(id); // Delete
}
Can it be done shorter than that?PS.: the example shows user code only, there's a tool to generate boilerplate code, e.g. the Task struct and "binding" it to database. |
|