Skip to content

Commit c248425

Browse files
authored
Merge branch 'master' into ndyakov/token-based-auth
2 parents fa59cce + 53daf77 commit c248425

File tree

17 files changed

+389
-18
lines changed

17 files changed

+389
-18
lines changed

.github/wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Lua
2929
MSSQL
3030
namespace
3131
NoSQL
32+
OpenTelemetry
3233
ORM
3334
Packagist
3435
PhpRedis

README.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,24 @@ func ExampleClient() *redis.Client {
167167

168168
```
169169

170+
### Instrument with OpenTelemetry
171+
172+
```go
173+
import (
174+
"github.com/redis/go-redis/v9"
175+
"github.com/redis/go-redis/extra/redisotel/v9"
176+
"errors"
177+
)
178+
179+
func main() {
180+
...
181+
rdb := redis.NewClient(&redis.Options{...})
182+
183+
if err := errors.Join(redisotel.InstrumentTracing(rdb), redisotel.InstrumentMetrics(rdb)); err != nil {
184+
log.Fatal(err)
185+
}
186+
```
187+
170188
171189
### Advanced Configuration
172190
@@ -215,9 +233,26 @@ val1 := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{})
215233
216234
In the Redis-Search module, **the default dialect is 2**. If needed, you can explicitly specify a different dialect using the appropriate configuration in your queries.
217235
218-
## Contributing
236+
**Important**: Be aware that the query dialect may impact the results returned. If needed, you can revert to a different dialect version by passing the desired dialect in the arguments of the command you want to execute.
237+
For example:
238+
```
239+
res2, err := rdb.FTSearchWithArgs(ctx,
240+
"idx:bicycle",
241+
"@pickup_zone:[CONTAINS $bike]",
242+
&redis.FTSearchOptions{
243+
Params: map[string]interface{}{
244+
"bike": "POINT(-0.1278 51.5074)",
245+
},
246+
DialectVersion: 3,
247+
},
248+
).Result()
249+
```
250+
You can find further details in the [query dialect documentation](https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/).
219251
220-
Please see [out contributing guidelines](CONTRIBUTING.md) to help us improve this library!
252+
## Contributing
253+
We welcome contributions to the go-redis library! If you have a bug fix, feature request, or improvement, please open an issue or pull request on GitHub.
254+
We appreciate your help in making go-redis better for everyone.
255+
If you are interested in contributing to the go-redis library, please check out our [contributing guidelines](CONTRIBUTING.md) for more information on how to get started.
221256
222257
## Look and feel
223258

commands.go

+6
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@ func (c cmdable) Ping(ctx context.Context) *StatusCmd {
422422
return cmd
423423
}
424424

425+
func (c cmdable) Do(ctx context.Context, args ...interface{}) *Cmd {
426+
cmd := NewCmd(ctx, args...)
427+
_ = c(ctx, cmd)
428+
return cmd
429+
}
430+
425431
func (c cmdable) Quit(_ context.Context) *StatusCmd {
426432
panic("not implemented")
427433
}

commands_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ var _ = Describe("Commands", func() {
8484
Expect(ping.Val()).To(Equal("PONG"))
8585
})
8686

87+
It("should Ping with Do method", func() {
88+
result := client.Conn().Do(ctx, "PING")
89+
Expect(result.Err()).NotTo(HaveOccurred())
90+
Expect(result.Val()).To(Equal("PONG"))
91+
})
92+
8793
It("should Wait", func() {
8894
const wait = 3 * time.Second
8995

0 commit comments

Comments
 (0)