[−][src]Struct actix_web_sql_identity::SqlIdentityBuilder
Methods
impl SqlIdentityBuilder[src]
pub fn new<T: Into<String>>(uri: T) -> SqlIdentityBuilder[src]
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 ));
pub fn response_header(self, hdr: &'static str) -> SqlIdentityBuilder[src]
Change the response header when an identity is remembered
Arguments
hdr- Response header name to use
pub fn pool_size(self, count: usize) -> SqlIdentityBuilder[src]
pub fn finish(self) -> Result<SqlIdentityPolicy, Error>[src]
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.
pub fn sqlite(self) -> SqlIdentityBuilder[src]
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
pub fn mysql(self) -> SqlIdentityBuilder[src]
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
pub fn postgresql(self) -> SqlIdentityBuilder[src]
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
impl Clone for SqlIdentityBuilder[src]
fn clone(&self) -> SqlIdentityBuilder[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl Send for SqlIdentityBuilder
impl Sync for SqlIdentityBuilder
Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
impl<T> From for T[src]
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Erased for T
impl<T> IntoSql for T[src]
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>, [src]
Self: AsExpression<T>,
Convert self to an expression for Diesel's query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>, [src]
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel's query builder. Read more