pub struct SqlIdentityBuilder { /* private fields */ }
Implementations§
source§impl SqlIdentityBuilder
impl SqlIdentityBuilder
sourcepub fn new<T: Into<String>>(uri: T) -> SqlIdentityBuilder
pub fn new<T: Into<String>>(uri: T) -> SqlIdentityBuilder
Creates a new SqlIdentityBuilder that constructs a SqlIdentityPolicy
Arguments
uri
- Database connection string
Example
use actix_web::App;
use actix_web::middleware::identity::IdentityService;
use actix_web_sql_identity::SqlIdentityBuilder;
// Create the identity policy
let policy = SqlIdentityBuilder::new("postgres://user:pass@host/database")
.pool_size(5)
.response_header("X-MY-RESPONSE")
.finish()
.expect("failed to open database");
let app = App::new().middleware(IdentityService::new(
policy
));
sourcepub fn response_header(self, hdr: &'static str) -> SqlIdentityBuilder
pub fn response_header(self, hdr: &'static str) -> SqlIdentityBuilder
Change the response header when an identity is remembered
Arguments
hdr
- Response header name to use
sourcepub fn pool_size(self, count: usize) -> SqlIdentityBuilder
pub fn pool_size(self, count: usize) -> SqlIdentityBuilder
sourcepub fn finish(self) -> Result<SqlIdentityPolicy, Error>
pub fn finish(self) -> Result<SqlIdentityPolicy, Error>
Finish building this SQL identity policy. This will attempt to construct the a pool of connections to the database specified. The type of database is determined by the uri set. On success, a new SqlIdentityPolicy is returned, on failure an error is returned.
sourcepub fn sqlite(self) -> SqlIdentityBuilder
pub fn sqlite(self) -> SqlIdentityBuilder
Forces a SQLite identity policy to be created. This function does
not normally need to be used, new
will automatically determine
the appropriate variant by parsing the connection string. This function
exists if the parsing fails
sourcepub fn mysql(self) -> SqlIdentityBuilder
pub fn mysql(self) -> SqlIdentityBuilder
Forces a MySQL identity policy to be created. This function does
not normally need to be used, new
will automatically determine
the appropriate variant by parsing the connection string. This function
exists if the parsing fails
sourcepub fn postgresql(self) -> SqlIdentityBuilder
pub fn postgresql(self) -> SqlIdentityBuilder
Forces a PostgreSQL identity policy to be created. This function does
not normally need to be used, new
will automatically determine
the appropriate variant by parsing the connection string. This function
exists if the parsing fails
Trait Implementations§
source§impl Clone for SqlIdentityBuilder
impl Clone for SqlIdentityBuilder
source§fn clone(&self) -> SqlIdentityBuilder
fn clone(&self) -> SqlIdentityBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for SqlIdentityBuilder
impl Send for SqlIdentityBuilder
impl Sync for SqlIdentityBuilder
impl Unpin for SqlIdentityBuilder
impl UnwindSafe for SqlIdentityBuilder
Blanket Implementations§
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
&self
to an expression for Diesel’s query builder. Read more