Skip to content

Enable support for C++26 annotations as an info for the entities #340

@Yaraslaut

Description

@Yaraslaut

I was looking into custom annotation introduced with c++26 reflection and here is an example on how we can include it in the entities, godbolt

struct Album
{
    [[=PrimaryKey::ServerSideAutoIncrement]]
    [[=SqlRealName("AlbumId")]]
    int32_t AlbumId;
};

struct Field
{

    [[=PrimaryKey::ServerSideAutoIncrement, =SqlRealName("TrackId")]] int32_t TrackId;
    std::string Name;
    [[=SqlRealName("OVERWRITE_BYTES")]] std::optional<int32_t> bytes;
    [[=SqlRealName("AlbumId"), =SqlNullable::Null]] BelongsTo<^^Album::AlbumId> AlbumId;

};

I think that the main advantage is that some info can be put inside annotation that is not essential for the entities
and only something that changes behavior of the elements, like BelongsTo is explicitly written since we need custom operators

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions