CosmosDbEx.Response (cosmos_db_ex v0.1.0) View Source

Formatted response from CosmosDb.

Request Charge

This is the R/U (Request Unit) charge that the query cost to return the response from Cosmos Db. In other words, this was the cost of all the database operations that had to happen in order for CosmosDb to read or write to/from the database. For more information on Request Units please see Request Units in Azure Cosmos DB.

Request Duration

This is the time, in milliseconds, that it took CosmosDb to execute the query sent.

Body

This is the body of the response sent from Cosmos Db. It is expected that the body will be a map. Additional items gathered from the response headers will be placed in the properties field of the Response struct. Some convience methods will be provided for commonly used properties like 'request charge', 'request duration', and 'continuation_token'.

Link to this section Summary

Functions

Returns the continuation token of the request. This token can be sent with the next request to retrieve the next page of results from the query.

Returns the request charge (Cosmos Db's Request Unit measurement) of the request. Returns nil if no request charge is found in the response.

Returns the request duration, in milliseconds, of the request. Returns nil if no request_duration is found.

Link to this section Types

Specs

t() :: %CosmosDbEx.Response{
  body: map(),
  count: integer(),
  properties: map(),
  resource_id: String.t()
}

Link to this section Functions

Link to this function

get_continuation_token(arg1)

View Source

Returns the continuation token of the request. This token can be sent with the next request to retrieve the next page of results from the query.

Example

iex> container = Container.new("TestItemsDb", "ItemsContainer")
iex> {:ok, response} = CosmosDbEx.get_documents(container)
iex> {:ok, response} = CosmosDbEx.get_documents(container, CosmosDbEx.Response.get_continuation_token(response))

NOTE: Cosmos Db returns results in pages of up to a maximum of 1000 items.

Returns nil if no continuation token is found. Nil also signals that there are no more items left from the query.

Link to this function

get_request_charge(arg1)

View Source

Returns the request charge (Cosmos Db's Request Unit measurement) of the request. Returns nil if no request charge is found in the response.

Link to this function

get_request_duration(arg1)

View Source

Returns the request duration, in milliseconds, of the request. Returns nil if no request_duration is found.