MCPcopy
hub / github.com/CodisLabs/codis / Mget

Method Mget

extern/deprecated/redis-test/utils.go:503–536  ·  view source on GitHub ↗
(c *Conn)

Source from the content-addressed store, hash-verified

501}
502
503func (us UnitSlice) Mget(c *Conn) {
504 keys := make([]interface{}, len(us))
505 for i := 0; i < len(us); i++ {
506 keys[i] = us[i].key
507 }
508 var rsp interface{}
509 defer func() {
510 if x := recover(); x != nil {
511 Panic("mget: c = %s, keys = %v, error = '%s', rsp = %v", c.Addr(), keys, x, rsp)
512 }
513 }()
514 var err error
515 if rsp, err = c.Do("mget", keys...); err != nil {
516 panic(err)
517 }
518 as := c.Values(rsp, len(us))
519 for i := 0; i < len(us); i++ {
520 u := us[i]
521 switch u.val.(type) {
522 default:
523 panic(fmt.Sprintf("key = %s, invalid type", u.key))
524 case int:
525 v := c.Int(as[i])
526 if x := u.val.(int); x != v {
527 panic(fmt.Sprintf("key = %s, return = %d, expect = %d", u.key, v, x))
528 }
529 case string:
530 v := c.String(as[i])
531 if x := u.val.(string); x != v {
532 panic(fmt.Sprintf("key = %s, return = %s, expect = %s", u.key, v, x))
533 }
534 }
535 }
536}
537
538func (us UnitSlice) Mset(c *Conn, vals ...interface{}) {
539 if len(us) != len(vals) {

Callers 2

mainMethod · 0.80
playerMethod · 0.80

Calls 6

ValuesMethod · 0.80
PanicFunction · 0.70
AddrMethod · 0.45
DoMethod · 0.45
IntMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected