Folder

Struct Folder 

Source
pub struct Folder {
    pub id: FolderId,
    pub name: String,
    pub pinned: bool,
    pub document_box: DocumentBoxScopeRaw,
    pub folder_id: Option<FolderId>,
    pub created_at: DateTime<Utc>,
    pub created_by: Option<UserId>,
}

Fields§

§id: FolderId

Unique identifier for the folder

§name: String

Name of the file

§pinned: bool

Whether the folder is marked as pinned

§document_box: DocumentBoxScopeRaw

ID 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

Source

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

Source

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

Source

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

Source

pub async fn move_to_folder( self, db: impl DbExecutor<'_>, folder_id: FolderId, ) -> DbResult<Folder>

Source

pub async fn rename( self, db: impl DbExecutor<'_>, name: String, ) -> DbResult<Folder>

Source

pub async fn set_pinned( self, db: impl DbExecutor<'_>, pinned: bool, ) -> DbResult<Folder>

Source

pub async fn find_by_id( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, id: FolderId, ) -> DbResult<Option<Folder>>

Source

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)

Source

pub async fn find_by_parent( db: impl DbExecutor<'_>, parent_id: FolderId, ) -> DbResult<Vec<Folder>>

Source

pub async fn find_root( db: impl DbExecutor<'_>, document_box: &DocumentBoxScopeRaw, ) -> DbResult<Option<Folder>>

Source

pub async fn create( db: impl DbExecutor<'_>, __arg1: CreateFolder, ) -> DbResult<Folder>

Source

pub async fn delete(&self, db: impl DbExecutor<'_>) -> DbResult<PgQueryResult>

Deletes the folder

Source

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

Source

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

Source

pub async fn find_by_id_with_extra( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, id: FolderId, ) -> DbResult<Option<FolderWithExtra>>

Source

pub async fn find_by_parent_with_extra( db: impl DbExecutor<'_>, parent_id: FolderId, ) -> DbResult<Vec<FolderWithExtra>>

Source

pub async fn find_root_with_extra( db: impl DbExecutor<'_>, document_box: &DocumentBoxScopeRaw, ) -> DbResult<Option<FolderWithExtra>>

Source

pub async fn total_count(db: impl DbExecutor<'_>) -> DbResult<i64>

Get the total number of folders in the tenant

Trait Implementations§

Source§

impl Clone for Folder

Source§

fn clone(&self) -> Folder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Folder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, R: Row> FromRow<'a, R> for Folder

Source§

fn from_row(__row: &'a R) -> Result<Self>

Source§

impl Serialize for Folder

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more