Skip to content

Commit

Permalink
add Users.Find()
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Cooper committed Nov 21, 2014
1 parent 60bb272 commit 27af6b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gumble/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ func (u Users) Exists(session uint) bool {
func (u Users) Delete(session uint) {
delete(u, session)
}

// Find returns the user with the given name. Nil is returned if no user exists
// with the given name.
func (u Users) Find(name string) *User {
for _, user := range u {
if user.name == name {
return user
}
}
return nil
}

0 comments on commit 27af6b4

Please sign in to comment.