pub struct Folder {
pub id: FolderId,
pub name: String,
pub document_box: DocumentBoxScopeRaw,
pub folder_id: Option<FolderId>,
pub created_at: DateTime<Utc>,
pub created_by: Option<UserId>,
}Fields§
§id: FolderIdUnique identifier for the folder
name: StringName of the file
document_box: DocumentBoxScopeRawID of the document box the folder belongs to
folder_id: Option<FolderId>Parent folder ID if the folder is a child
created_at: DateTime<Utc>When the file was created
created_by: Option<UserId>User who created the folder
Implementations§
Source§impl Folder
impl Folder
Sourcepub async fn tree_all_children(
&self,
db: impl DbExecutor<'_>,
) -> DbResult<Vec<FolderId>>
pub async fn tree_all_children( &self, db: impl DbExecutor<'_>, ) -> DbResult<Vec<FolderId>>
Collects the IDs of all child folders within the current folder
Results are passed to the search engine when searching within a specific folder to only get results from the folder subtree
Sourcepub async fn count_children(
db: impl DbExecutor<'_>,
folder_id: FolderId,
) -> DbResult<FolderChildrenCount>
pub async fn count_children( db: impl DbExecutor<'_>, folder_id: FolderId, ) -> DbResult<FolderChildrenCount>
Uses a recursive query to count all the children in the provided folder
Sourcepub async fn resolve_path(
db: impl DbExecutor<'_>,
folder_id: FolderId,
) -> DbResult<Vec<FolderPathSegment>>
pub async fn resolve_path( db: impl DbExecutor<'_>, folder_id: FolderId, ) -> DbResult<Vec<FolderPathSegment>>
Collects the IDs and names of all parent folders of the provided folder
pub async fn move_to_folder( self, db: impl DbExecutor<'_>, folder_id: FolderId, ) -> DbResult<Folder>
pub async fn rename( self, db: impl DbExecutor<'_>, name: String, ) -> DbResult<Folder>
pub async fn find_by_id( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, id: FolderId, ) -> DbResult<Option<Folder>>
Sourcepub async fn all_non_root(
db: impl DbExecutor<'_>,
offset: u64,
page_size: u64,
) -> DbResult<Vec<Folder>>
pub async fn all_non_root( db: impl DbExecutor<'_>, offset: u64, page_size: u64, ) -> DbResult<Vec<Folder>>
Get all folders and sub folder across any scope in a paginated fashion (Ignores roots of document boxes)
pub async fn find_by_parent( db: impl DbExecutor<'_>, parent_id: FolderId, ) -> DbResult<Vec<Folder>>
pub async fn find_root( db: impl DbExecutor<'_>, document_box: &DocumentBoxScopeRaw, ) -> DbResult<Option<Folder>>
pub async fn create( db: impl DbExecutor<'_>, __arg1: CreateFolder, ) -> DbResult<Folder>
Sourcepub async fn delete(&self, db: impl DbExecutor<'_>) -> DbResult<PgQueryResult>
pub async fn delete(&self, db: impl DbExecutor<'_>) -> DbResult<PgQueryResult>
Deletes the folder
Sourcepub async fn resolve_with_extra_mixed_scopes(
db: impl DbExecutor<'_>,
folders_scope_with_id: Vec<(DocumentBoxScopeRaw, FolderId)>,
) -> DbResult<Vec<WithFullPathScope<FolderWithExtra>>>
pub async fn resolve_with_extra_mixed_scopes( db: impl DbExecutor<'_>, folders_scope_with_id: Vec<(DocumentBoxScopeRaw, FolderId)>, ) -> DbResult<Vec<WithFullPathScope<FolderWithExtra>>>
Finds a collection of folders that are in various document box scopes, resolves both the folders themselves and the folder path to traverse to get to each folder
Sourcepub async fn resolve_with_extra(
db: impl DbExecutor<'_>,
scope: &DocumentBoxScopeRaw,
folder_ids: Vec<Uuid>,
) -> DbResult<Vec<WithFullPath<FolderWithExtra>>>
pub async fn resolve_with_extra( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, folder_ids: Vec<Uuid>, ) -> DbResult<Vec<WithFullPath<FolderWithExtra>>>
Finds a collection of folders that are all within the same document box, resolves both the folders themselves and the folder path to traverse to get to each folder
pub async fn find_by_id_with_extra( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, id: FolderId, ) -> DbResult<Option<FolderWithExtra>>
pub async fn find_by_parent_with_extra( db: impl DbExecutor<'_>, parent_id: FolderId, ) -> DbResult<Vec<FolderWithExtra>>
pub async fn find_root_with_extra( db: impl DbExecutor<'_>, document_box: &DocumentBoxScopeRaw, ) -> DbResult<Option<FolderWithExtra>>
Trait Implementations§
Source§impl<'a, R: Row> FromRow<'a, R> for Folderwhere
&'a str: ColumnIndex<R>,
FolderId: Decode<'a, R::Database> + Type<R::Database>,
String: Decode<'a, R::Database> + Type<R::Database>,
DocumentBoxScopeRaw: Decode<'a, R::Database> + Type<R::Database>,
Option<FolderId>: Decode<'a, R::Database> + Type<R::Database>,
DateTime<Utc>: Decode<'a, R::Database> + Type<R::Database>,
Option<UserId>: Decode<'a, R::Database> + Type<R::Database>,
impl<'a, R: Row> FromRow<'a, R> for Folderwhere
&'a str: ColumnIndex<R>,
FolderId: Decode<'a, R::Database> + Type<R::Database>,
String: Decode<'a, R::Database> + Type<R::Database>,
DocumentBoxScopeRaw: Decode<'a, R::Database> + Type<R::Database>,
Option<FolderId>: Decode<'a, R::Database> + Type<R::Database>,
DateTime<Utc>: Decode<'a, R::Database> + Type<R::Database>,
Option<UserId>: Decode<'a, R::Database> + Type<R::Database>,
Auto Trait Implementations§
impl Freeze for Folder
impl RefUnwindSafe for Folder
impl Send for Folder
impl Sync for Folder
impl Unpin for Folder
impl UnwindSafe for Folder
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> 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>
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