Struct actix_web_sql_identity::SqlIdentityBuilder[][src]

pub struct SqlIdentityBuilder { /* fields omitted */ }

Methods

impl 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
));

Change the response header when an identity is remembered

Arguments

  • hdr - Response header name to use

Change how many SQL connections are in each pool

Arguments

  • count - Number of connections per pool

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.

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

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

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for SqlIdentityBuilder

impl Sync for SqlIdentityBuilder