mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
chore: reorder Eval/EvalCtx after Do/DoCtx in redis.go for consistent method ordering (#5502)
This commit is contained in:
@@ -406,22 +406,6 @@ func (s *Redis) DelCtx(ctx context.Context, keys ...string) (int, error) {
|
|||||||
return int(v), nil
|
return int(v), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eval is the implementation of redis eval command.
|
|
||||||
func (s *Redis) Eval(script string, keys []string, args ...any) (any, error) {
|
|
||||||
return s.EvalCtx(context.Background(), script, keys, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// EvalCtx is the implementation of redis eval command.
|
|
||||||
func (s *Redis) EvalCtx(ctx context.Context, script string, keys []string,
|
|
||||||
args ...any) (any, error) {
|
|
||||||
conn, err := getRedis(s)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return conn.Eval(ctx, script, keys, args...).Result()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do executes a generic redis command with given arguments.
|
// Do executes a generic redis command with given arguments.
|
||||||
func (s *Redis) Do(args ...any) (any, error) {
|
func (s *Redis) Do(args ...any) (any, error) {
|
||||||
return s.DoCtx(context.Background(), args...)
|
return s.DoCtx(context.Background(), args...)
|
||||||
@@ -441,6 +425,22 @@ func (s *Redis) DoCtx(ctx context.Context, args ...any) (any, error) {
|
|||||||
return conn.Do(ctx, args...).Result()
|
return conn.Do(ctx, args...).Result()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Eval is the implementation of redis eval command.
|
||||||
|
func (s *Redis) Eval(script string, keys []string, args ...any) (any, error) {
|
||||||
|
return s.EvalCtx(context.Background(), script, keys, args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// EvalCtx is the implementation of redis eval command.
|
||||||
|
func (s *Redis) EvalCtx(ctx context.Context, script string, keys []string,
|
||||||
|
args ...any) (any, error) {
|
||||||
|
conn, err := getRedis(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return conn.Eval(ctx, script, keys, args...).Result()
|
||||||
|
}
|
||||||
|
|
||||||
// EvalSha is the implementation of redis evalsha command.
|
// EvalSha is the implementation of redis evalsha command.
|
||||||
func (s *Redis) EvalSha(sha string, keys []string, args ...any) (any, error) {
|
func (s *Redis) EvalSha(sha string, keys []string, args ...any) (any, error) {
|
||||||
return s.EvalShaCtx(context.Background(), sha, keys, args...)
|
return s.EvalShaCtx(context.Background(), sha, keys, args...)
|
||||||
|
|||||||
Reference in New Issue
Block a user