[][src]Struct actix_web_sql_identity::SqlIdentityBuilder

pub struct SqlIdentityBuilder { /* fields omitted */ }

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]

Change how many SQL connections are in each pool

Arguments

  • count - Number of connections per pool

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_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T

impl<T> IntoSql for T[src]

fn into_sql<T>(self) -> Self::Expression where
    Self: AsExpression<T>, 
[src]

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]

Convert &self to an expression for Diesel's query builder. Read more