Query

Struct Query 

Source
pub struct Query { /* private fields */ }

Implementations§

Source§

impl Query

Source

pub fn new() -> Self

Source

pub fn set_search_text(&mut self, search_text: Vec<String>) -> &mut Query

Source

pub fn set_limit(&mut self, limit: usize) -> &mut Query

Source

pub fn set_offset(&mut self, offset: usize) -> &mut Query

Source

pub fn set_realtime_start(&mut self, realtime_start: String) -> &mut Query

Source

pub fn set_realtime_end(&mut self, realtime_end: String) -> &mut Query

Source

pub fn set_order(&mut self, order_by: String) -> &mut Query

Source

pub fn set_sort(&mut self, sort_order: String) -> &mut Query

Source

pub fn set_filter_variable(&mut self, filter_var: String) -> &mut Query

Source

pub fn set_filter_value(&mut self, filter_val: String) -> &mut Query

Source

pub fn set_tags(&mut self, tags: Vec<String>) -> &mut Query

Source

pub fn exclude_tags(&mut self, tags: Vec<String>) -> &mut Query

Trait Implementations§

Source§

impl QueryTraits for Query

Source§

fn execute(&self, client: &FreddoClient) -> Result<Box<dyn ResultTrait>, String>

Execute query

§Examples
use freddo::search;
use freddo::client::FreddoClient;
use freddo::base::{QueryTraits};
use std::env;
use std::fs;
 
let api_key = fs::read_to_string("API_KEY.txt").expect("Something wrong reading the file!");
env::set_var("FRED_API_KEY", api_key);
let client = FreddoClient::new().unwrap();
 
let mut query = search::Query::new();
query.set_search_text(vec!["GDP".to_owned(), "energy".to_owned()])
.set_limit(1);
 
let result = query.execute(&client).unwrap();
result.print_value();
Source§

fn build_query_param_str(&self) -> Result<String, String>

Auto Trait Implementations§

§

impl Freeze for Query

§

impl RefUnwindSafe for Query

§

impl Send for Query

§

impl Sync for Query

§

impl Unpin for Query

§

impl UnwindSafe for Query

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,