You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
script := redis.NewScript("
local k = redis.call("GET", "key")
if (k != 0) {
return {k, nil}
}
local msgs = redis.call("XREADGROUP", "GROUP", "cname", "cname", "COUNT", 10, "STREAMS", "mystream", ">")
return {k, msgs}
")
res, err := script.Run(ctx, rdb, []string{}, nil).Result()
`
what i can get is only a slice. Can we reuse existing types of parsers, such as XMessageSliceCmd parsers, to provide users with a custom type similar to XMessageSliceCmd, and then support the Eval function's buffer. Reader for parsing.
such as
`
type MyLuaScriptResult struct {
retcode int
Messages []XStream
}
type MyLuaScriptResultCmd struct {
baseCmd
val MyLuaScriptResult
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
let’s say
`
script := redis.NewScript("
local k = redis.call("GET", "key")
if (k != 0) {
return {k, nil}
}
local msgs = redis.call("XREADGROUP", "GROUP", "cname", "cname", "COUNT", 10, "STREAMS", "mystream", ">")
return {k, msgs}
")
res, err := script.Run(ctx, rdb, []string{}, nil).Result()
`
what i can get is only a slice. Can we reuse existing types of parsers, such as XMessageSliceCmd parsers, to provide users with a custom type similar to XMessageSliceCmd, and then support the Eval function's buffer. Reader for parsing.
such as
`
type MyLuaScriptResult struct {
retcode int
Messages []XStream
}
type MyLuaScriptResultCmd struct {
baseCmd
val MyLuaScriptResult
}
`
Beta Was this translation helpful? Give feedback.
All reactions