Skip to main content

execute_query

Function execute_query 

Source
pub fn execute_query(query: Result<String, &str>) -> Value
Expand description

Executes a given query and processes the response.

This function takes a Result containing a String query or an error message. It unwraps the query string, fetches the response from the URL specified by the query, and then parses this response into a Value.

§Arguments

  • query - A Result wrapping a String query or an error message.

§Returns

  • A Value obtained from parsing the response. If the response fetching or parsing fails, it returns a default Value.

§Panics

This function will panic if query is an Err variant.

§Example

use fenir::database::execute_query;

let query = Ok(String::from("http://example.com/api"));
let value = execute_query(query);