pub async fn load_session(
        &self,
        cookie_value: String,
    ) -> Result<Option<AxumSessionData>, SessionError> {
        if let Some(client) = &self.client {
            let result: Option<(String,)> = sqlx::query_as(
                &databases::LOAD_QUERY.replace("%%TABLE_NAME%%", &self.config.table_name),
            )
            .bind(&cookie_value)
            .bind(Utc::now().timestamp())
            .fetch_optional(client.inner())
            .await?;

            Ok(result
                .map(|(session,)| serde_json::from_str(&session))
                .transpose()?)
        } else {
            Ok(None)
        }
    }
/// loads a session's data from the database using a UUID string.
///
/// If client is None it will return Ok(None).
///
/// # Errors
/// - ['SessionError::Sqlx'] is returned if database connection has failed or user does not have permissions.
/// - ['SessionError::SerdeJson'] is returned if it failed to deserialize the sessions data.
///
/// # Examples
/// ```rust
/// use axum_database_sessions::{AxumSessionConfig, AxumSessionStore};
/// use uuid::Uuid;
///
/// let config = AxumSessionConfig::default();
/// let session_store = AxumSessionStore::new(None, config);
/// let token = Uuid::new_v4();
/// async {
///     let session_data = session_store.load_session(token.to_string()).await.unwrap();
/// };
/// ```
///
loads a session's data from the database using a UUID string.
If client is None it will return Ok(None).
loads a session ' s data from the database using a UUID string . If client is None it will return Ok ( None ) .
pub async fn load_session(
        &self,
        cookie_value: String,
    ) -> Result<Option<AxumSessionData>, SessionError> {
        if let Some(client) = &self.client {
            let result: Option<(String,)> = sqlx::query_as(
                &databases::LOAD_QUERY.replace("%%TABLE_NAME%%", &self.config.table_name),
            )
            .bind(&cookie_value)
            .bind(Utc::now().timestamp())
            .fetch_optional(client.inner())
            .await?;
            Ok(result
                .map(|(session,)| serde_json::from_str(&session))
                .transpose()?)
        } else {
            Ok(None)
        }
    }
pub async fn load_session ( & self , cookie_value : String , ) -> Result < Option < AxumSessionData > , SessionError > { if let Some ( client ) = & self . client { let result : Option < ( String , ) > = sqlx :: query_as ( & databases :: LOAD_QUERY . replace ( " " , & self . config . table_name ) , ) . bind ( & cookie_value ) . bind ( Utc :: now ( ) . timestamp ( ) ) . fetch_optional ( client . inner ( ) ) . await ? ; Ok ( result . map ( | ( session , ) | serde_json :: from_str ( & session ) ) . transpose ( ) ? ) } else { Ok ( None ) } }
loads a session's data from the database using a UUID string.
loads a session ' s data from the database using a UUID string .
&self
cookie_value
String
&self
cookie_value
String
errors
['SessionError::Sqlx'] is returned if database connection has failed or user does not have permissions.
['SessionError::SerdeJson'] is returned if it failed to deserialize the sessions data.
[ ' SessionError :: Sqlx ' ] is returned if database connection has failed or user does not have permissions . [ ' SessionError :: SerdeJson ' ] is returned if it failed to deserialize the sessions data .
examples
```rust
use axum_database_sessions::{AxumSessionConfig, AxumSessionStore};
use uuid::Uuid.

let config = AxumSessionConfig::default();
let session_store = AxumSessionStore::new(None, config);
let token = Uuid::new_v4();
async {
let session_data = session_store.load_session(token.to_string()).await.unwrap();
};
```
` ` ` rust use axum_database_sessions :: { AxumSessionConfig AxumSessionStore } ; use uuid :: Uuid . let config = AxumSessionConfig :: default () ; let session_store = AxumSessionStore :: new ( None config ) ; let token = Uuid :: new_v4 () ; async { let session_data = session_store . load_session ( token . to_string () ) . await . unwrap () ; } ; ` ` `