CosmosDbEx.Client.query
You're seeing just the function
query
, go back to CosmosDbEx.Client module for more information.
Link to this function
query(container, query_text, params)
Specs
query(CosmosDbEx.Client.Container.t(), String.t(), list()) :: {:ok | :bad_request | :conflict | :entity_too_large | :not_found | :storage_limit_reached | :unauthorized, CosmosDbEx.Response.t()}
Sends a query to Cosmos Db.
Parameters
- query: The query contains the SQL query text.
- params: A List of key/value pairs that correspond to values in the query.
Example:
iex> query_text = "SELECT * FROM ItemsContainer c WHERE c.id = @id and c.name = @name" iex> params = [{"id", "1234"}, {"name", "testItem"}] iex> CosmosDbEx.Client.query(query_text, params) {:ok, %CosmosDbEx.Response{
body: %{
"Documents" => [
%{
"_attachments" => "attachments/",
"_etag" => ""8203015f-0000-0200-0000-60a1c47e0000"",
"_rid" => "AAarArAAAAAFAAAAAAAAAA==",
"_ts" => 1621214334,
"id" => "ACME-HD-WOLF01234",
"location" => "Bottom of a cliff",
"name" => "ACME hair dryer"
}
]
},
count: 1,
properties: %{
continuation_token: nil,
request_charge: "2.83",
request_duration: "0.734"
},
resource_id: "AA8rAA2AN48="
}}