pub struct Exporter<'a> { /* private fields */ }Expand description
Exporter for JSONL sync files.
The exporter reads all records from the database for a specific project
and writes them to JSONL files in the project’s .savecontext/ directory.
Uses snapshot mode: files are overwritten with current state (git tracks history).
Implementations§
Source§impl<'a> Exporter<'a>
impl<'a> Exporter<'a>
Sourcepub fn new(storage: &'a mut SqliteStorage, project_path: String) -> Self
pub fn new(storage: &'a mut SqliteStorage, project_path: String) -> Self
Sourcepub fn with_output_dir(
storage: &'a mut SqliteStorage,
project_path: String,
output_dir: PathBuf,
) -> Self
pub fn with_output_dir( storage: &'a mut SqliteStorage, project_path: String, output_dir: PathBuf, ) -> Self
Create a new exporter with a custom output directory.
This is primarily for testing purposes.
Sourcepub fn output_dir(&self) -> &Path
pub fn output_dir(&self) -> &Path
Get the output directory.
Sourcepub fn export(&mut self, force: bool) -> SyncResult<ExportStats>
pub fn export(&mut self, force: bool) -> SyncResult<ExportStats>
Export all records to JSONL files (snapshot mode).
This exports all records for the project, overwriting existing files.
Safety checks prevent accidental data loss unless force is true.
§Arguments
force- If true, skip safety checks and overwrite regardless
§Errors
Returns an error if:
- Database queries fail
- File writes fail
- Safety check fails (records would be lost) and force=false
Auto Trait Implementations§
impl<'a> Freeze for Exporter<'a>
impl<'a> !RefUnwindSafe for Exporter<'a>
impl<'a> Send for Exporter<'a>
impl<'a> !Sync for Exporter<'a>
impl<'a> Unpin for Exporter<'a>
impl<'a> UnsafeUnpin for Exporter<'a>
impl<'a> !UnwindSafe for Exporter<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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