pub struct Link {
pub id: LinkId,
pub name: String,
pub value: String,
pub pinned: bool,
pub folder_id: FolderId,
pub created_at: DateTime<Utc>,
pub created_by: Option<UserId>,
}Fields§
§id: LinkIdUnique identifier for the link
name: StringName of the link
value: Stringvalue of the link
pinned: boolWhether the link is pinned
folder_id: FolderIdParent folder ID
created_at: DateTime<Utc>When the link was created
created_by: Option<UserId>User who created the link
Implementations§
Source§impl Link
impl Link
pub async fn create( db: impl DbExecutor<'_>, __arg1: CreateLink, ) -> DbResult<Link>
pub async fn move_to_folder( self, db: impl DbExecutor<'_>, folder_id: FolderId, ) -> DbResult<Link>
pub async fn rename( self, db: impl DbExecutor<'_>, name: String, ) -> DbResult<Link>
pub async fn set_pinned( self, db: impl DbExecutor<'_>, pinned: bool, ) -> DbResult<Link>
pub async fn update_value( self, db: impl DbExecutor<'_>, value: String, ) -> DbResult<Link>
pub async fn all( db: impl DbExecutor<'_>, offset: u64, page_size: u64, ) -> DbResult<Vec<LinkWithScope>>
pub async fn find( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, link_id: LinkId, ) -> DbResult<Option<Link>>
Sourcepub async fn resolve_path(
db: impl DbExecutor<'_>,
link_id: LinkId,
) -> DbResult<Vec<FolderPathSegment>>
pub async fn resolve_path( db: impl DbExecutor<'_>, link_id: LinkId, ) -> DbResult<Vec<FolderPathSegment>>
Collects the IDs and names of all parent folders of the provided folder
Sourcepub async fn find_by_parent(
db: impl DbExecutor<'_>,
parent_id: FolderId,
) -> DbResult<Vec<Link>>
pub async fn find_by_parent( db: impl DbExecutor<'_>, parent_id: FolderId, ) -> DbResult<Vec<Link>>
Finds all links within the provided parent folder
Sourcepub async fn delete(&self, db: impl DbExecutor<'_>) -> DbResult<PgQueryResult>
pub async fn delete(&self, db: impl DbExecutor<'_>) -> DbResult<PgQueryResult>
Deletes the link
Sourcepub async fn resolve_with_extra_mixed_scopes(
db: impl DbExecutor<'_>,
links_scope_with_id: Vec<(DocumentBoxScopeRaw, LinkId)>,
) -> DbResult<Vec<WithFullPathScope<LinkWithExtra>>>
pub async fn resolve_with_extra_mixed_scopes( db: impl DbExecutor<'_>, links_scope_with_id: Vec<(DocumentBoxScopeRaw, LinkId)>, ) -> DbResult<Vec<WithFullPathScope<LinkWithExtra>>>
Finds a collection of links that are within various document box scopes, resolves both the links themselves and the folder path to traverse to get to each link
Sourcepub async fn resolve_with_extra(
db: impl DbExecutor<'_>,
scope: &DocumentBoxScopeRaw,
link_ids: Vec<Uuid>,
) -> DbResult<Vec<WithFullPath<LinkWithExtra>>>
pub async fn resolve_with_extra( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, link_ids: Vec<Uuid>, ) -> DbResult<Vec<WithFullPath<LinkWithExtra>>>
Finds a collection of links that are all within the same document box, resolves both the links themselves and the folder path to traverse to get to each link
Sourcepub async fn find_by_parent_with_extra(
db: impl DbExecutor<'_>,
parent_id: FolderId,
) -> DbResult<Vec<LinkWithExtra>>
pub async fn find_by_parent_with_extra( db: impl DbExecutor<'_>, parent_id: FolderId, ) -> DbResult<Vec<LinkWithExtra>>
Finds all links within the provided parent folder
pub async fn find_with_extra( db: impl DbExecutor<'_>, scope: &DocumentBoxScopeRaw, link_id: LinkId, ) -> DbResult<Option<LinkWithExtra>>
Trait Implementations§
Source§impl<'a, R: Row> FromRow<'a, R> for Linkwhere
&'a str: ColumnIndex<R>,
LinkId: Decode<'a, R::Database> + Type<R::Database>,
String: Decode<'a, R::Database> + Type<R::Database>,
bool: Decode<'a, R::Database> + Type<R::Database>,
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 Linkwhere
&'a str: ColumnIndex<R>,
LinkId: Decode<'a, R::Database> + Type<R::Database>,
String: Decode<'a, R::Database> + Type<R::Database>,
bool: Decode<'a, R::Database> + Type<R::Database>,
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 Link
impl RefUnwindSafe for Link
impl Send for Link
impl Sync for Link
impl Unpin for Link
impl UnwindSafe for Link
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> 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>
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 moreCreates a shared type from an unshared type.