@@ -8,17 +8,17 @@ import (
8
8
"strings"
9
9
)
10
10
11
- type scripter interface {
11
+ type Scripter interface {
12
12
Eval (ctx context.Context , script string , keys []string , args ... interface {}) * Cmd
13
13
EvalSha (ctx context.Context , sha1 string , keys []string , args ... interface {}) * Cmd
14
14
ScriptExists (ctx context.Context , hashes ... string ) * BoolSliceCmd
15
15
ScriptLoad (ctx context.Context , script string ) * StringCmd
16
16
}
17
17
18
18
var (
19
- _ scripter = (* Client )(nil )
20
- _ scripter = (* Ring )(nil )
21
- _ scripter = (* ClusterClient )(nil )
19
+ _ Scripter = (* Client )(nil )
20
+ _ Scripter = (* Ring )(nil )
21
+ _ Scripter = (* ClusterClient )(nil )
22
22
)
23
23
24
24
type Script struct {
@@ -38,25 +38,25 @@ func (s *Script) Hash() string {
38
38
return s .hash
39
39
}
40
40
41
- func (s * Script ) Load (ctx context.Context , c scripter ) * StringCmd {
41
+ func (s * Script ) Load (ctx context.Context , c Scripter ) * StringCmd {
42
42
return c .ScriptLoad (ctx , s .src )
43
43
}
44
44
45
- func (s * Script ) Exists (ctx context.Context , c scripter ) * BoolSliceCmd {
45
+ func (s * Script ) Exists (ctx context.Context , c Scripter ) * BoolSliceCmd {
46
46
return c .ScriptExists (ctx , s .hash )
47
47
}
48
48
49
- func (s * Script ) Eval (ctx context.Context , c scripter , keys []string , args ... interface {}) * Cmd {
49
+ func (s * Script ) Eval (ctx context.Context , c Scripter , keys []string , args ... interface {}) * Cmd {
50
50
return c .Eval (ctx , s .src , keys , args ... )
51
51
}
52
52
53
- func (s * Script ) EvalSha (ctx context.Context , c scripter , keys []string , args ... interface {}) * Cmd {
53
+ func (s * Script ) EvalSha (ctx context.Context , c Scripter , keys []string , args ... interface {}) * Cmd {
54
54
return c .EvalSha (ctx , s .hash , keys , args ... )
55
55
}
56
56
57
57
// Run optimistically uses EVALSHA to run the script. If script does not exist
58
58
// it is retried using EVAL.
59
- func (s * Script ) Run (ctx context.Context , c scripter , keys []string , args ... interface {}) * Cmd {
59
+ func (s * Script ) Run (ctx context.Context , c Scripter , keys []string , args ... interface {}) * Cmd {
60
60
r := s .EvalSha (ctx , c , keys , args ... )
61
61
if err := r .Err (); err != nil && strings .HasPrefix (err .Error (), "NOSCRIPT " ) {
62
62
return s .Eval (ctx , c , keys , args ... )
0 commit comments