// Get retrieves the item from etcd's key/value store and then populates obj with its data. func (c *Client) Get(obj db.Entity) error { return helpers.WrapGet(c, obj, func(path string) (string, []byte, error) { resp, err := c.client.Get(context.Background(), c.qualified(path), nil) if err != nil { return "", nil, errors.EtcdToErrored(err) } return resp.Node.Key, []byte(resp.Node.Value), nil }) }
// Get retrieves an object from consul, returns error on any problems. func (c *Client) Get(obj db.Entity) error { return helpers.WrapGet(c, obj, func(path string) (string, []byte, error) { pair, _, err := c.client.KV().Get(c.qualified(path), nil) if err != nil { return "", nil, err } if pair == nil { return "", nil, errors.NotExists.Combine(errored.New(c.qualified(path))) } return pair.Key, pair.Value, nil }) }