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§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for SqlIdentityBuilder
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
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