Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FunctionStats to rueidiscompat #751

Open
rueian opened this issue Feb 11, 2025 · 2 comments
Open

Add FunctionStats to rueidiscompat #751

rueian opened this issue Feb 11, 2025 · 2 comments
Labels
feature good first issue Good for newcomers

Comments

@rueian
Copy link
Collaborator

rueian commented Feb 11, 2025

The rueidiscompat sub-module aims to provide the same interface as go-redis as closely as possible while utilizing rueidis under the hood.

go-redis has the following interface:

https://github.com/redis/go-redis/blob/40e049e67a4cce574f7972b53b1a8172bbe45d5e/scripting_commands.go#L24
type ScriptingFunctionsCmdable interface {
	...
	FunctionStats(ctx context.Context) *FunctionStatsCmd
	...
}

while in rueidiscompat, it is currently not implemented:

// TODO FunctionStats(ctx context.Context) *FunctionStatsCmd

Therefore, we should catch up go-redis by implementing the function to the rueidiscompat.Compat and the rueidiscompat.Pipeline struct.

Take the below ACLDryRun as an example to implement the new function in rueidiscompat that provides the same interface as go-redis:

func (c *Compat) ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd {
cmd := c.client.B().AclDryrun().Username(username).Command(command[0].(string)).Arg(argsToSlice(command[1:])...).Build()
resp := c.client.Do(ctx, cmd)
return newStringCmd(resp)
}

func (c *Pipeline) ACLDryRun(ctx context.Context, username string, command ...any) *StringCmd {
ret := c.comp.ACLDryRun(ctx, username, command...)
c.rets = append(c.rets, ret)
return ret
}

@rueian rueian added feature good first issue Good for newcomers labels Feb 11, 2025
@Yusin0903
Copy link

Can I try this ?

@rueian
Copy link
Collaborator Author

rueian commented Feb 12, 2025

Hi @Yusin0903, thank you! Let me know if you have any problems during the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants