Skip to content

Commit e2b060b

Browse files
committed
primitives - EventAggregateResponse add Channel & impl From<&Row> for EventAggregate
1 parent dd1025b commit e2b060b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

primitives/src/sentry.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,30 @@ pub struct ValidatorMessageResponse {
114114

115115
#[derive(Serialize, Deserialize, Debug)]
116116
pub struct EventAggregateResponse {
117+
pub channel: Channel,
117118
pub events: Vec<EventAggregate>,
118119
}
119120

120121
#[cfg(feature = "postgres")]
121122
mod postgres {
122123
use super::ValidatorMessage;
124+
use crate::sentry::EventAggregate;
123125
use crate::validator::MessageTypes;
124126
use bytes::BytesMut;
125127
use postgres_types::{accepts, to_sql_checked, IsNull, Json, ToSql, Type};
126128
use std::error::Error;
127129
use tokio_postgres::Row;
128130

131+
impl From<&Row> for EventAggregate {
132+
fn from(row: &Row) -> Self {
133+
Self {
134+
channel_id: row.get("channel_id"),
135+
created: row.get("created"),
136+
events: row.get::<_, Json<_>>("events").0,
137+
}
138+
}
139+
}
140+
129141
impl From<&Row> for ValidatorMessage {
130142
fn from(row: &Row) -> Self {
131143
Self {

0 commit comments

Comments
 (0)