dimfeld / ergo

Low-code task engine built with Rust and Svelte
Other
141 stars 12 forks source link

Clean up ergonomics of getting a connection from the pool #1

Closed dimfeld closed 3 years ago

dimfeld commented 3 years ago

Right now you have to do &mut state.pg.acquire().await.unwrap().conn. By implementing the Executor trait from sqlx this can just be &state.pg.

dimfeld commented 3 years ago

Implemented using a macro for now due to lifetime issues on Pool Executor. Could be better but I'll come back to this again in the future.