pub async fn count(&self) -> Result<i64, SessionError> {
        if let Some(client) = &self.client {
            let (count,) = sqlx::query_as(
                &databases::COUNT_QUERY.replace("%%TABLE_NAME%%", &self.config.table_name),
            )
            .fetch_one(client.inner())
            .await?;

            return Ok(count);
        }

        Ok(0)
    }
/// Returns count of existing sessions within database.
///
/// If client is None it will return Ok(0).
///
/// # Errors
/// - ['SessionError::Sqlx'] is returned if database connection has failed or user does not have permissions.
///
/// # Examples
/// ```rust
/// use axum_database_sessions::{AxumSessionConfig, AxumSessionStore};
///
/// let config = AxumSessionConfig::default();
/// let session_store = AxumSessionStore::new(None, config);
/// async {
///     let count = session_store.count().await.unwrap();
/// };
/// ```
///
Returns count of existing sessions within database.
If client is None it will return Ok(0).
Returns count of existing sessions within database . If client is None it will return Ok ( 0 ) .
pub async fn count(&self) -> Result<i64, SessionError> {
        if let Some(client) = &self.client {
            let (count,) = sqlx::query_as(
                &databases::COUNT_QUERY.replace("%%TABLE_NAME%%", &self.config.table_name),
            )
            .fetch_one(client.inner())
            .await?;
            return Ok(count);
        }
        Ok(0)
    }
pub async fn count ( & self ) -> Result < i64 , SessionError > { if let Some ( client ) = & self . client { let ( count , ) = sqlx :: query_as ( & databases :: COUNT_QUERY . replace ( " " , & self . config . table_name ) , ) . fetch_one ( client . inner ( ) ) . await ? ; return Ok ( count ) ; } Ok ( 0 ) }
Returns count of existing sessions within database.
Returns count of existing sessions within database .
&self
&self
errors
['SessionError::Sqlx'] is returned if database connection has failed or user does not have permissions.
[ ' SessionError :: Sqlx ' ] is returned if database connection has failed or user does not have permissions .
examples
```rust
use axum_database_sessions::{AxumSessionConfig, AxumSessionStore}.

let config = AxumSessionConfig::default();
let session_store = AxumSessionStore::new(None, config);
async {
let count = session_store.count().await.unwrap();
};
```
` ` ` rust use axum_database_sessions :: { AxumSessionConfig AxumSessionStore } . let config = AxumSessionConfig :: default () ; let session_store = AxumSessionStore :: new ( None config ) ; async { let count = session_store . count () . await . unwrap () ; } ; ` ` `