[][src]Struct questdb::QuestDB

pub struct QuestDB { /* fields omitted */ }

Methods

impl QuestDB[src]

pub fn new(url: &str) -> Self[src]

Creates a new connection to questdb

Example

use questdb::QuestDB;
let connection = QuestDB::new("http://192.168.1.37:9000");

pub async fn exec<'_, '_, T: DeserializeOwned>(
    &'_ self,
    query: &'_ str,
    limit: Option<u128>,
    count: Option<bool>,
    nm: Option<bool>
) -> Result<Vec<T>, Error>
[src]

Compiles and executes the SQL query supplied

Arguments

  • query - query text. It can be multi-line, but query separator, such as ; must not be included.
  • limit - This argument is used for paging. Limit can be either in format of X, Y where X is the lower limit and Y is the upper, or just Y. For example, limit=10,20 will return row numbers 10 thru to 20 inclusive. and limit=20 will return first 20 rows, which is equivalent to limit=0,20
  • count - Instructs /exec to count rows and return this value in message header. Default value is false. There is slight performance hit for requesting row count.
  • nm - Skips metadata section of the response when true. When metadata is known and client is paging this flag should typically be set to true to reduce response size. Default value is false and metadata is included in the response.

Example

use questdb::QuestDB;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
struct TestData {
    id: i32,
    ts: String,
    temp: f64,
    sensor_id: i32,
}

let connection = QuestDB::new("http://192.168.1.37:9000");
let res = connection.exec::<TestData>("select * from readings", Some(5), None, None)
    .await
    .unwrap();

Auto Trait Implementations

impl !RefUnwindSafe for QuestDB

impl Send for QuestDB

impl Sync for QuestDB

impl Unpin for QuestDB

impl !UnwindSafe for QuestDB

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.