aboutsummaryrefslogtreecommitdiff
path: root/vendor/gopkg.in/redis.v2/script.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2019-10-23 23:03:17 -0700
committerGitHub <noreply@github.com>2019-10-23 23:03:17 -0700
commit613139e7bef81d3573e7988a47eb6765f3de347a (patch)
tree49de7277898d3ff47a122c072568edb8ed4c9ac9 /vendor/gopkg.in/redis.v2/script.go
parentfb100dbf98f02e4c631d142ff0f52ec29ee2f00c (diff)
Enable Go modules (#5835)
* Remove vendor * Enable Go modules * ci: add command to fetch dependencies * ci: update setting * ci: update settings * Require Go 1.11 * Rename module name to gogs.io/gogs
Diffstat (limited to 'vendor/gopkg.in/redis.v2/script.go')
-rw-r--r--vendor/gopkg.in/redis.v2/script.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/vendor/gopkg.in/redis.v2/script.go b/vendor/gopkg.in/redis.v2/script.go
deleted file mode 100644
index 96c35f51..00000000
--- a/vendor/gopkg.in/redis.v2/script.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package redis
-
-import (
- "crypto/sha1"
- "encoding/hex"
- "io"
- "strings"
-)
-
-type scripter interface {
- Eval(script string, keys []string, args []string) *Cmd
- EvalSha(sha1 string, keys []string, args []string) *Cmd
- ScriptExists(scripts ...string) *BoolSliceCmd
- ScriptLoad(script string) *StringCmd
-}
-
-type Script struct {
- src, hash string
-}
-
-func NewScript(src string) *Script {
- h := sha1.New()
- io.WriteString(h, src)
- return &Script{
- src: src,
- hash: hex.EncodeToString(h.Sum(nil)),
- }
-}
-
-func (s *Script) Load(c scripter) *StringCmd {
- return c.ScriptLoad(s.src)
-}
-
-func (s *Script) Exists(c scripter) *BoolSliceCmd {
- return c.ScriptExists(s.src)
-}
-
-func (s *Script) Eval(c scripter, keys []string, args []string) *Cmd {
- return c.Eval(s.src, keys, args)
-}
-
-func (s *Script) EvalSha(c scripter, keys []string, args []string) *Cmd {
- return c.EvalSha(s.hash, keys, args)
-}
-
-func (s *Script) Run(c *Client, keys []string, args []string) *Cmd {
- r := s.EvalSha(c, keys, args)
- if err := r.Err(); err != nil && strings.HasPrefix(err.Error(), "NOSCRIPT ") {
- return s.Eval(c, keys, args)
- }
- return r
-}