Struct raphtory_io::graph_loader::source::csv_loader::CsvLoader
source · pub struct CsvLoader { /* private fields */ }Expand description
A struct that defines the CSV loader with configurable options.
Implementations§
source§impl CsvLoader
impl CsvLoader
sourcepub fn set_header(self, h: bool) -> Self
pub fn set_header(self, h: bool) -> Self
sourcepub fn set_delimiter(self, d: &str) -> Self
pub fn set_delimiter(self, d: &str) -> Self
sourcepub fn with_filter(self, r: Regex) -> Self
pub fn with_filter(self, r: Regex) -> Self
Sets the regex filter to select specific CSV files by name.
Arguments
r- A regex pattern to filter CSV files by name.
Example
use regex::Regex;
use raphtory_io::graph_loader::source::csv_loader::CsvLoader;
let loader = CsvLoader::new("/path/to/csv_files")
.with_filter(Regex::new(r"file_name_pattern").unwrap());sourcepub fn load_into_graph<F, REC, G>(&self, g: &G, loader: F) -> Result<(), CsvErr>where
REC: DeserializeOwned + Debug,
F: Fn(REC, &G) + Send + Sync,
G: Sync,
pub fn load_into_graph<F, REC, G>(&self, g: &G, loader: F) -> Result<(), CsvErr>where REC: DeserializeOwned + Debug, F: Fn(REC, &G) + Send + Sync, G: Sync,
Load data from all CSV files in the directory into a graph.
Arguments
g- A reference to the graph object where the data should be loaded.loader- A closure that takes a deserialized record and the graph object as arguments and adds the record to the graph.
Returns
A Result containing an empty Ok value if the data is loaded successfully.
Errors
An error of type CsvErr is returned if an I/O error occurs while reading the files or parsing the CSV data.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for CsvLoader
impl Send for CsvLoader
impl Sync for CsvLoader
impl Unpin for CsvLoader
impl UnwindSafe for CsvLoader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more