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

Method Role

pkg/utils/redis/client.go:269–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

267}
268
269func (c *Client) Role() (string, error) {
270 if reply, err := c.Do("ROLE"); err != nil {
271 return "", err
272 } else {
273 values, err := redigo.Values(reply, nil)
274 if err != nil {
275 return "", errors.Trace(err)
276 }
277 if len(values) == 0 {
278 return "", errors.Errorf("invalid response = %v", reply)
279 }
280 role, err := redigo.String(values[0], nil)
281 if err != nil {
282 return "", errors.Errorf("invalid response[0] = %v", values[0])
283 }
284 return strings.ToUpper(role), nil
285 }
286}
287
288var ErrClosedPool = errors.New("use of closed redis pool")
289

Callers

nothing calls this directly

Calls 4

DoMethod · 0.95
ValuesMethod · 0.80
ErrorfMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected