[][src]Struct my_iot::core::persistence::Db

pub struct Db {
    connection: Connection,
}

A database connection.

Fields

connection: Connection

Wrapped SQLite connection.

Methods

impl Db[src]

pub fn new<P: AsRef<Path>>(path: P) -> Result<Db, Error>[src]

Create a new database connection.

impl Db[src]

Readings persistence.

pub fn upsert_reading(&self, message: &Message) -> Result<(), Error>[src]

Insert or replace reading into database.

pub fn select_actuals(&self) -> Result<Vec<Message>, Error>[src]

Select latest reading for each sensor.

pub fn select_size(&self) -> Result<u64, Error>[src]

Select database size in bytes.

pub fn select_last_reading(
    &self,
    sensor: &str
) -> Result<Option<Message>, Error>
[src]

Select the very last sensor reading.

pub fn select_readings(
    &self,
    sensor: &str,
    since: &DateTime<Local>
) -> Result<Vec<Message>, Error>
[src]

Select the latest sensor readings within the given time interval.

Auto Trait Implementations

impl Send for Db

impl Unpin for Db

impl !Sync for Db

impl UnwindSafe for Db

impl !RefUnwindSafe for Db

Blanket Implementations

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.

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

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

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,