Struct redshift::writer::ColumnDefinition
[−]
[src]
pub struct ColumnDefinition<'a, T> { pub name: &'a str, pub extract_column: Box<Fn(&T) -> String>, }
Structure to define column name and and column value
Example
extern crate redshift; use std::str; struct TestItem<'a> { pub A: &'a str, pub B: &'a str, pub C: &'a str, } fn main() { let test_column_definitions = vec![ redshift::writer::ColumnDefinition::<TestItem> { name: "Acolumn", extract_column: Box::new(move |i: &TestItem| i.A.to_string().clone()), }, redshift::writer::ColumnDefinition::<TestItem> { name: "Bcolumn", extract_column: Box::new(move |i: &TestItem| i.B.to_string().clone()), }, redshift::writer::ColumnDefinition::<TestItem> { name: "Ccolumn", extract_column: Box::new(move |i: &TestItem| i.C.to_string().clone()), }, ]; }
Fields
name: &'a str
Column name
extract_column: Box<Fn(&T) -> String>
Method to extract the column value from item T