storeTx stores all the values or none at all.
(ctx context.Context, s Storage, all []keyValue)
| 192 | |
| 193 | // storeTx stores all the values or none at all. |
| 194 | func storeTx(ctx context.Context, s Storage, all []keyValue) error { |
| 195 | for i, kv := range all { |
| 196 | err := s.Store(ctx, kv.key, kv.value) |
| 197 | if err != nil { |
| 198 | for j := i - 1; j >= 0; j-- { |
| 199 | s.Delete(ctx, all[j].key) |
| 200 | } |
| 201 | return err |
| 202 | } |
| 203 | } |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | // keyValue pairs a key and a value. |
| 208 | type keyValue struct { |
no test coverage detected
searching dependent graphs…