49 lines
1.8 KiB
Markdown
49 lines
1.8 KiB
Markdown
# Todo
|
|
|
|
- move `prepare_*` methods from `dialect` to `query_compiler`
|
|
- add `insert_query_builder` and `update_update_builder` (returning multiple statements)
|
|
- finish fetch eager many-to-many relations
|
|
- implement lazy loading
|
|
- implement polymorphic class hierarchies
|
|
- finish `database` (schema_repository) class (move add/drop from `session` to `schema`)
|
|
- implement a flag class for enumerations
|
|
|
|
- PK generator
|
|
1. Introduce execute_context
|
|
2. Introduce execute_result
|
|
3. Add `abstract_pk_generator` class
|
|
4. Add `identity_pk_generator` class
|
|
5. Add `sequence_pk_generator` class
|
|
6. Add `table_pk_generator` class
|
|
7. Add `manual_pk_generator` class
|
|
8. Extend `session::insert` logic to use pk generator
|
|
9. Extend `postgres_connection::execute` to handle `returning` clause
|
|
10. Add generator to `schema_node` or `table` class when attaching type
|
|
11. Extend `query_builder` and `intermediates` with `returning` intermediate
|
|
|
|
__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>();
|
|
```
|