ForEachRecord iterates over all index records, calling fn for each. Returning false from fn stops iteration.
(fn func(rec IndexUserRecord) bool)
| 305 | // ForEachRecord iterates over all index records, calling fn for each. |
| 306 | // Returning false from fn stops iteration. |
| 307 | func (idx *UserIndex) ForEachRecord(fn func(rec IndexUserRecord) bool) { |
| 308 | idx.mu.RLock() |
| 309 | defer idx.mu.RUnlock() |
| 310 | |
| 311 | for _, rec := range idx.records { |
| 312 | if !fn(rec) { |
| 313 | return |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | // FindByUsername searches the index for a username and returns its userId. |
| 319 | func (idx *UserIndex) FindByUsername(username string) (int, bool) { |
no outgoing calls