-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add docs on website for libsql services (#3299)
Signed-off-by: Manjusaka <[email protected]>
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |