Skip to content

Commit

Permalink
docs: Add docs on website for libsql services (#3299)
Browse files Browse the repository at this point in the history
Signed-off-by: Manjusaka <[email protected]>
  • Loading branch information
Zheaoli authored Oct 16, 2023
1 parent 4c1ae90 commit 84d9bf7
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions website/docs/services/libsql.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: LibSQL
---

[libSQL](https://github.com/tursodatabase/libsql) service support.

import Docs from '../../../core/src/services/libsql/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::Operator;
use opendal::Scheme;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<()> {
let mut map = HashMap::new();
map.insert("root".to_string(), "/".to_string());
map.insert("connection_string".to_string(), "https://example.com/db".to_string());
map.insert("auth_token".to_string(), "secret".to_string());
map.insert("table".to_string(), "your_table".to_string());
map.insert("key_field".to_string(), "key".to_string());
map.insert("value_field".to_string(), "value".to_string());

let op: Operator = Operator::via_map(Scheme::Libsql, map)?;
Ok(())
}
```

</TabItem>
<TabItem value="node.js" label="Node.js">

```javascript
import { Operator } from "opendal";

async function main() {
const op = new Operator("libsql", {
root: "/",
connection_string: "https://example.com/db",
auth_token: "secret",
table: "your_table",
key_field: "key",
value_field: "value",
});
}
```

</TabItem>
<TabItem value="python" label="Python">

```python
import opendal

op = opendal.Operator("libsql",
root="/",
connection_string="https://example.com/db",
auth_token="secret",
table="your_table",
key_field="key",
value_field="value"
)
```

</TabItem>
</Tabs>

0 comments on commit 84d9bf7

Please sign in to comment.