mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-06 14:31:42 +02:00
added Store.Keys()
This commit is contained in:
1 parent
bf1f164014
commit
25dc8a8eea
2 files changed
+36
-1
No files matched your search
+15
-1
@@ -122,7 +122,21 @@ func (s *Store[K, T]) GetAll() map[K]T {
|
||||
return clone
|
||||
}
|
||||
|
||||
// Values returns a slice with all of the current store values.
|
||||
// Keys returns a slice with all of the store keys.
|
||||
func (s *Store[K, T]) Keys() []K {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
var keys = make([]K, 0, len(s.data))
|
||||
|
||||
for k := range s.data {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
|
||||
return keys
|
||||
}
|
||||
|
||||
// Values returns a slice with all of the store values.
|
||||
func (s *Store[K, T]) Values() []T {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
Reference in new issue
Block a user