MCPcopy
hub / github.com/pocketbase/pocketbase / New

Function New

tools/store/store.go:19–25  ·  view source on GitHub ↗

New creates a new Store[T] instance with a shallow copy of the provided data (if any).

(data map[K]T)

Source from the content-addressed store, hash-verified

17
18// New creates a new Store[T] instance with a shallow copy of the provided data (if any).
19func 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.

Callers 13

filter.goFile · 0.92
TestNewFunction · 0.92
TestResetFunction · 0.92
TestLengthFunction · 0.92
TestRemoveAllFunction · 0.92
TestRemoveFunction · 0.92
TestHasFunction · 0.92
TestGetFunction · 0.92
TestGetOkFunction · 0.92
TestGetAllFunction · 0.92
TestValuesFunction · 0.92
TestGetOrSetFunction · 0.92

Calls 1

ResetMethod · 0.45

Tested by 11

TestNewFunction · 0.74
TestResetFunction · 0.74
TestLengthFunction · 0.74
TestRemoveAllFunction · 0.74
TestRemoveFunction · 0.74
TestHasFunction · 0.74
TestGetFunction · 0.74
TestGetOkFunction · 0.74
TestGetAllFunction · 0.74
TestValuesFunction · 0.74
TestGetOrSetFunction · 0.74