func (da *Cedar) Update(key []byte, value int) error {
	p := da.get(key, 0, 0)

	// key was not inserted
	if *p == ValueLimit {
		*p = value
		return nil
	}

	// key was inserted before
	if *p+value < 0 || *p+value >= ValueLimit {
		return ErrInvalidValue
	}
	*p += value
	return nil
}
func (da *Cedar) Update(key []byte, value int) error {
	p := da.get(key, 0, 0)

	
	if *p == ValueLimit {
		*p = value
		return nil
	}

	
	if *p+value < 0 || *p+value >= ValueLimit {
		return ErrInvalidValue
	}
	*p += value
	return nil
}
func ( da * Cedar ) Update ( key [ ] byte , value int ) error { p := da . get ( key , 0 , 0 ) // key was not inserted if * p == ValueLimit { * p = value return nil } // key was inserted before if * p + value < 0 || * p + value >= ValueLimit { return ErrInvalidValue } * p += value return nil }
// Update increases the value associated with the `key`.
// The `key` will be inserted if it is not in the cedar.
// It will return ErrInvalidValue, if the updated value < 0 or >= ValueLimit.
Update increases the value associated with the key . The key will be inserted if it is not in the cedar . It will return ErrInvalidValue if the updated value < 0 or > = ValueLimit .