Documentation ¶
Index ¶
- type FriendsList
- func (f *FriendsList) Add(name string)
- func (f *FriendsList) Contains(name string) bool
- func (f *FriendsList) ContainsHash(hash uint64) bool
- func (f *FriendsList) EntrySet() (nameList map[string]bool)
- func (f *FriendsList) ForEach(fn func(string, bool) bool)
- func (f *FriendsList) NameSet() (nameList []string)
- func (f *FriendsList) Remove(name string)
- func (f *FriendsList) Set(name string, val bool)
- func (f *FriendsList) Size() int
- func (f *FriendsList) Status(name string) bool
- func (f *FriendsList) StatusHash(name uint64) bool
- func (f *FriendsList) ToggleStatus(name string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FriendsList ¶
FriendsList A map with base37 integer representations of player usernames mapped to their login status. The responsibility of managing the login statuses falls upon the caller; it will not attempt to grab data from anywhere else to automatically update statuses of the players it lists, it is just concurrency-safe data-set with an intuitive API designed to promote external mutability of its contents.
func New ¶
func New() *FriendsList
TODO: Should I remove the owner username hash from this? Is it really beneficial to use like this TODO: or is it considered harmful? New returns a new friends list reference.
func (*FriendsList) Add ¶
func (f *FriendsList) Add(name string)
Add Deprecated: See Set(string,bool)
func (*FriendsList) Contains ¶
func (f *FriendsList) Contains(name string) bool
func (*FriendsList) ContainsHash ¶
func (f *FriendsList) ContainsHash(hash uint64) bool
func (*FriendsList) EntrySet ¶
func (f *FriendsList) EntrySet() (nameList map[string]bool)
EntrySet returns a copy of this collection.
func (*FriendsList) ForEach ¶
func (f *FriendsList) ForEach(fn func(string, bool) bool)
ForEach runs fn(key,val) for each entry in the collection
func (*FriendsList) NameSet ¶
func (f *FriendsList) NameSet() (nameList []string)
NameSet returns all the players names in this collection.
func (*FriendsList) Remove ¶
func (f *FriendsList) Remove(name string)
func (*FriendsList) Set ¶
func (f *FriendsList) Set(name string, val bool)
Set maps an online status (true/false) to a player by their username hash.
func (*FriendsList) Size ¶
func (f *FriendsList) Size() int
Size returns the length of the entry set.
func (*FriendsList) Status ¶
func (f *FriendsList) Status(name string) bool
Status Returns the online status for a given player username.
func (*FriendsList) StatusHash ¶
func (f *FriendsList) StatusHash(name uint64) bool
Status Returns the online status for a given player username hash.
func (*FriendsList) ToggleStatus ¶
func (f *FriendsList) ToggleStatus(name string) bool
ToggleStatus will flip the boolean value mapped to name then return true, or if no such entry exists, does nothing and returns false.