Skip to content

Support embed type annotation #285

@LouisGariepy

Description

@LouisGariepy

Migrated from halcyonnouveau/clorinde#139, originally reported by @Folyd on 2025-06-20.

For example:

--: Author(age?)

--! authors : Author
SELECT name, age FROM Authors;

--! authors_from_country (country?) : (age?)
SELECT a.*, COUNT(*) OVER() as total_count
FROM Authors as a
WHERE a.nationality = :country;

--! authors_from_country (country?) : Author
SELECT a.*, COUNT(*) OVER() as total_count
FROM Authors as a
WHERE a.nationality = :country;

The authors_from_country return all author columns plus an extra total_account, currently we need to declare (age?) as the type annotation. I hope to support embed another type into here, such as Author

Even further:

--: Author(age?)
--: Country(gdp?)
--! authors_from_country (country?) : Author + Country
SELECT a.*, 
c.*,
COUNT(*) OVER() as total_count
FROM Authors as a
FROM Country as c JOIN a.nationality = c.id
WHERE a.nationality = :country;

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegenAn issue regarding code generation, or the generated code itself.featureNew feature or requestparserImprovements or bugfixes to the sql parser.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions