Exql.Query
Summary
Functions
Wraps Exql.Sql.contruct/1 and adds resulting SQL to the Query
Connects to the database, executes the given query and returns the results
Defines the where clause of your query
Specify that you want to return a specific scope from the query, while returing all rows
Specify that you want to return the first row from the query with the given scope
Specify that you want to return the last row from the query with the given scope
Specify that you want to return a single row from the query with the given scope
Outlines the table or view you want to query
Functions
Connects to the database, executes the given query and returns the results.
Example:
result =
with("people")
|> execute
Defines the where clause of your query.
Example:
result =
with("people")
|> filter("id = @id", [id: 1])
|> execute
Specify that you want to return a specific scope from the query, while returing all rows.
Example:
result =
with("people")
|> return("name")
|> execute
Specify that you want to return the first row from the query with the given scope.
This returns the full resultset and picks the first element from the list.
Example:
result =
with("people")
|> return_first("name")
|> execute
Specify that you want to return the last row from the query with the given scope.
This returns the full resultset and picks the last element from the list.
Example:
result =
with("people")
|> return_last("name")
|> execute
Specify that you want to return a single row from the query with the given scope.
This will also apply a TOP 1 statement to the resulting SQL statement.
Example:
result =
with("people")
|> return_single("name")
|> execute