1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::ops::Index;
use types::SqlValue;

/// Represents a row of data returned from a SQL query.
///
#[derive(Debug)]
pub struct Row {
    columns: Vec<SqlValue>,
}
impl Row {
    pub(crate) fn new(// crate) fn new(
                      columns: Vec<SqlValue>)
                      -> Row {
        Row { columns: columns }
    }

    /// Returns the columns in the row.
    ///
    pub fn columns(&self) -> &Vec<SqlValue> {
        &self.columns
    }
}
impl Index<usize> for Row {
    type Output = SqlValue;

    fn index(&self, index: usize) -> &SqlValue {
        &self.columns[index]
    }
}