mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-10 03:03:37 +02:00
26 lines
707 B
Rust
26 lines
707 B
Rust
use crate::db_context::DbContext;
|
|
use crate::error::Result;
|
|
use crate::models::{
|
|
WebsocketEvent,
|
|
WebsocketEventIden,
|
|
};
|
|
use crate::util::UpdateSource;
|
|
|
|
impl<'a> DbContext<'a> {
|
|
pub fn get_websocket_event(&self, id: &str) -> Result<WebsocketEvent> {
|
|
self.find_one(WebsocketEventIden::Id, id)
|
|
}
|
|
|
|
pub fn list_websocket_events(&self, connection_id: &str) -> Result<Vec<WebsocketEvent>> {
|
|
self.find_many(WebsocketEventIden::ConnectionId, connection_id, None)
|
|
}
|
|
|
|
pub fn upsert_websocket_event(
|
|
&self,
|
|
websocket_event: &WebsocketEvent,
|
|
source: &UpdateSource,
|
|
) -> Result<WebsocketEvent> {
|
|
self.upsert(websocket_event, source)
|
|
}
|
|
}
|