Struct iron_postgres_middleware::PostgresMiddleware [] [src]

pub struct PostgresMiddleware {
    pub pool: Arc<Pool<PostgresConnectionManager>>,
}

Iron middleware that allows for postgres connections within requests.

Fields

pool

A pool of postgres connections that are shared between requests.

Methods

impl PostgresMiddleware

fn new(pg_connection_str: &str) -> Result<PostgresMiddleware, Box<Error>>

Creates a new pooled connection to the given postgresql server. The URL is in the format:

postgresql://user[:password]@host[:port][/database][?param1=val1[[&param2=val2]...]]

Returns Err(err) if there are any errors connecting to the postgresql database.

Trait Implementations

impl Key for PostgresMiddleware

type Value = Value

impl BeforeMiddleware for PostgresMiddleware

fn before(&self, req: &mut Request) -> IronResult<()>

fn catch(&self, _: &mut Request, err: IronError) -> IronResult<()>