pub struct CsvImportPolicy { /* private fields */ }Expand description
The directory LOAD CSV may read from, and its per-file limits.
Without a policy, LOAD CSV is refused. With one, the canonical path of
every source, after resolving .. components and symbolic links, must be
a regular file inside the canonical import root.
Implementations§
Source§impl CsvImportPolicy
impl CsvImportPolicy
pub fn new(root: impl Into<PathBuf>, limits: CsvImportLimits) -> Self
pub fn root(&self) -> &Path
pub fn limits(&self) -> CsvImportLimits
Sourcepub fn resolve(&self, location: &str) -> Result<PathBuf>
pub fn resolve(&self, location: &str) -> Result<PathBuf>
Resolves location to a canonical file path inside the import root.
Errors that depend only on the statement are Semantic: a malformed
or non-local location and a location outside the import directory
(after resolving symbolic links, or lexically when the target does not
exist). Filesystem conditions observed at run time are Execution: an
import root or source that cannot be accessed.
Sourcepub fn open(
&self,
source: &LoadCsvSource,
parameters: &BTreeMap<String, Value>,
) -> Result<CsvRows<File>>
pub fn open( &self, source: &LoadCsvSource, parameters: &BTreeMap<String, Value>, ) -> Result<CsvRows<File>>
Opens source for streaming after resolving and validating its location.
The source must be a regular file before it is opened: opening a FIFO or device could block or never end. The opened handle is checked again for a file replaced between the two system calls.
Trait Implementations§
Source§impl Clone for CsvImportPolicy
impl Clone for CsvImportPolicy
Source§impl Debug for CsvImportPolicy
impl Debug for CsvImportPolicy
impl Eq for CsvImportPolicy
Source§impl PartialEq for CsvImportPolicy
impl PartialEq for CsvImportPolicy
impl StructuralPartialEq for CsvImportPolicy
Auto Trait Implementations§
impl Forget for CsvImportPolicy
impl Freeze for CsvImportPolicy
impl RefUnwindSafe for CsvImportPolicy
impl Send for CsvImportPolicy
impl Sync for CsvImportPolicy
impl Unpin for CsvImportPolicy
impl UnsafeUnpin for CsvImportPolicy
impl UnwindSafe for CsvImportPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more