pub struct AllFilesStore { /* private fields */ }Expand description
Store for managing all files in database
Implementations§
Source§impl AllFilesStore
impl AllFilesStore
Sourcepub fn new(
pool: Arc<Pool<SqliteConnectionManager>>,
all_files_dir: PathBuf,
) -> Self
pub fn new( pool: Arc<Pool<SqliteConnectionManager>>, all_files_dir: PathBuf, ) -> Self
Create a new all files store
Sourcepub fn get_all_files_dir(&self) -> &Path
pub fn get_all_files_dir(&self) -> &Path
Get the all files directory path
Sourcepub fn create_folder(
&self,
parent_id: Option<i64>,
name: &str,
) -> Result<AllFile>
pub fn create_folder( &self, parent_id: Option<i64>, name: &str, ) -> Result<AllFile>
Create a folder
Sourcepub fn upload_file(
&self,
parent_id: Option<i64>,
name: &str,
content: &[u8],
mime_type: Option<&str>,
) -> Result<AllFile>
pub fn upload_file( &self, parent_id: Option<i64>, name: &str, content: &[u8], mime_type: Option<&str>, ) -> Result<AllFile>
Upload a file
Sourcepub fn upload_files_with_structure(
&self,
files: Vec<(Option<String>, String, Vec<u8>)>,
parent_id: Option<i64>,
) -> Result<Vec<AllFile>>
pub fn upload_files_with_structure( &self, files: Vec<(Option<String>, String, Vec<u8>)>, parent_id: Option<i64>, ) -> Result<Vec<AllFile>>
Upload multiple files with their directory structure
Sourcepub fn get_file_tree(&self) -> Result<Vec<AllFileTree>>
pub fn get_file_tree(&self) -> Result<Vec<AllFileTree>>
Get file tree (nested)
Sourcepub fn get_all_files(&self) -> Result<Vec<AllFile>>
pub fn get_all_files(&self) -> Result<Vec<AllFile>>
Get all files (flat list)
Sourcepub fn get_file_by_path(&self, path: &str) -> Result<AllFile>
pub fn get_file_by_path(&self, path: &str) -> Result<AllFile>
Get file by path
Sourcepub fn get_file_bytes(&self, id: i64) -> Result<Vec<u8>>
pub fn get_file_bytes(&self, id: i64) -> Result<Vec<u8>>
Get file content as raw bytes (for binary-aware extraction)
Sourcepub fn get_file_content_string(&self, id: i64) -> Result<String>
pub fn get_file_content_string(&self, id: i64) -> Result<String>
Get file content as string (text files only — binary files return lossy UTF-8)
Sourcepub fn record_access(&self, id: i64) -> Result<()>
pub fn record_access(&self, id: i64) -> Result<()>
Update access count
Sourcepub fn delete_file(&self, id: i64) -> Result<()>
pub fn delete_file(&self, id: i64) -> Result<()>
Delete file or folder by ID
Auto Trait Implementations§
impl Freeze for AllFilesStore
impl !RefUnwindSafe for AllFilesStore
impl Send for AllFilesStore
impl Sync for AllFilesStore
impl Unpin for AllFilesStore
impl UnsafeUnpin for AllFilesStore
impl !UnwindSafe for AllFilesStore
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