Struct raphtory_io::graph_loader::source::json_loader::JsonLinesLoader
source · pub struct JsonLinesLoader<REC: DeserializeOwned> { /* private fields */ }Expand description
A struct that defines the CSV loader with configurable options.
Implementations§
source§impl<REC: DeserializeOwned + Debug + Sync> JsonLinesLoader<REC>
impl<REC: DeserializeOwned + Debug + Sync> JsonLinesLoader<REC>
sourcepub fn new(path: PathBuf, regex_filter: Option<Regex>) -> Self
pub fn new(path: PathBuf, regex_filter: Option<Regex>) -> Self
Creates a new CSV loader with the given path.
sourcepub fn load_into_graph<F, G>(&self, g: &G, loader: F) -> Result<(), JsonErr>where
REC: DeserializeOwned + Debug,
F: Fn(REC, &G) -> Result<(), GraphError> + Send + Sync,
G: Sync,
pub fn load_into_graph<F, G>(&self, g: &G, loader: F) -> Result<(), JsonErr>where REC: DeserializeOwned + Debug, F: Fn(REC, &G) -> Result<(), GraphError> + Send + Sync, G: Sync,
Load data from all JSON 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<REC> RefUnwindSafe for JsonLinesLoader<REC>where REC: RefUnwindSafe,
impl<REC> Send for JsonLinesLoader<REC>where REC: Send,
impl<REC> Sync for JsonLinesLoader<REC>where REC: Sync,
impl<REC> Unpin for JsonLinesLoader<REC>where REC: Unpin,
impl<REC> UnwindSafe for JsonLinesLoader<REC>where REC: UnwindSafe,
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