Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cea4f6a

Browse filesBrowse files
committed
update doc
1 parent a4281a9 commit cea4f6a
Copy full SHA for cea4f6a

File tree

Expand file treeCollapse file tree

3 files changed

+21
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-4
lines changed

‎example/Cargo.toml

Copy file name to clipboardExpand all lines: example/Cargo.toml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ path = "src/mssql.rs"
1515
[[bin]]
1616
name = "mysql"
1717
path = "src/mysql.rs"
18+
[[bin]]
19+
name = "pg"
20+
path = "src/pg.rs"
1821
[dependencies]
1922
rbs = "4.5"
2023
rbdc = {version = "4.5",path = "../"}
2124
rbdc-sqlite = {version = "4.5",path = "../rbdc-sqlite"}
2225
rbdc-mssql = {version = "4.5",path = "../rbdc-mssql"}
2326
rbdc-mysql = {version = "4.5",path = "../rbdc-mysql"}
27+
rbdc-pg = {version = "4.5",path = "../rbdc-pg"}
2428
rbdc-pool-fast = {version = "4.5",path = "../rbdc-pool-fast"}
2529
tokio = { version = "1", features = ["sync", "fs", "net", "rt", "rt-multi-thread", "time", "io-util", "macros"] }
2630

‎example/src/mssql.rs

Copy file name to clipboardExpand all lines: example/src/mssql.rs
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ async fn main(){
99
// let pool = Pool::new_url(MssqlDriver {}, "jdbc:sqlserver://SA:TestPass!123456@localhost:1433;database=test").unwrap();
1010
let pool = FastPool::new(ConnManager::new(MssqlDriver {}, uri).unwrap()).unwrap();
1111
let mut conn = pool.get().await.unwrap();
12-
let data = conn
12+
let v = conn
1313
.get_values("SELECT 1", vec![])
1414
.await
1515
.unwrap();
16-
for x in data {
17-
println!("row: {}", x);
18-
}
16+
println!("{}", rbs::Value::Array(v));
1917
}

‎example/src/pg.rs

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use rbdc::db::{Connection};
2+
use rbdc::Error;
3+
use rbdc::pool::conn_manager::ConnManager;
4+
use rbdc::pool::Pool;
5+
use rbdc_pg::PgDriver;
6+
use rbdc_pool_fast::FastPool;
7+
8+
#[tokio::main]
9+
async fn main() -> Result<(), Error> {
10+
let pool = FastPool::new(ConnManager::new(PgDriver {}, "postgres://postgres:123456@localhost:5432/postgres")?)?;
11+
let mut conn = pool.get().await?;
12+
let v = conn.get_values("select * from user", vec![]).await?;
13+
println!("{}", rbs::Value::Array(v));
14+
Ok(())
15+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.