rust-postgres/tokio-postgres/src/stmt.rs

25 lines
467 B
Rust
Raw Normal View History

2018-12-09 01:40:37 +00:00
use crate::types::Type;
2016-12-26 21:29:30 +00:00
2017-07-22 04:08:39 +00:00
/// Information about a column of a Postgres query.
#[derive(Debug)]
2016-12-26 21:29:30 +00:00
pub struct Column {
name: String,
type_: Type,
}
impl Column {
pub(crate) fn new(name: String, type_: Type) -> Column {
2018-12-10 05:23:31 +00:00
Column { name, type_ }
2016-12-26 21:29:30 +00:00
}
2017-07-22 04:08:39 +00:00
/// Returns the name of the column.
2016-12-26 21:29:30 +00:00
pub fn name(&self) -> &str {
&self.name
}
2017-07-22 04:08:39 +00:00
/// Returns the type of the column.
2016-12-26 21:29:30 +00:00
pub fn type_(&self) -> &Type {
&self.type_
}
}