nstore

package
v2.0.0-...-9d96e6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2021 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemberStore

type MemberStore struct {
	// contains filtered or unexported fields
}

func NewMemberStore

func NewMemberStore() *MemberStore

func (*MemberStore) Each

func (s *MemberStore) Each(g discord.GuildID, fn func(*discord.Member) (stop bool)) error

Each iterates over all members of the guild in undefined order. The given callback must not store the pointer outside of the callback; it must do so after making its own copy.

func (*MemberStore) Member

func (s *MemberStore) Member(guildID discord.GuildID, userID discord.UserID) (*discord.Member, error)

func (*MemberStore) MemberRemove

func (s *MemberStore) MemberRemove(guildID discord.GuildID, userID discord.UserID) error

func (*MemberStore) MemberSet

func (s *MemberStore) MemberSet(guildID discord.GuildID, member discord.Member) error

func (*MemberStore) Members

func (s *MemberStore) Members(guildID discord.GuildID) ([]discord.Member, error)

func (*MemberStore) Reset

func (s *MemberStore) Reset() error

type PresenceStore

type PresenceStore struct {
	// contains filtered or unexported fields
}

PresenceStore is a presence store that allows searching for a user presence regardless of the guild they're from.

func NewPresenceStore

func NewPresenceStore() *PresenceStore

func (*PresenceStore) Each

func (pres *PresenceStore) Each(g discord.GuildID, fn func(*gateway.Presence) (stop bool))

Each iterates over all presences in undefined order. If a valid guild ID is given, then the presence passed into the callback will be from that guild if available. Otherwise, a fallback is given.

A read mutex is acquired, so the given callback is allowed to call PresenceStore's Presence and Presences methods. The given callback must not store the pointer outside of the callback; it must do so after making its own copy.

func (*PresenceStore) Presence

func (pres *PresenceStore) Presence(
	guild discord.GuildID, user discord.UserID) (*gateway.Presence, error)

func (*PresenceStore) PresenceRemove

func (pres *PresenceStore) PresenceRemove(guild discord.GuildID, user discord.UserID) error

func (*PresenceStore) PresenceSet

func (pres *PresenceStore) PresenceSet(guild discord.GuildID, p gateway.Presence) error

func (*PresenceStore) Presences

func (pres *PresenceStore) Presences(guild discord.GuildID) ([]gateway.Presence, error)

Presences creates a copy of all known presences. It is a fairly costly copy, so Each should be preferred over Presences. The only reason this method does what is intended is for compatibility with internal state functions that may rely on this for some reason.

func (*PresenceStore) Reset

func (pres *PresenceStore) Reset() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL