diff --git a/core/src/services/sqlite/docs.md b/core/src/services/sqlite/docs.md index 4032ba290288..ac349ace8c19 100644 --- a/core/src/services/sqlite/docs.md +++ b/core/src/services/sqlite/docs.md @@ -17,7 +17,7 @@ This service can be used to: ## Configuration - `root`: Set the working directory of `OpenDAL` -- `connection_string`: Set the connection string of postgres server +- `connection_string`: Set the connection string of sqlite database - `table`: Set the table of sqlite - `key_field`: Set the key field of sqlite - `value_field`: Set the value field of sqlite diff --git a/website/docs/services/mysql.mdx b/website/docs/services/mysql.mdx new file mode 100644 index 000000000000..a6fb7bc5bbdc --- /dev/null +++ b/website/docs/services/mysql.mdx @@ -0,0 +1,69 @@ +--- +title: MySQL +--- + +[MySQL](https://www.mysql.com/) services support. + +import Docs from '../../../core/src/services/mysql/docs.md' + + + +### Via Config + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```rust +use anyhow::Result; +use opendal::services::Mysql; +use opendal::Operator; + +#[tokio::main] +async fn main() -> Result<()> { + + let mut map = HashMap::new(); + map.insert("connection_string".to_string(), "mysql://you_username:your_password@127.0.0.1:5432/your_database".to_string()); + map.insert("table".to_string(), "your_table".to_string()); + map.insert("key_field".to_string(), "your_key_field".to_string()); + map.insert("value_field".to_string(), "your_value_field".to_string()); + + let op: Operator = Operator::via_map(Scheme::Mysql, map)?; + Ok(()) +} +``` + + + + +```javascript +import { Operator } from require('opendal'); + +async function main() { + const op = new Operator("mysql", { + connection_string: 'mysql://you_username:your_password@127.0.0.1:5432/your_database', + table: 'your_table', + key_field: 'your_key_field', + value_field: 'your_value_field', + }); +} +``` + + + + +```python +import opendal + +op = opendal.Operator("mysql", { + "connection_string": "mysql://you_username:your_password@127.0.0.1:5432/your_database", + "table": "your_table", + "key_field": "your_key_field", + "value_field": "your_value_field", +}) +``` + + + \ No newline at end of file diff --git a/website/docs/services/postgresql.mdx b/website/docs/services/postgresql.mdx new file mode 100644 index 000000000000..3f9605f50af2 --- /dev/null +++ b/website/docs/services/postgresql.mdx @@ -0,0 +1,69 @@ +--- +title: PostgreSQL +--- + +[PostgreSQL](https://www.postgresql.org/) services support. + +import Docs from '../../../core/src/services/postgresql/docs.md' + + + +### Via Config + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```rust +use anyhow::Result; +use opendal::services::Postgresql; +use opendal::Operator; + +#[tokio::main] +async fn main() -> Result<()> { + + let mut map = HashMap::new(); + map.insert("connection_string".to_string(), "postgresql://you_username:your_password@127.0.0.1:5432/your_database".to_string()); + map.insert("table".to_string(), "your_table".to_string()); + map.insert("key_field".to_string(), "your_key_field".to_string()); + map.insert("value_field".to_string(), "your_value_field".to_string()); + + let op: Operator = Operator::via_map(Scheme::Postgresql, map)?; + Ok(()) +} +``` + + + + +```javascript +import { Operator } from require('opendal'); + +async function main() { + const op = new Operator("postgresql", { + connection_string: 'postgresql://you_username:your_password@127.0.0.1:5432/your_database', + table: 'your_table', + key_field: 'your_key_field', + value_field: 'your_value_field', + }); +} +``` + + + + +```python +import opendal + +op = opendal.Operator("postgresql", { + "connection_string": "postgresql://you_username:your_password@127.0.0.1:5432/your_database", + "table": "your_table", + "key_field": "your_key_field", + "value_field": "your_value_field", +}) +``` + + + \ No newline at end of file diff --git a/website/docs/services/sqlite.mdx b/website/docs/services/sqlite.mdx new file mode 100644 index 000000000000..dc8801d9e32c --- /dev/null +++ b/website/docs/services/sqlite.mdx @@ -0,0 +1,69 @@ +--- +title: Sqlite +--- + +[Sqlite](https://www.sqlite.org/) services support. + +import Docs from '../../../core/src/services/sqlite/docs.md' + + + +### Via Config + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + + + +```rust +use anyhow::Result; +use opendal::services::Sqlite; +use opendal::Operator; + +#[tokio::main] +async fn main() -> Result<()> { + + let mut map = HashMap::new(); + map.insert("connection_string".to_string(), "file//abc.db".to_string()); + map.insert("table".to_string(), "your_table".to_string()); + map.insert("key_field".to_string(), "your_key_field".to_string()); + map.insert("value_field".to_string(), "your_value_field".to_string()); + + let op: Operator = Operator::via_map(Scheme::Sqlite, map)?; + Ok(()) +} +``` + + + + +```javascript +import { Operator } from require('opendal'); + +async function main() { + const op = new Operator("sqlite", { + connection_string: 'file//abc.db', + table: 'your_table', + key_field: 'your_key_field', + value_field: 'your_value_field', + }); +} +``` + + + + +```python +import opendal + +op = opendal.Operator("sqlite", { + "connection_string": "file//abc.db", + "table": "your_table", + "key_field": "your_key_field", + "value_field": "your_value_field", +}) +``` + + + \ No newline at end of file