This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 14a62e043 docs: Add docs in website for sqlite/mysql/postgresql
services (#3290)
14a62e043 is described below
commit 14a62e0435c4f0b83b5b4bc2145e7da97befbd50
Author: Nadeshiko Manju <[email protected]>
AuthorDate: Mon Oct 16 11:13:07 2023 +0800
docs: Add docs in website for sqlite/mysql/postgresql services (#3290)
Signed-off-by: Manjusaka <[email protected]>
---
core/src/services/sqlite/docs.md | 2 +-
website/docs/services/mysql.mdx | 69 ++++++++++++++++++++++++++++++++++++
website/docs/services/postgresql.mdx | 69 ++++++++++++++++++++++++++++++++++++
website/docs/services/sqlite.mdx | 69 ++++++++++++++++++++++++++++++++++++
4 files changed, 208 insertions(+), 1 deletion(-)
diff --git a/core/src/services/sqlite/docs.md b/core/src/services/sqlite/docs.md
index 4032ba290..ac349ace8 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 000000000..a6fb7bc5b
--- /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'
+
+<Docs components={props.components} />
+
+### Via Config
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+ <TabItem value="rust" label="Rust" default>
+
+```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:[email protected]: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(())
+}
+```
+
+ </TabItem>
+ <TabItem value="node.js" label="Node.js">
+
+```javascript
+import { Operator } from require('opendal');
+
+async function main() {
+ const op = new Operator("mysql", {
+ connection_string:
'mysql://you_username:[email protected]:5432/your_database',
+ table: 'your_table',
+ key_field: 'your_key_field',
+ value_field: 'your_value_field',
+ });
+}
+```
+
+ </TabItem>
+ <TabItem value="python" label="Python">
+
+```python
+import opendal
+
+op = opendal.Operator("mysql", {
+ "connection_string":
"mysql://you_username:[email protected]:5432/your_database",
+ "table": "your_table",
+ "key_field": "your_key_field",
+ "value_field": "your_value_field",
+})
+```
+
+ </TabItem>
+</Tabs>
\ 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 000000000..3f9605f50
--- /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'
+
+<Docs components={props.components} />
+
+### Via Config
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+ <TabItem value="rust" label="Rust" default>
+
+```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:[email protected]: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(())
+}
+```
+
+ </TabItem>
+ <TabItem value="node.js" label="Node.js">
+
+```javascript
+import { Operator } from require('opendal');
+
+async function main() {
+ const op = new Operator("postgresql", {
+ connection_string:
'postgresql://you_username:[email protected]:5432/your_database',
+ table: 'your_table',
+ key_field: 'your_key_field',
+ value_field: 'your_value_field',
+ });
+}
+```
+
+ </TabItem>
+ <TabItem value="python" label="Python">
+
+```python
+import opendal
+
+op = opendal.Operator("postgresql", {
+ "connection_string":
"postgresql://you_username:[email protected]:5432/your_database",
+ "table": "your_table",
+ "key_field": "your_key_field",
+ "value_field": "your_value_field",
+})
+```
+
+ </TabItem>
+</Tabs>
\ 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 000000000..dc8801d9e
--- /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'
+
+<Docs components={props.components} />
+
+### Via Config
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+ <TabItem value="rust" label="Rust" default>
+
+```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(())
+}
+```
+
+ </TabItem>
+ <TabItem value="node.js" label="Node.js">
+
+```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',
+ });
+}
+```
+
+ </TabItem>
+ <TabItem value="python" label="Python">
+
+```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",
+})
+```
+
+ </TabItem>
+</Tabs>
\ No newline at end of file