pub struct Folder {
pub id: Uuid,
pub name: String,
pub pinned: bool,
pub document_box: String,
pub folder_id: Option<Uuid>,
pub created_at: DateTime<Utc>,
pub created_by: Option<String>,
}Fields§
§id: UuidUnique identifier for the folder
name: StringName of the file
pinned: boolWhether the folder is marked as pinned
document_box: StringID of the document box the folder belongs to
folder_id: Option<Uuid>Parent folder ID if the folder is a child
created_at: DateTime<Utc>When the folder was created
created_by: Option<String>User who created the folder
Implementations§
Source§impl Folder
impl Folder
pub async fn create( db: impl PgExecutor<'_>, __arg1: CreateFolder, ) -> Result<Folder, Error>
Sourcepub async fn tree_all_children(
&self,
db: impl PgExecutor<'_>,
) -> Result<Vec<Uuid>, Error>
pub async fn tree_all_children( &self, db: impl PgExecutor<'_>, ) -> Result<Vec<Uuid>, Error>
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 PgExecutor<'_>,
folder_id: Uuid,
) -> Result<FolderChildrenCount, Error>
pub async fn count_children( db: impl PgExecutor<'_>, folder_id: Uuid, ) -> Result<FolderChildrenCount, Error>
Uses a recursive query to count all the children in the provided folder
Sourcepub async fn resolve_path(
db: impl PgExecutor<'_>,
folder_id: Uuid,
) -> Result<Vec<FolderPathSegment>, Error>
pub async fn resolve_path( db: impl PgExecutor<'_>, folder_id: Uuid, ) -> Result<Vec<FolderPathSegment>, Error>
Collects the IDs and names of all parent folders of the provided folder
pub async fn move_to_folder( self, db: impl PgExecutor<'_>, folder_id: Uuid, ) -> Result<Folder, Error>
pub async fn rename( self, db: impl PgExecutor<'_>, name: String, ) -> Result<Folder, Error>
pub async fn set_pinned( self, db: impl PgExecutor<'_>, pinned: bool, ) -> Result<Folder, Error>
pub async fn find_by_id( db: impl PgExecutor<'_>, scope: &String, id: Uuid, ) -> Result<Option<Folder>, Error>
Sourcepub async fn all_non_root(
db: impl PgExecutor<'_>,
offset: u64,
page_size: u64,
) -> Result<Vec<Folder>, Error>
pub async fn all_non_root( db: impl PgExecutor<'_>, offset: u64, page_size: u64, ) -> Result<Vec<Folder>, Error>
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 PgExecutor<'_>, parent_id: Uuid, ) -> Result<Vec<Folder>, Error>
pub async fn find_root( db: impl PgExecutor<'_>, document_box: &String, ) -> Result<Option<Folder>, Error>
Sourcepub async fn delete(
&self,
db: impl PgExecutor<'_>,
) -> Result<PgQueryResult, Error>
pub async fn delete( &self, db: impl PgExecutor<'_>, ) -> Result<PgQueryResult, Error>
Deletes the folder
Sourcepub async fn resolve_with_extra_mixed_scopes(
db: impl PgExecutor<'_>,
folders_scope_with_id: Vec<DocboxInputPair<'_>>,
) -> Result<Vec<WithFullPath<FolderWithExtra>>, Error>
pub async fn resolve_with_extra_mixed_scopes( db: impl PgExecutor<'_>, folders_scope_with_id: Vec<DocboxInputPair<'_>>, ) -> Result<Vec<WithFullPath<FolderWithExtra>>, Error>
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 PgExecutor<'_>,
scope: &String,
folder_ids: Vec<Uuid>,
) -> Result<Vec<WithFullPath<FolderWithExtra>>, Error>
pub async fn resolve_with_extra( db: impl PgExecutor<'_>, scope: &String, folder_ids: Vec<Uuid>, ) -> Result<Vec<WithFullPath<FolderWithExtra>>, Error>
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 PgExecutor<'_>, scope: &String, id: Uuid, ) -> Result<Option<WithFullPath<FolderWithExtra>>, Error>
pub async fn find_by_parent_with_extra( db: impl PgExecutor<'_>, parent_id: Uuid, ) -> Result<Vec<FolderWithExtra>, Error>
pub async fn find_root_with_extra( db: impl PgExecutor<'_>, document_box: &String, ) -> Result<Option<WithFullPath<FolderWithExtra>>, Error>
Sourcepub async fn total_count(db: impl PgExecutor<'_>) -> Result<i64, Error>
pub async fn total_count(db: impl PgExecutor<'_>) -> Result<i64, Error>
Get the total number of folders in the tenant
Trait Implementations§
Source§impl<'q> Encode<'_, Postgres> for Folder
impl<'q> Encode<'_, Postgres> for Folder
Source§fn encode_by_ref(
&self,
buf: &mut PgArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn encode_by_ref( &self, buf: &mut PgArgumentBuffer, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn size_hint(&self) -> usize
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl<'a> From<&'a Folder> for FolderPathSegment
impl<'a> From<&'a Folder> for FolderPathSegment
Source§fn from(value: &'a Folder) -> FolderPathSegment
fn from(value: &'a Folder) -> FolderPathSegment
Source§impl<'a, R> FromRow<'a, R> for Folderwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
impl<'a, R> FromRow<'a, R> for Folderwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Source§impl PgHasArrayType for Folder
impl PgHasArrayType for Folder
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
Source§impl Serialize for Folder
impl Serialize for Folder
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Folder
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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