/// Load all events for a particular `aggregate_id`
Load all events for a particular `aggregate_id`
Load all events for a particular ` aggregate_id `
fn load_events(
        &mut self,
        aggregate_id: &str,
    ) -> Result<Vec<EventContext<C, E>>, Error> {
        let aggregate_type = A::aggregate_type();
        trace!(
            "loading events for aggregate id '{}'",
            aggregate_id
        );
        let rows: Vec<(i64, String, String)> = match self.conn.exec(
            SELECT_EVENTS,
            (&aggregate_type, &aggregate_id),
        ) {
            Ok(x) => x,
            Err(e) => {
                return Err(Error::new(
                    format!(
                        "unable to load events table for aggregate \
                         id '{}' with error: {}",
                        &aggregate_id, e
                    )
                    .as_str(),
                ));
            },
        };
        let mut result = Vec::new();
        for row in rows {
            let payload = match serde_json::from_str(row.1.as_str()) {
                Ok(x) => x,
                Err(e) => {
                    return Err(Error::new(
                        format!(
                            "bad payload found in events table for \
                             aggregate id '{}' with error: {}",
                            &aggregate_id, e
                        )
                        .as_str(),
                    ));
                },
            };
            let metadata = match serde_json::from_str(row.2.as_str())
            {
                Ok(x) => x,
                Err(e) => {
                    return Err(Error::new(
                        format!(
                            "bad metadata found in events table for \
                             aggregate id '{}' with error: {}",
                            &aggregate_id, e
                        )
                        .as_str(),
                    ));
                },
            };
            result.push(EventContext::new(
                aggregate_id.to_string(),
                row.0,
                payload,
                metadata,
            ));
        }
        Ok(result)
    }
fn load_events ( & mut self , aggregate_id : & str , ) -> Result < Vec < EventContext < C , E > > , Error > { let aggregate_type = A :: aggregate_type ( ) ; trace ! ( " " aggregate_id ) ; let rows : Vec < ( i64 , String , String ) > = match self . conn . exec ( SELECT_EVENTS , ( & aggregate_type , & aggregate_id ) , ) { Ok ( x ) => x , Err ( e ) => { return Err ( Error :: new ( format ! ( " \
 " aggregate_id e ) . as_str ( ) , ) ) ; } , } ; let mut result = Vec :: new ( ) ; for row in rows { let payload = match serde_json :: from_str ( row . 1 . as_str ( ) ) { Ok ( x ) => x , Err ( e ) => { return Err ( Error :: new ( format ! ( " \
 " aggregate_id e ) . as_str ( ) , ) ) ; } , } ; let metadata = match serde_json :: from_str ( row . 2 . as_str ( ) ) { Ok ( x ) => x , Err ( e ) => { return Err ( Error :: new ( format ! ( " \
 " aggregate_id e ) . as_str ( ) , ) ) ; } , } ; result . push ( EventContext :: new ( aggregate_id . to_string ( ) , row . 0 , payload , metadata , ) ) ; } Ok ( result ) }
Load all events for a particular `aggregate_id`
Load all events for a particular ` aggregate_id `
&mut self
aggregate_id
&str