Skip to content

Commit abc9502

Browse files
authored
Docs Cloud Section Styling Batch #6 (#315)
* fix: update data store example code - go * fix: update data store example code - py * fix: update data store example code - js
1 parent fe24ac1 commit abc9502

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

docs/cloud/datastores.md

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,11 @@ $> redis-cli -u <CONNECTION_URI> PING
173173
- Use the following code snippet to connect to the data store:
174174

175175
```javascript
176-
const Client = require("ioredis");
176+
const Redis = require("ioredis");
177177

178-
// Using connection URI directly.
179-
const client = new Client("<CONNECTION_URI>");
180-
181-
// Using connection options.
182-
const client2 = new Client({
183-
port: 6385,
184-
host: "abcde.dragonflydb.cloud",
185-
username: "default",
186-
password: "XXXXX",
187-
db: 0,
188-
});
189-
190-
client.ping();
178+
// Replace <CONNECTION_URI> with the actual Dragonfly Cloud connection URI.
179+
const client = new Redis("<CONNECTION_URI>");
180+
client.ping().then(resp => console.log(resp));
191181
```
192182

193183
### Python
@@ -198,7 +188,8 @@ client.ping();
198188
```python
199189
import redis
200190

201-
client = redis.Redis.from_url('<CONNECTION_URI>')
191+
# Replace <CONNECTION_URI> with the actual Dragonfly Cloud connection URI.
192+
client = redis.Redis.from_url("<CONNECTION_URI>")
202193
client.ping()
203194
```
204195

@@ -211,22 +202,23 @@ client.ping()
211202
package main
212203

213204
import (
205+
"context"
214206
"fmt"
215207

216-
"github.com/go-redis/redis/v8"
208+
"github.com/redis/go-redis/v9"
217209
)
218210

219211
func main() {
220-
// Replace "<CONNECTION_URI>" with the actual connection URI.
221-
// Note that <db> is the database number and its default value is 0.
212+
// Replace <CONNECTION_URI> with the actual Dragonfly Cloud connection URI.
213+
// Note that <db> is the database number, and its default value is 0.
222214
opts, err := redis.ParseURL("<CONNECTION_URI>/<db>")
223215
if err != nil {
224216
panic(err)
225217
}
226218

227219
client := redis.NewClient(opts)
228220

229-
pong, err := client.Ping(client.Context()).Result()
221+
pong, err := client.Ping(context.Background()).Result()
230222
if err != nil {
231223
fmt.Println(err)
232224
}

0 commit comments

Comments
 (0)