MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / ForEachRecord

Method ForEachRecord

internal/users/index.go:307–316  ·  view source on GitHub ↗

ForEachRecord iterates over all index records, calling fn for each. Returning false from fn stops iteration.

(fn func(rec IndexUserRecord) bool)

Source from the content-addressed store, hash-verified

305// ForEachRecord iterates over all index records, calling fn for each.
306// Returning false from fn stops iteration.
307func (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.
319func (idx *UserIndex) FindByUsername(username string) (int, bool) {

Callers 4

searchByUserIdFunction · 0.80
SearchUsersByRoleFunction · 0.80
searchByUsernameFunction · 0.80
BenchmarkForEachRecordFunction · 0.80

Calls

no outgoing calls

Tested by 1

BenchmarkForEachRecordFunction · 0.64