wip(mysql): connect phase

This commit is contained in:
Ryan Leckey
2021-01-02 10:47:15 -08:00
parent 2195472e3e
commit 7750168b80
7 changed files with 158 additions and 50 deletions

View File

@@ -14,3 +14,5 @@ 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"] }
log = "0.4"
env_logger = "0.8.2"

View File

@@ -1,35 +1,9 @@
// #[async_std::main]
// async fn main() -> anyhow::Result<()> {
// let _stream = AsyncStd::connect_tcp("localhost", 5432).await?;
//
// Ok(())
// }
use sqlx::mysql::MySqlConnectOptions;
use sqlx::mysql::MySqlConnection;
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?;
let _conn = <MySqlConnection>::connect("mysql://root:password@localhost:3307/main").await?;
Ok(())
}