2 个版本
0.1.1 | 2022年1月9日 |
---|---|
0.1.0 | 2021年12月6日 |
#2063 在 数据库接口
24KB
367 行
PostgreSQL 快速池
高性能异步泛型池 PostgreSQL 适配器
使用方法
示例
简单查询
use tokio_postgres::NoTls;
#[tokio::main]
async fn main() {
let config = "postgresql://postgres:postgres@localhost".parse().unwrap();
let pool = qp_postgres::connect(config, NoTls, 8);
let client = pool.acquire().await.unwrap();
let row = client.query_one("SELECT 1", &[]).await.unwrap();
let int: i32 = row.get(0);
dbg!(&int);
}
Web 框架
替代方案
后端 | 适配器 | 版本 |
---|---|---|
tokio-postgres | bb8-postgres | |
tokio-postgres | deadpool-postgres | |
tokio-postgres | mobc-postgres | |
postgres | r2d2-postgres | |
sqlx | - |
性能比较
PostgreSQL 总查询时间基准
更多信息,请参阅 Rust 池基准。
许可协议
Copyright (c) 2022 Seungjae Park
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
PostgreSQL 快速池 采用 MIT 许可协议。
依赖关系
~7–16MB
~232K SLoC