This service can be used to:
- create_dir
- stat
- read
- write
- delete
- list
- copy
- rename
-
presign
root: Set the working directory ofOpenDALconnection_string: Set the connection string of mysql servertable: Set the table of mysqlkey_field: Set the key field of mysqlvalue_field: Set the value field of mysql
use anyhow::Result;
use opendal_service_mysql::Mysql;
use opendal_core::Operator;
#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Mysql::default()
.root("/")
.connection_string("mysql://you_username:your_password@127.0.0.1:5432/your_database")
.table("your_table")
// key field type in the table should be compatible with Rust's &str like text
.key_field("key")
// value field type in the table should be compatible with Rust's Vec<u8> like bytea
.value_field("value");
let op = Operator::new(builder)?.finish();
Ok(())
}