Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetReplyType ¶
GetReplyType does test Redis commands to see what's the reply type in Golang for each Redis command.
Example ¶
ExampleGetReplyType tests the return value and types of Redis Commands.
package main import ( "github.com/northbright/redigotest" ) func main() { cmds := []redigotest.Command{ redigotest.Command{Cmd: "FLUSHALL", Args: []interface{}{}}, redigotest.Command{Cmd: "INFO", Args: []interface{}{"keyspace"}}, redigotest.Command{Cmd: "SET", Args: []interface{}{"student:num", 0}}, redigotest.Command{Cmd: "GET", Args: []interface{}{"student:num"}}, redigotest.Command{Cmd: "HSET", Args: []interface{}{"student:1", "name", "Bob"}}, redigotest.Command{Cmd: "HSET", Args: []interface{}{"student:1", "age", "20"}}, redigotest.Command{Cmd: "HGET", Args: []interface{}{"student:1", "name"}}, redigotest.Command{Cmd: "INCR", Args: []interface{}{"student:num"}}, redigotest.Command{Cmd: "GET", Args: []interface{}{"student:num"}}, redigotest.Command{Cmd: "LPUSH", Args: []interface{}{"laststudents", "1", "2", "3"}}, redigotest.Command{Cmd: "LRANGE", Args: []interface{}{"laststudents", 0, -1}}, redigotest.Command{Cmd: "HSCAN", Args: []interface{}{"student:1", 0}}, } pool := redigotest.NewRedisPool(":6379", false, "") c := pool.Get() defer c.Close() redigotest.GetReplyType(c, cmds) }
Output:
func NewRedisPool ¶
NewRedisPool creates a Redis Pool.
func SetInt ¶
SetInt tests the return value of "SET" command with integer or string.
Example ¶
package main import ( "github.com/northbright/redigotest" ) func main() { var vUint64 uint64 = 12345678 var vInt64 int64 = 12345678 var vStr string = "12345678" vArr := []interface{}{vUint64, vInt64, vStr} pool := redigotest.NewRedisPool(":6379", false, "") c := pool.Get() defer c.Close() for _, v := range vArr { redigotest.SetInt(c, "int-test", v) } }
Output:
Types ¶
Click to show internal directories.
Click to hide internal directories.