Example #1
0
func (s *store) Append(key, value []byte) error {
	old, err := s.Get(key)
	if err != nil {
		return err
	}

	v, write, err := db.Upd(key, value, old)
	if err != nil {
		return err
	}

	if write {
		return s.Set(key, v)
	}
	return nil
}
Example #2
0
func (b *batch) Append(key, value []byte) error {
	old, err := b.s.Get(key)
	if err != nil {
		return err
	}

	v, write, err := db.Upd(key, value, old)
	if err != nil {
		return err
	}

	if write {
		b.bn.Put(key, v)
	}
	return nil
}