service/library/redis/helper.go

26 lines
687 B
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package redis
import (
"github.com/gomodule/redigo/redis"
)
// Int is a helper that converts a command reply to an integer
func Int(reply interface{}, err error) (int, error) {
return redis.Int(reply, err)
}
// Int64 is a helper that converts a command reply to 64 bit integer
func Int64(reply interface{}, err error) (int64, error) {
return redis.Int64(reply, err)
}
// String is a helper that converts a command reply to a string
func String(reply interface{}, err error) (string, error) {
return redis.String(reply, err)
}
// Bool is a helper that converts a command reply to a boolean
func Bool(reply interface{}, err error) (bool, error) {
return redis.Bool(reply, err)
}