Documentation ¶
Index ¶
- func GetUser(ctx context.Context, id string, platform Platform) (*dovetypes.PlatformUser, error)
- func InitPlatform(platform Platform) error
- func TableName(platform Platform) string
- type BaseState
- type ClearFrom
- type ClearUserInfo
- type ClearUserReq
- type DiscordState
- func (d *DiscordState) GetState() *BaseState
- func (d *DiscordState) GetUser(ctx context.Context, id string) (*dovetypes.PlatformUser, error)
- func (d *DiscordState) Init() error
- func (d *DiscordState) Initted() bool
- func (d *DiscordState) PlatformName() string
- func (d *DiscordState) PlatformSpecificCache(ctx context.Context, id string) (*dovetypes.PlatformUser, error)
- func (d *DiscordState) ValidateId(id string) (string, error)
- type DiscordStateConfig
- type Platform
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClearUserInfo ¶
type ClearUserInfo struct { // The user that was cleared ClearedFrom []ClearFrom }
ClearUserInfo contains information on a clear operation
func ClearUser ¶
func ClearUser(ctx context.Context, id string, platform Platform, req ClearUserReq) (*ClearUserInfo, error)
Clears a user of a platform
type ClearUserReq ¶
type ClearUserReq struct { // Where to clear from // // iuc -> internal user cache (postgres) // // Redis -> redis cache // // // If not specified, will clear from all ClearFrom []ClearFrom }
type DiscordState ¶
type DiscordState struct {
// contains filtered or unexported fields
}
func (*DiscordState) GetState ¶
func (d *DiscordState) GetState() *BaseState
func (*DiscordState) GetUser ¶
func (d *DiscordState) GetUser(ctx context.Context, id string) (*dovetypes.PlatformUser, error)
func (*DiscordState) Init ¶
func (d *DiscordState) Init() error
func (*DiscordState) Initted ¶
func (d *DiscordState) Initted() bool
func (*DiscordState) PlatformName ¶
func (d *DiscordState) PlatformName() string
func (*DiscordState) PlatformSpecificCache ¶
func (d *DiscordState) PlatformSpecificCache(ctx context.Context, id string) (*dovetypes.PlatformUser, error)
func (*DiscordState) ValidateId ¶
func (d *DiscordState) ValidateId(id string) (string, error)
type DiscordStateConfig ¶
type DiscordStateConfig struct { Session *discordgo.Session // Discord session PreferredGuild string // Which guilds should be checked first for users, good if theres one guild with the majority of users BaseState *BaseState // Base state }
func (DiscordStateConfig) New ¶
func (c DiscordStateConfig) New() (*DiscordState, error)
type Platform ¶
type Platform interface { // initializes a platform, most of the time, needs no implementation Init() error // returns whether or not the platform is initialized, init() must set this to true if called Initted() bool // Returns the base state GetState() *BaseState // returns the name of the platform, used for cache table names PlatformName() string // validate the id, if feasible ValidateId(id string) (string, error) // try and find the user in the platform's cache, should only hit cache // // if user not found, return nil, nil (error should be nil and user obj should be nil) // // note that returning a error here will cause the user to not be fetched from the platform PlatformSpecificCache(ctx context.Context, id string) (*dovetypes.PlatformUser, error) // fetch a user from the platform, at this point, assume that cache has been checked GetUser(ctx context.Context, id string) (*dovetypes.PlatformUser, error) }
Click to show internal directories.
Click to hide internal directories.