Esempio n. 1
0
// Set sets an object within consul. Returns an error on any problem.
func (c *Client) Set(obj db.Entity) error {
	return helpers.WrapSet(c, obj, func(path string, content []byte) error {
		_, err := c.client.KV().Put(&api.KVPair{Key: c.qualified(path), Value: content}, nil)
		return err
	})
}
Esempio n. 2
0
// Set takes the object and commits it to the database.
func (c *Client) Set(obj db.Entity) error {
	return helpers.WrapSet(c, obj, func(path string, content []byte) error {
		_, err := c.client.Set(context.Background(), c.qualified(path), string(content), nil)
		return err
	})
}