Translixir.Model.Query (translixir v0.4.0) View Source

Query module is responsible for facilitationg the creation of a query to send to endpoint /query:

  query =
    Query.find(%{}, [:h, :q])
    |> Query.where(["?p1 :name ?n", "?p1 :is-sql ?s"])
    |> Query.order_by(["?s true"])
    |> Query.limit(5)
    |> Query.offset(20)
    |> Query.with_full_results()
    |> Query.build()

  expected =
    "{:query {:find [?h ?q], :full-results? true, :limit 5, :offset 20, :order-by [[?s true]], :where [[?p1 :name ?n] [?p1 :is-sql ?s]]}}"

  assert query == expected

Link to this section Summary

Link to this section Functions

Specs

build(map()) :: binary()

Specs

limit(map(), integer()) :: map()

Specs

offset(map(), integer()) :: map()

Specs

order_by(map(), maybe_improper_list()) :: map()

Specs

with_full_results(map()) :: map()