query/todo.md

37 lines
1.3 KiB
Markdown

# Todo
- move `prepare_*` methods from `dialect` to `query_compiler`
- add `session_insert_builder` and `session_update_builder` (returning multiple statements)
- finish fetch eager has-many/belongs-to relations
- implement lazy loading
- implement polymorphic class hierarchies
- finish `schema_repository` classes (move add/drop from `session` to `schema`)
- implement a flag class for enumerations
__Proposal for polymorphic classes:__
object_ptr::as<Type> does the following checks;
1. The requested type has a super class
2. Super class has a discriminator column defined
3. Super class has a discriminator value defined
4. Discriminator value is mapped to the requested type
If all checks succeed, the requested is fetched from the database.
```cpp
schema.attach<jobs::Payload>("payloads", make_polymorph("type"));
schema.attach<jobs::Payload, jobs::IdPayload>("id_list_payloads", make_polymorph_type("IdPayload"));
schema.attach<jobs::Payload, jobs::IdListPayload>("id_payloads", make_polymorph_type("IdListPayload"));
object::object_ptr<jobs::Payload> payload;
auto result = payload.as<jobs::IdPayload>();
if (result.is_ok()) {
const auto& is_payload = result.value();
// Use requested type
id_payload->id = 1;
}
payload.is_polymorphic();
payload.is_polymorphic_type<jobs::IdPayload>();
```