MCPcopy
hub / github.com/pocketbase/pocketbase / Reset

Method Reset

tools/store/store.go:29–43  ·  view source on GitHub ↗

Reset clears the store and replaces the store data with a shallow copy of the provided newData.

(newData map[K]T)

Source from the content-addressed store, hash-verified

27// Reset clears the store and replaces the store data with a
28// shallow copy of the provided newData.
29func (s *Store[K, T]) Reset(newData map[K]T) {
30 s.mu.Lock()
31 defer s.mu.Unlock()
32
33 if len(newData) > 0 {
34 s.data = make(map[K]T, len(newData))
35 for k, v := range newData {
36 s.data[k] = v
37 }
38 } else {
39 s.data = make(map[K]T)
40 }
41
42 s.deleted = 0
43}
44
45// Length returns the current number of elements in the store.
46func (s *Store[K, T]) Length() int {

Callers 12

RemoveAllMethod · 0.95
html2TextFunction · 0.45
NewFunction · 0.45
TestResetFunction · 0.45
initLoggerMethod · 0.45
CloneMethod · 0.45
SetExpandMethod · 0.45
MergeExpandMethod · 0.45
realtimeConnectFunction · 0.45
GzipWithConfigFunction · 0.45

Calls

no outgoing calls

Tested by 3

TestResetFunction · 0.36