dovewing

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUser

func GetUser(ctx context.Context, id string, platform Platform) (*dovetypes.PlatformUser, error)

Fetches a user based on the platform

func InitPlatform

func InitPlatform(platform Platform) error

func TableName

func TableName(platform Platform) string

Types

type BaseState

type BaseState struct {
	Logger            *zap.Logger
	Context           context.Context
	Pool              *pgxpool.Pool
	PlatformUserCache hotcache.HotCache[dovetypes.PlatformUser]
	Middlewares       []func(p Platform, u *dovetypes.PlatformUser) (*dovetypes.PlatformUser, error)
	UserExpiryTime    time.Duration
}

type ClearFrom

type ClearFrom string
const (
	ClearFromInternalUserCache ClearFrom = "iuc"
	ClearFromRedis             ClearFrom = "redis"
)

type ClearUserInfo

type ClearUserInfo struct {
	// The user that was cleared
	ClearedFrom []ClearFrom

	// Whether the user was a bot or not
	IsBot bool
}

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 Platform

type Platform interface {
	Init() error
	Initted() bool
	GetState() *BaseState
	PlatformName() string
	ValidateId(id string) (string, error)
	PlatformSpecificCache(ctx context.Context, id string) (*dovetypes.PlatformUser, error)
	GetUser(ctx context.Context, id string) (*dovetypes.PlatformUser, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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