pub struct GraphRepository { /* private fields */ }Implementations§
Source§impl GraphRepository
impl GraphRepository
pub fn new(pool: PgPool) -> Self
Sourcepub async fn insert(
&self,
conn: &mut PgConnection,
id: GraphId,
input: NewGraph,
) -> Result<GraphId, DomainError>
pub async fn insert( &self, conn: &mut PgConnection, id: GraphId, input: NewGraph, ) -> Result<GraphId, DomainError>
Create the sbol3-kind graph that backs a document. The caller mints
the GraphId so the document’s triples can be attributed to its
graph:document:{id} IRI before this write.
Sourcepub async fn exists_by_hash(&self, hash: &[u8]) -> Result<bool, DomainError>
pub async fn exists_by_hash(&self, hash: &[u8]) -> Result<bool, DomainError>
Returns true when any document graph already carries this content hash. Used by bulk import to dedup re-uploaded files without re-parsing.
pub async fn get(&self, id: GraphId) -> Result<Option<GraphRecord>, DomainError>
Sourcepub async fn list(
&self,
filter: &ListGraphsFilter,
) -> Result<Vec<GraphRecord>, DomainError>
pub async fn list( &self, filter: &ListGraphsFilter, ) -> Result<Vec<GraphRecord>, DomainError>
Paginated newest-first listing for the CLI / lab UI. Filters are optional and ANDed; cardinality is small so we don’t expose a keyset cursor here.
Sourcepub async fn id_by_document_iri(
&self,
document_iri: &str,
) -> Result<Option<GraphId>, DomainError>
pub async fn id_by_document_iri( &self, document_iri: &str, ) -> Result<Option<GraphId>, DomainError>
Resolve a document graph’s surrogate id from its (unique) document IRI.
Sourcepub async fn delete(&self, id: GraphId) -> Result<bool, DomainError>
pub async fn delete(&self, id: GraphId) -> Result<bool, DomainError>
Delete one document by dropping its graph. The graph’s triples cascade
via their FK; the graph’s derived objects (whose graph_id FK is
ON DELETE SET NULL) are removed explicitly first, so the object view
no longer returns them and their revisions cascade away. Both deletes
share one transaction. Returns true if a graph row was removed.
Sourcepub async fn id_by_document_iri_in(
&self,
conn: &mut PgConnection,
document_iri: &str,
) -> Result<Option<GraphId>, DomainError>
pub async fn id_by_document_iri_in( &self, conn: &mut PgConnection, document_iri: &str, ) -> Result<Option<GraphId>, DomainError>
Connection-scoped id_by_document_iri, so a
replace can resolve and delete the old graph inside the import’s
transaction.
Sourcepub async fn delete_in(
&self,
conn: &mut PgConnection,
id: GraphId,
) -> Result<bool, DomainError>
pub async fn delete_in( &self, conn: &mut PgConnection, id: GraphId, ) -> Result<bool, DomainError>
Connection-scoped delete, for an in-transaction replace.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GraphRepository
impl !UnwindSafe for GraphRepository
impl Freeze for GraphRepository
impl Send for GraphRepository
impl Sync for GraphRepository
impl Unpin for GraphRepository
impl UnsafeUnpin for GraphRepository
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