pub struct PgGraph { /* private fields */ }Expand description
PostgreSQL-backed GraphBackend over one mutex-guarded connection.
Opening applies the schema and runs pending migrations, matching
SqliteGraph::open in the main crate.
Implementations§
Source§impl PgGraph
impl PgGraph
Sourcepub fn connect(url: &str) -> Result<Self>
pub fn connect(url: &str) -> Result<Self>
Connect to url (libpq connstring or postgresql:// URL), apply schema
and migrations, and return a ready backend.
Sourcepub fn connect_config(config: &Config) -> Result<Self>
pub fn connect_config(config: &Config) -> Result<Self>
Connect from a pre-built Config (useful for overriding dbname,
e.g. when targeting a throwaway test database).
Sourcepub fn connect_tls<T>(url: &str, connector: T) -> Result<Self>where
T: MakeTlsConnect<Socket> + Send + 'static,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
pub fn connect_tls<T>(url: &str, connector: T) -> Result<Self>where
T: MakeTlsConnect<Socket> + Send + 'static,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
Connect to url using a caller-supplied TLS connector — for servers
requiring sslmode=require or stricter (e.g. RDS with
rds.force_ssl). See Self::connect_native_tls for the common case
of a system-trust-store native-tls connector.
Sourcepub fn connect_config_tls<T>(config: &Config, connector: T) -> Result<Self>where
T: MakeTlsConnect<Socket> + Send + 'static,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
pub fn connect_config_tls<T>(config: &Config, connector: T) -> Result<Self>where
T: MakeTlsConnect<Socket> + Send + 'static,
T::TlsConnect: Send,
T::Stream: Send,
<T::TlsConnect as TlsConnect<Socket>>::Future: Send,
Connect from a pre-built Config using a caller-supplied TLS
connector. Mirrors Self::connect_config but negotiates TLS instead
of postgres::NoTls.
Sourcepub fn connect_native_tls(url: &str) -> Result<Self>
pub fn connect_native_tls(url: &str) -> Result<Self>
Connect to url over TLS using native-tls with the system trust
store (default settings — full certificate chain and hostname
verification against the system trust store, not weakened) — covers
the common case of a Postgres server with a publicly-trusted
certificate (e.g. RDS sslmode=require). For custom CA bundles or
client certificates, build a connector and call Self::connect_tls
directly.
Trait Implementations§
Source§impl GraphBackend for PgGraph
impl GraphBackend for PgGraph
Source§fn read_node(&self, id: &str) -> Result<Option<GraphNode>>
fn read_node(&self, id: &str) -> Result<Option<GraphNode>>
None if absent).Source§fn delete_node(&self, id: &str) -> Result<bool>
fn delete_node(&self, id: &str) -> Result<bool>
true if a row was removed.Source§fn search_nodes(&self, query: &str, limit: usize) -> Result<Vec<GraphNode>>
fn search_nodes(&self, query: &str, limit: usize) -> Result<Vec<GraphNode>>
Source§fn query_nodes(
&self,
tag: Option<&str>,
node_type: Option<&str>,
project: Option<&str>,
limit: usize,
) -> Result<Vec<GraphNode>>
fn query_nodes( &self, tag: Option<&str>, node_type: Option<&str>, project: Option<&str>, limit: usize, ) -> Result<Vec<GraphNode>>
Source§fn smart_recall(
&self,
project: Option<&str>,
hint: Option<&str>,
limit: usize,
) -> Result<Vec<ScoredNode>>
fn smart_recall( &self, project: Option<&str>, hint: Option<&str>, limit: usize, ) -> Result<Vec<ScoredNode>>
depth hops from start_id, returning related node
IDs (excluding the start).Source§fn append_edge(&self, edge: &GraphEdge) -> Result<()>
fn append_edge(&self, edge: &GraphEdge) -> Result<()>
Source§fn edges_for_node(&self, node_id: &str) -> Result<Vec<GraphEdge>>
fn edges_for_node(&self, node_id: &str) -> Result<Vec<GraphEdge>>
Source§fn delete_edge(&self, id: &str) -> Result<bool>
fn delete_edge(&self, id: &str) -> Result<bool>
true if a row was removed.Source§fn remove_edges_for_node(&self, node_id: &str) -> Result<()>
fn remove_edges_for_node(&self, node_id: &str) -> Result<()>
Source§fn current_version(&self) -> Result<u32>
fn current_version(&self) -> Result<u32>
Auto Trait Implementations§
impl !Freeze for PgGraph
impl RefUnwindSafe for PgGraph
impl Send for PgGraph
impl Sync for PgGraph
impl Unpin for PgGraph
impl UnsafeUnpin for PgGraph
impl UnwindSafe for PgGraph
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.