mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-10 04:05:49 +00:00
wip(mysql): connection/establish, WriteExt, BufExt, and settle on AsyncRuntime
This commit is contained in:
2188
examples/quickstart/Cargo.lock
generated
Normal file
2188
examples/quickstart/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
examples/quickstart/Cargo.toml
Normal file
16
examples/quickstart/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "sqlx-example-quickstart"
|
||||
version = "0.0.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2018"
|
||||
authors = [
|
||||
"LaunchBadge <contact@launchbadge.com>"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
actix-web = "3.3.2"
|
||||
anyhow = "1.0.36"
|
||||
async-std = { version = "1.8.0", features = ["attributes"] }
|
||||
#sqlx = { path = "../../sqlx", features = ["tokio", "mysql", "blocking", "async-std", "actix"] }
|
||||
sqlx = { path = "../../sqlx", features = ["tokio", "mysql"] }
|
||||
tokio = { version = "1.0.1", features = ["rt", "rt-multi-thread", "macros"] }
|
||||
35
examples/quickstart/src/main.rs
Normal file
35
examples/quickstart/src/main.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
// #[async_std::main]
|
||||
// async fn main() -> anyhow::Result<()> {
|
||||
// let _stream = AsyncStd::connect_tcp("localhost", 5432).await?;
|
||||
//
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
use sqlx::mysql::MySqlConnectOptions;
|
||||
use sqlx::prelude::*;
|
||||
|
||||
// #[tokio::main]
|
||||
// async fn main() -> anyhow::Result<()> {
|
||||
// let mut conn = <MySqlConnection>::connect("mysql://").await?;
|
||||
//
|
||||
// Ok(())
|
||||
// }
|
||||
//
|
||||
|
||||
// #[async_std::main]
|
||||
// async fn main() -> anyhow::Result<()> {
|
||||
// let mut conn = <MySqlConnection>::builder()
|
||||
// .host("loca%x91lhost")
|
||||
// .port(20)
|
||||
// .connect()
|
||||
// .await?;
|
||||
//
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let mut conn = <MySqlConnectOptions>::new().host("localhost").port(3306).connect().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user