Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekshenawa committed Aug 16, 2023
1 parent 4274e2a commit e76c225
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ uri
URI
url
variadic
RedisStack
RedisStack
RedisGears
14 changes: 7 additions & 7 deletions redis_gears.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ func (c cmdable) TFunctionListArgs(ctx context.Context, options *TFunctionListOp
// TFCall - invoke a function.
// For more information - https://redis.io/commands/tfcall/
func (c cmdable) TFCall(ctx context.Context, libName string, funcName string, numKeys int) *Cmd {
lf := fmt.Sprintf("%s.%s", libName, funcName)
lf := libName + "." + funcName
args := []interface{}{"TFCALL", lf, numKeys}
cmd := NewCmd(ctx, args...)
_ = c(ctx, cmd)
c(ctx, cmd)

Check failure on line 103 in redis_gears.go

View workflow job for this annotation

GitHub Actions / lint

Error return value is not checked (errcheck)
return cmd
}

func (c cmdable) TFCallArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd {
lf := fmt.Sprintf("%s.%s", libName, funcName)
lf := libName + "." + funcName
args := []interface{}{"TFCALL", lf, numKeys}
if options != nil {
if options.Keys != nil {
Expand All @@ -126,17 +126,17 @@ func (c cmdable) TFCallArgs(ctx context.Context, libName string, funcName string
return cmd
}

// TFCallASync - invoke an asynchronous JavaScript function (coroutine).
// For more information - https://redis.io/commands/tfcallasync/
func (c cmdable) TFCallASync(ctx context.Context, libName string, funcName string, numKeys int) *Cmd {
// TFCallASYNC - invoke an asynchronous JavaScript function (coroutine).
// For more information - https://redis.io/commands/TFCallASYNC/
func (c cmdable) TFCallASYNC(ctx context.Context, libName string, funcName string, numKeys int) *Cmd {
lf := fmt.Sprintf("%s.%s", libName, funcName)
args := []interface{}{"TFCALLASYNC", lf, numKeys}
cmd := NewCmd(ctx, args...)
_ = c(ctx, cmd)
return cmd
}

func (c cmdable) TFCallASyncArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd {
func (c cmdable) TFCallASYNCArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd {
lf := fmt.Sprintf("%s.%s", libName, funcName)
args := []interface{}{"TFCALLASYNC", lf, numKeys}
if options != nil {
Expand Down
10 changes: 5 additions & 5 deletions redis_gears_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func libCodeWithConfig(libName string) string {
return fmt.Sprintf(lib, libName)
}

var _ = Describe("Redis Gears commands", Label("gears"), func() {
var _ = Describe("RedisGears commands", Label("gears"), func() {
ctx := context.TODO()
var client *redis.Client

Expand Down Expand Up @@ -109,26 +109,26 @@ var _ = Describe("Redis Gears commands", Label("gears"), func() {
Expect(resultAdd).To(BeEquivalentTo("OK"))
})

It("should TFCallASync", Label("gears", "tfcallasync"), func() {
It("should TFCallASYNC", Label("gears", "TFCallASYNC"), func() {
var resultAdd interface{}
resultAdd, err := client.TFunctionLoad(ctx, libCode("libtfc1")).Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultAdd).To(BeEquivalentTo("OK"))
resultAdd, err = client.TFCallASync(ctx, "libtfc1", "foo", 0).Result()
resultAdd, err = client.TFCallASYNC(ctx, "libtfc1", "foo", 0).Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultAdd).To(BeEquivalentTo("bar"))
resultAdd, err = client.TFunctionDelete(ctx, "libtfc1").Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultAdd).To(BeEquivalentTo("OK"))
})

It("should TFCallASyncArgs", Label("gears", "tfcallasyncargs"), func() {
It("should TFCallASYNCArgs", Label("gears", "TFCallASYNCargs"), func() {
var resultAdd interface{}
resultAdd, err := client.TFunctionLoad(ctx, libCode("libtfca1")).Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultAdd).To(BeEquivalentTo("OK"))
opt := &redis.TFCallOptions{Arguments: []string{"foo", "bar"}}
resultAdd, err = client.TFCallASyncArgs(ctx, "libtfca1", "foo", 0, opt).Result()
resultAdd, err = client.TFCallASYNCArgs(ctx, "libtfca1", "foo", 0, opt).Result()
Expect(err).NotTo(HaveOccurred())
Expect(resultAdd).To(BeEquivalentTo("bar"))
resultAdd, err = client.TFunctionDelete(ctx, "libtfca1").Result()
Expand Down

0 comments on commit e76c225

Please sign in to comment.