pub struct PostgresPersistence { /* private fields */ }Available on crate feature
postgres only.Expand description
PostgreSQL session persistence.
Implementations§
Source§impl PostgresPersistence
impl PostgresPersistence
Sourcepub async fn connect(database_url: &str) -> Result<Self, Error>
pub async fn connect(database_url: &str) -> Result<Self, Error>
Connect to database without running migrations.
Use this when managing schema externally (production deployments).
Sourcepub async fn connect_with_config(
database_url: &str,
config: PostgresConfig,
) -> Result<Self, Error>
pub async fn connect_with_config( database_url: &str, config: PostgresConfig, ) -> Result<Self, Error>
Connect with custom configuration, without running migrations.
Sourcepub async fn connect_and_migrate(database_url: &str) -> Result<Self, Error>
pub async fn connect_and_migrate(database_url: &str) -> Result<Self, Error>
Connect and run migrations automatically.
Convenient for development and simple deployments.
Sourcepub async fn connect_and_migrate_with_config(
database_url: &str,
config: PostgresConfig,
) -> Result<Self, Error>
pub async fn connect_and_migrate_with_config( database_url: &str, config: PostgresConfig, ) -> Result<Self, Error>
Connect with custom configuration and run migrations.
Sourcepub fn pool_and_config(pool: Arc<PgPool>, config: PostgresConfig) -> Self
pub fn pool_and_config(pool: Arc<PgPool>, config: PostgresConfig) -> Self
Use an existing pool with custom configuration.
Sourcepub async fn verify_schema(&self) -> Result<Vec<SchemaIssue>, Error>
pub async fn verify_schema(&self) -> Result<Vec<SchemaIssue>, Error>
Verify schema integrity.
Sourcepub fn config(&self) -> &PostgresConfig
pub fn config(&self) -> &PostgresConfig
Get the configuration.
Trait Implementations§
Source§impl Persistence for PostgresPersistence
impl Persistence for PostgresPersistence
fn name(&self) -> &str
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 Session,
) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionResult<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = SessionResult<Vec<SessionId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_summary<'life0, 'async_trait>(
&'life0 self,
snapshot: SummarySnapshot,
) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_summaries<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionResult<Vec<SummarySnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn enqueue<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
content: String,
priority: i32,
) -> Pin<Box<dyn Future<Output = SessionResult<QueueItem>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dequeue<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionResult<Option<QueueItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_queued<'life0, 'async_trait>(
&'life0 self,
item_id: Uuid,
) -> Pin<Box<dyn Future<Output = SessionResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pending_queue<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionResult<Vec<QueueItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cleanup_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SessionResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn add_message<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
message: SessionMessage,
) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_message<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
message: SessionMessage,
) -> Pin<Box<dyn Future<Output = SessionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append a message to an existing session. Read more
Auto Trait Implementations§
impl Freeze for PostgresPersistence
impl !RefUnwindSafe for PostgresPersistence
impl Send for PostgresPersistence
impl Sync for PostgresPersistence
impl Unpin for PostgresPersistence
impl !UnwindSafe for PostgresPersistence
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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.