Current section

Files

Jump to
cake src cake@combined.erl
Raw

src/cake@combined.erl

-module(cake@combined).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/cake/combined.gleam").
-export([to_query/1, union/2, unions/3, union_all/2, unions_all/3, except/2, excepts/3, except_all/2, excepts_all/3, intersect/2, intersects/3, intersect_all/2, intersects_all/3, get_queries/1, limit/2, no_limit/1, get_limit/1, offset/2, no_offset/1, get_offset/1, order_by_asc/2, order_by_asc_nulls_first/2, order_by_asc_nulls_last/2, replace_order_by_asc/2, replace_order_by_asc_nulls_first/2, replace_order_by_asc_nulls_last/2, order_by_desc/2, order_by_desc_nulls_first/2, order_by_desc_nulls_last/2, replace_order_by_desc/2, replace_order_by_desc_nulls_first/2, replace_order_by_desc_nulls_last/2, order_by/3, replace_order_by/3, no_order_by/1, get_order_by/1, epilog/2, no_epilog/1, get_epilog/1, comment/2, no_comment/1, get_comment/1]).
-export_type([direction/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" A DSL to build combined queries, such as:\n"
"\n"
" - `UNION`\n"
" - `UNION ALL`\n"
" - `EXCEPT`\n"
" - `EXCEPT ALL`\n"
" - `INTERSECT`\n"
" - `INTERSECT ALL`\n"
"\n"
" ## Compatibility\n"
"\n"
" - 🪶SQLite does not support `EXCEPT ALL` and `INTERSECT ALL`.\n"
"\n"
).
-type direction() :: asc | desc.
-file("src/cake/combined.gleam", 55).
?DOC(" Creates a `ReadQuery` from a `Combined` `ReadQuery`.\n").
-spec to_query(cake@internal@read_query:combined()) -> cake@internal@read_query:read_query().
to_query(Combined) ->
_pipe = Combined,
{combined_query, _pipe}.
-file("src/cake/combined.gleam", 63).
?DOC(" Creates a `UNION` query out of two queries as a `Combined` `ReadQuery`.\n").
-spec union(
cake@internal@read_query:select(),
cake@internal@read_query:select()
) -> cake@internal@read_query:combined().
union(Query_a, Query_b) ->
_pipe = union_distinct,
cake@internal@read_query:combined_query_new(_pipe, [Query_a, Query_b]).
-file("src/cake/combined.gleam", 70).
?DOC(
" Creates a `UNION` query out of two or more queries as a `Combined`\n"
" `ReadQuery`.\n"
).
-spec unions(
cake@internal@read_query:select(),
cake@internal@read_query:select(),
list(cake@internal@read_query:select())
) -> cake@internal@read_query:combined().
unions(Query_a, Query_b, More_queries) ->
_pipe = union_distinct,
cake@internal@read_query:combined_query_new(
_pipe,
[Query_a, Query_b | More_queries]
).
-file("src/cake/combined.gleam", 81).
?DOC(" Creates a `UNION ALL` query out of two queries as a `Combined` `ReadQuery`.\n").
-spec union_all(
cake@internal@read_query:select(),
cake@internal@read_query:select()
) -> cake@internal@read_query:combined().
union_all(Query_a, Query_b) ->
_pipe = union_all,
cake@internal@read_query:combined_query_new(_pipe, [Query_a, Query_b]).
-file("src/cake/combined.gleam", 88).
?DOC(
" Creates a `UNION ALL` query out of two or more queries as a `Combined`\n"
" `ReadQuery`.\n"
).
-spec unions_all(
cake@internal@read_query:select(),
cake@internal@read_query:select(),
list(cake@internal@read_query:select())
) -> cake@internal@read_query:combined().
unions_all(Query_a, Query_b, More_queries) ->
_pipe = union_all,
cake@internal@read_query:combined_query_new(
_pipe,
[Query_a, Query_b | More_queries]
).
-file("src/cake/combined.gleam", 99).
?DOC(" Creates an `EXCEPT` query out of two queries as a `Combined` `ReadQuery`.\n").
-spec except(
cake@internal@read_query:select(),
cake@internal@read_query:select()
) -> cake@internal@read_query:combined().
except(Query_a, Query_b) ->
_pipe = except_distinct,
cake@internal@read_query:combined_query_new(_pipe, [Query_a, Query_b]).
-file("src/cake/combined.gleam", 106).
?DOC(
" Creates an `EXCEPT` query out of two or more queries as a `Combined`\n"
" `ReadQuery`.\n"
).
-spec excepts(
cake@internal@read_query:select(),
cake@internal@read_query:select(),
list(cake@internal@read_query:select())
) -> cake@internal@read_query:combined().
excepts(Query_a, Query_b, More_queries) ->
_pipe = except_distinct,
cake@internal@read_query:combined_query_new(
_pipe,
[Query_a, Query_b | More_queries]
).
-file("src/cake/combined.gleam", 120).
?DOC(
" Creates an `EXCEPT ALL` query out of two queries as a `Combined`\n"
" `ReadQuery`.\n"
"\n"
" NOTICE: Not supported by 🪶SQLite.\n"
).
-spec except_all(
cake@internal@read_query:select(),
cake@internal@read_query:select()
) -> cake@internal@read_query:combined().
except_all(Query_a, Query_b) ->
_pipe = except_all,
cake@internal@read_query:combined_query_new(_pipe, [Query_a, Query_b]).
-file("src/cake/combined.gleam", 132).
?DOC(
" Creates an `EXCEPT ALL` query out of two or more queries as a `Combined`\n"
" `ReadQuery`.\n"
"\n"
" NOTICE: Not supported by 🪶SQLite.\n"
).
-spec excepts_all(
cake@internal@read_query:select(),
cake@internal@read_query:select(),
list(cake@internal@read_query:select())
) -> cake@internal@read_query:combined().
excepts_all(Query_a, Query_b, More_queries) ->
_pipe = except_all,
cake@internal@read_query:combined_query_new(
_pipe,
[Query_a, Query_b | More_queries]
).
-file("src/cake/combined.gleam", 143).
?DOC(" Creates an `INTERSECT` query out of two queries as a `Combined` `ReadQuery`.\n").
-spec intersect(
cake@internal@read_query:select(),
cake@internal@read_query:select()
) -> cake@internal@read_query:combined().
intersect(Query_a, Query_b) ->
_pipe = intersect_distinct,
cake@internal@read_query:combined_query_new(_pipe, [Query_a, Query_b]).
-file("src/cake/combined.gleam", 151).
?DOC(
" Creates an `INTERSECT` query out of two or more queries as a `Combined`\n"
" `ReadQuery`.\n"
).
-spec intersects(
cake@internal@read_query:select(),
cake@internal@read_query:select(),
list(cake@internal@read_query:select())
) -> cake@internal@read_query:combined().
intersects(Query_a, Query_b, More_queries) ->
_pipe = intersect_distinct,
cake@internal@read_query:combined_query_new(
_pipe,
[Query_a, Query_b | More_queries]
).
-file("src/cake/combined.gleam", 165).
?DOC(
" Creates an `INTERSECT ALL` query out of two queries as a `Combined`\n"
" `ReadQuery`.\n"
"\n"
" NOTICE: Not supported by 🪶SQLite.\n"
).
-spec intersect_all(
cake@internal@read_query:select(),
cake@internal@read_query:select()
) -> cake@internal@read_query:combined().
intersect_all(Query_a, Query_b) ->
_pipe = intersect_all,
cake@internal@read_query:combined_query_new(_pipe, [Query_a, Query_b]).
-file("src/cake/combined.gleam", 177).
?DOC(
" Creates an `INTERSECT ALL` query out of two or more queries as a `Combined`\n"
" `ReadQuery`.\n"
"\n"
" NOTICE: Not supported by 🪶SQLite.\n"
).
-spec intersects_all(
cake@internal@read_query:select(),
cake@internal@read_query:select(),
list(cake@internal@read_query:select())
) -> cake@internal@read_query:combined().
intersects_all(Query_a, Query_b, More_queries) ->
_pipe = intersect_all,
cake@internal@read_query:combined_query_new(
_pipe,
[Query_a, Query_b | More_queries]
).
-file("src/cake/combined.gleam", 188).
?DOC(" Gets the queries from a `Combined` `ReadQuery`.\n").
-spec get_queries(cake@internal@read_query:combined()) -> list(cake@internal@read_query:select()).
get_queries(Combined) ->
erlang:element(3, Combined).
-file("src/cake/combined.gleam", 196).
?DOC(" Sets a `Limit` in the `Combined` `ReadQuery`.\n").
-spec limit(cake@internal@read_query:combined(), integer()) -> cake@internal@read_query:combined().
limit(Query, Limit) ->
Limit@1 = cake@internal@read_query:limit_new(Limit),
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
Limit@1,
erlang:element(5, Query),
erlang:element(6, Query),
erlang:element(7, Query),
erlang:element(8, Query)}.
-file("src/cake/combined.gleam", 203).
?DOC(" Removes `Limit` from the `Combined` `ReadQuery`.\n").
-spec no_limit(cake@internal@read_query:combined()) -> cake@internal@read_query:combined().
no_limit(Query) ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
no_limit,
erlang:element(5, Query),
erlang:element(6, Query),
erlang:element(7, Query),
erlang:element(8, Query)}.
-file("src/cake/combined.gleam", 209).
?DOC(" Gets `Limit` in the `Combined` `ReadQuery`.\n").
-spec get_limit(cake@internal@read_query:combined()) -> cake@internal@read_query:limit().
get_limit(Query) ->
erlang:element(4, Query).
-file("src/cake/combined.gleam", 215).
?DOC(" Sets an `Offset` in the `Combined` `ReadQuery`.\n").
-spec offset(cake@internal@read_query:combined(), integer()) -> cake@internal@read_query:combined().
offset(Query, Offset) ->
Offset@1 = cake@internal@read_query:offset_new(Offset),
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
Offset@1,
erlang:element(6, Query),
erlang:element(7, Query),
erlang:element(8, Query)}.
-file("src/cake/combined.gleam", 222).
?DOC(" Removes `Offset` from the `Combined` `ReadQuery`.\n").
-spec no_offset(cake@internal@read_query:combined()) -> cake@internal@read_query:combined().
no_offset(Query) ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
no_offset,
erlang:element(6, Query),
erlang:element(7, Query),
erlang:element(8, Query)}.
-file("src/cake/combined.gleam", 228).
?DOC(" Gets `Offset` in the `Combined` `ReadQuery`.\n").
-spec get_offset(cake@internal@read_query:combined()) -> cake@internal@read_query:offset().
get_offset(Query) ->
erlang:element(5, Query).
-file("src/cake/combined.gleam", 241).
-spec map_order_by_direction_constructor(direction()) -> cake@internal@read_query:order_by_direction().
map_order_by_direction_constructor(In) ->
case In of
asc ->
asc;
desc ->
desc
end.
-file("src/cake/combined.gleam", 250).
?DOC(" Creates or appends an ascending `OrderBy`.\n").
-spec order_by_asc(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
order_by_asc(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, asc}
end],
{order_by, _pipe@2}
end,
true
).
-file("src/cake/combined.gleam", 265).
?DOC(
" Creates or appends an ascending `OrderBy` with `NULLS FIRST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS FIRST` out of the box.\n"
).
-spec order_by_asc_nulls_first(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
order_by_asc_nulls_first(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, asc_nulls_first}
end],
{order_by, _pipe@2}
end,
true
).
-file("src/cake/combined.gleam", 280).
?DOC(
" Creates or appends an ascending `OrderBy` with `NULLS LAST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS LAST` out of the box.\n"
).
-spec order_by_asc_nulls_last(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
order_by_asc_nulls_last(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, asc_nulls_last}
end],
{order_by, _pipe@2}
end,
true
).
-file("src/cake/combined.gleam", 293).
?DOC(" Replaces the `OrderBy` with a single ascending `OrderBy`.\n").
-spec replace_order_by_asc(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
replace_order_by_asc(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, asc}
end],
{order_by, _pipe@2}
end,
false
).
-file("src/cake/combined.gleam", 308).
?DOC(
" Replaces the `OrderBy` with a single ascending `OrderBy` with `NULLS FIRST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS FIRST` out of the box.\n"
).
-spec replace_order_by_asc_nulls_first(
cake@internal@read_query:combined(),
binary()
) -> cake@internal@read_query:combined().
replace_order_by_asc_nulls_first(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, asc_nulls_first}
end],
{order_by, _pipe@2}
end,
false
).
-file("src/cake/combined.gleam", 323).
?DOC(
" Replaces the `OrderBy` with a single ascending `OrderBy` with `NULLS LAST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS LAST` out of the box.\n"
).
-spec replace_order_by_asc_nulls_last(
cake@internal@read_query:combined(),
binary()
) -> cake@internal@read_query:combined().
replace_order_by_asc_nulls_last(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, asc_nulls_last}
end],
{order_by, _pipe@2}
end,
false
).
-file("src/cake/combined.gleam", 336).
?DOC(" Creates or appends a descending `OrderBy`.\n").
-spec order_by_desc(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
order_by_desc(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, desc}
end],
{order_by, _pipe@2}
end,
true
).
-file("src/cake/combined.gleam", 351).
?DOC(
" Creates or appends a descending order with `NULLS FIRST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS FIRST` out of the box.\n"
).
-spec order_by_desc_nulls_first(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
order_by_desc_nulls_first(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, desc_nulls_first}
end],
{order_by, _pipe@2}
end,
true
).
-file("src/cake/combined.gleam", 366).
?DOC(
" Creates or appends a descending `OrderBy` with `NULLS LAST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS LAST` out of the box.\n"
).
-spec order_by_desc_nulls_last(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
order_by_desc_nulls_last(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, desc_nulls_last}
end],
{order_by, _pipe@2}
end,
true
).
-file("src/cake/combined.gleam", 379).
?DOC(" Replaces the `OrderBy` with a single descending order.\n").
-spec replace_order_by_desc(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
replace_order_by_desc(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, desc}
end],
{order_by, _pipe@2}
end,
false
).
-file("src/cake/combined.gleam", 394).
?DOC(
" Replaces the `OrderBy` with a single descending order with `NULLS FIRST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS FIRST` out of the box.\n"
).
-spec replace_order_by_desc_nulls_first(
cake@internal@read_query:combined(),
binary()
) -> cake@internal@read_query:combined().
replace_order_by_desc_nulls_first(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, desc_nulls_first}
end],
{order_by, _pipe@2}
end,
false
).
-file("src/cake/combined.gleam", 409).
?DOC(
" Replaces the `OrderBy` with a single descending `OrderBy` with `NULLS LAST`.\n"
"\n"
" NOTICE: 🦭MariaDB and 🐬MySQL do not support `NULLS LAST` out of the box.\n"
).
-spec replace_order_by_desc_nulls_last(
cake@internal@read_query:combined(),
binary()
) -> cake@internal@read_query:combined().
replace_order_by_desc_nulls_last(Query, Order_by) ->
_pipe = Query,
cake@internal@read_query:combined_order_by(
_pipe,
begin
_pipe@2 = [begin
_pipe@1 = Order_by,
{order_by_column, _pipe@1, desc_nulls_last}
end],
{order_by, _pipe@2}
end,
false
).
-file("src/cake/combined.gleam", 424).
?DOC(
" Creates or appends an `OrderBy` for a column with a direction.\n"
"\n"
" The direction can either `ASC` or `DESC`.\n"
).
-spec order_by(cake@internal@read_query:combined(), binary(), direction()) -> cake@internal@read_query:combined().
order_by(Query, Order_by, Direction) ->
Direction@1 = begin
_pipe = Direction,
map_order_by_direction_constructor(_pipe)
end,
_pipe@1 = Query,
cake@internal@read_query:combined_order_by(
_pipe@1,
begin
_pipe@3 = [begin
_pipe@2 = Order_by,
{order_by_column, _pipe@2, Direction@1}
end],
{order_by, _pipe@3}
end,
true
).
-file("src/cake/combined.gleam", 439).
?DOC(" Replaces the `OrderBy` with a column with a direction.\n").
-spec replace_order_by(
cake@internal@read_query:combined(),
binary(),
direction()
) -> cake@internal@read_query:combined().
replace_order_by(Query, Order_by, Direction) ->
Direction@1 = begin
_pipe = Direction,
map_order_by_direction_constructor(_pipe)
end,
_pipe@1 = Query,
cake@internal@read_query:combined_order_by(
_pipe@1,
begin
_pipe@3 = [begin
_pipe@2 = Order_by,
{order_by_column, _pipe@2, Direction@1}
end],
{order_by, _pipe@3}
end,
false
).
-file("src/cake/combined.gleam", 454).
?DOC(" Removes the `OrderBy` from the `Combined` read_query.\n").
-spec no_order_by(cake@internal@read_query:combined()) -> cake@internal@read_query:combined().
no_order_by(Query) ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
no_order_by,
erlang:element(7, Query),
erlang:element(8, Query)}.
-file("src/cake/combined.gleam", 460).
?DOC(" Gets the `OrderBy` from the `Combined` read_query.\n").
-spec get_order_by(cake@internal@read_query:combined()) -> cake@internal@read_query:order_by().
get_order_by(Query) ->
erlang:element(6, Query).
-file("src/cake/combined.gleam", 468).
?DOC(" Appends an `Epilog` to the `Combined` read_query.\n").
-spec epilog(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
epilog(Query, Epilog) ->
Epilog@1 = begin
_pipe = Epilog,
gleam@string:trim(_pipe)
end,
case Epilog@1 of
<<""/utf8>> ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
erlang:element(6, Query),
no_epilog,
erlang:element(8, Query)};
_ ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
erlang:element(6, Query),
begin
_pipe@1 = (<<" "/utf8, Epilog@1/binary>>),
{epilog, _pipe@1}
end,
erlang:element(8, Query)}
end.
-file("src/cake/combined.gleam", 478).
?DOC(" Removes the `Epilog` from the `Combined` read_query.\n").
-spec no_epilog(cake@internal@read_query:combined()) -> cake@internal@read_query:combined().
no_epilog(Query) ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
erlang:element(6, Query),
no_epilog,
erlang:element(8, Query)}.
-file("src/cake/combined.gleam", 484).
?DOC(" Gets the `Epilog` from the `Combined` read_query.\n").
-spec get_epilog(cake@internal@read_query:combined()) -> cake@internal@read_query:epilog().
get_epilog(Query) ->
erlang:element(7, Query).
-file("src/cake/combined.gleam", 492).
?DOC(" Appends a `Comment` to the `Combined` read_query.\n").
-spec comment(cake@internal@read_query:combined(), binary()) -> cake@internal@read_query:combined().
comment(Query, Comment) ->
Comment@1 = begin
_pipe = Comment,
gleam@string:trim(_pipe)
end,
case Comment@1 of
<<""/utf8>> ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
erlang:element(6, Query),
erlang:element(7, Query),
no_comment};
_ ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
erlang:element(6, Query),
erlang:element(7, Query),
begin
_pipe@1 = (<<" "/utf8, Comment@1/binary>>),
{comment, _pipe@1}
end}
end.
-file("src/cake/combined.gleam", 502).
?DOC(" Removes the `Comment` from the `Combined` read_query.\n").
-spec no_comment(cake@internal@read_query:combined()) -> cake@internal@read_query:combined().
no_comment(Query) ->
{combined,
erlang:element(2, Query),
erlang:element(3, Query),
erlang:element(4, Query),
erlang:element(5, Query),
erlang:element(6, Query),
erlang:element(7, Query),
no_comment}.
-file("src/cake/combined.gleam", 508).
?DOC(" Gets the `Comment` from the `Combined` read_query.\n").
-spec get_comment(cake@internal@read_query:combined()) -> cake@internal@read_query:comment().
get_comment(Query) ->
erlang:element(8, Query).