New creates a new Store[T] instance with a shallow copy of the provided data (if any).
(data map[K]T)
| 17 | |
| 18 | // New creates a new Store[T] instance with a shallow copy of the provided data (if any). |
| 19 | func New[K comparable, T any](data map[K]T) *Store[K, T] { |
| 20 | s := &Store[K, T]{} |
| 21 | |
| 22 | s.Reset(data) |
| 23 | |
| 24 | return s |
| 25 | } |
| 26 | |
| 27 | // Reset clears the store and replaces the store data with a |
| 28 | // shallow copy of the provided newData. |