Aliases are commonly defined by migrations using SDL.
Define an alias that merges some information from links as computable properties, this is a way of flattening a nested structure:
alias ReviewAlias := Review {
# It will already have all the Review
# properties and links.
author_name := .author.name,
movie_title := .movie.title,
}
Define an alias for traversing a link backwards, this is especially useful for GraphQL access:
alias MovieAlias := Movie {
# A computable link for accessing all the
# reviews for this movie.
reviews := .<movie[IS Review]
}
Aliases allow to use the full power of EdgeQL (expressions, aggregate functions, backwards link navigation) from GraphQL.
The aliases defined above allow you to query MovieAlias
with
GraphQL.