fix golint issues (#540)
This commit is contained in:
@@ -250,15 +250,15 @@ func (s *Redis) Eval(script string, keys []string, args ...interface{}) (val int
|
||||
return
|
||||
}
|
||||
|
||||
// Eval is the implementation of redis eval command.
|
||||
func (s *Redis) EvalSha(script string, keys []string, args ...interface{}) (val interface{}, err error) {
|
||||
// EvalSha is the implementation of redis evalsha command.
|
||||
func (s *Redis) EvalSha(sha string, keys []string, args ...interface{}) (val interface{}, err error) {
|
||||
err = s.brk.DoWithAcceptable(func() error {
|
||||
conn, err := getRedis(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val, err = conn.EvalSha(script, keys, args...).Result()
|
||||
val, err = conn.EvalSha(sha, keys, args...).Result()
|
||||
return err
|
||||
}, acceptable)
|
||||
|
||||
@@ -1047,6 +1047,16 @@ func (s *Redis) Scard(key string) (val int64, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// ScriptLoad is the implementation of redis script load command.
|
||||
func (s *Redis) ScriptLoad(script string) (string, error) {
|
||||
conn, err := getRedis(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return conn.ScriptLoad(script).Result()
|
||||
}
|
||||
|
||||
// Set is the implementation of redis set command.
|
||||
func (s *Redis) Set(key string, value string) error {
|
||||
return s.brk.DoWithAcceptable(func() error {
|
||||
@@ -1116,26 +1126,6 @@ func (s *Redis) Sismember(key string, value interface{}) (val bool, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Srem is the implementation of redis srem command.
|
||||
func (s *Redis) Srem(key string, values ...interface{}) (val int, err error) {
|
||||
err = s.brk.DoWithAcceptable(func() error {
|
||||
conn, err := getRedis(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v, err := conn.SRem(key, values...).Result()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val = int(v)
|
||||
return nil
|
||||
}, acceptable)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Smembers is the implementation of redis smembers command.
|
||||
func (s *Redis) Smembers(key string) (val []string, err error) {
|
||||
err = s.brk.DoWithAcceptable(func() error {
|
||||
@@ -1181,6 +1171,31 @@ func (s *Redis) Srandmember(key string, count int) (val []string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Srem is the implementation of redis srem command.
|
||||
func (s *Redis) Srem(key string, values ...interface{}) (val int, err error) {
|
||||
err = s.brk.DoWithAcceptable(func() error {
|
||||
conn, err := getRedis(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
v, err := conn.SRem(key, values...).Result()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val = int(v)
|
||||
return nil
|
||||
}, acceptable)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// String returns the string representation of s.
|
||||
func (s *Redis) String() string {
|
||||
return s.Addr
|
||||
}
|
||||
|
||||
// Sunion is the implementation of redis sunion command.
|
||||
func (s *Redis) Sunion(keys ...string) (val []string, err error) {
|
||||
err = s.brk.DoWithAcceptable(func() error {
|
||||
@@ -1682,20 +1697,6 @@ func (s *Redis) Zunionstore(dest string, store ZStore, keys ...string) (val int6
|
||||
return
|
||||
}
|
||||
|
||||
// String returns the string representation of s.
|
||||
func (s *Redis) String() string {
|
||||
return s.Addr
|
||||
}
|
||||
|
||||
func (s *Redis) ScriptLoad(script string) (string, error) {
|
||||
conn, err := getRedis(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return conn.ScriptLoad(script).Result()
|
||||
}
|
||||
|
||||
func acceptable(err error) bool {
|
||||
return err == nil || err == red.Nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user