datalogger/src/models.rs

19 lines
355 B
Rust

use super::schema::events;
use serde::Serialize;
#[derive(Queryable, Debug, Serialize)]
pub struct Event {
pub id: i32,
pub devicename: String,
pub value: i32,
pub timestamp: String,
}
#[derive(Insertable)]
#[table_name = "events"]
pub struct NewEvent<'a> {
pub devicename: &'a str,
pub value: i32,
pub timestamp: &'a str,
}