user

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserNotFound = errors.New("user does not exist")

Functions

This section is empty.

Types

type API

type API interface {
	Login(ctx context.Context, code, state string) (*skillz.User, error)
	LoadUserAll(ctx context.Context, id string) (*skillz.User, error)

	UserFromToken(ctx context.Context, token jwt.Token) (*skillz.User, error)
	ValidateCurrentToken(ctx context.Context, user *skillz.User) error

	User(ctx context.Context, id string, rels ...UserRel) (*skillz.User, error)
	RefreshUser(ctx context.Context, user *skillz.User) error
	UserByCharacterID(ctx context.Context, characterID uint64) (*skillz.User, error)
	SearchUsers(ctx context.Context, q string) ([]*skillz.UserSearchResult, error)
	CreateUser(ctx context.Context, user *skillz.User) error
	DeleteUser(ctx context.Context, user *skillz.User) error

	Recent(ctx context.Context) ([]*skillz.User, []*skillz.User, error)
	// NewUsersBySP(ctx context.Context) ([]*skillz.UserWithSkillMeta, error)
	ResetUserCache(ctx context.Context, user *skillz.User) error
	ProcessUpdatableUsers(ctx context.Context) ([]*skillz.User, error)

	UserSettings(ctx context.Context, id string) (*skillz.UserSettings, error)
	CreateUserSettings(ctx context.Context, userID string, settings *skillz.UserSettings) error
}

type Permission

type Permission uint
const (
	PermissionHideQueue Permission = iota
	PermissionHideClones
	PermissionHideStandings
	PermissionHideShips
)

type Service

type Service struct {
	skillz.UserRepository
	// contains filtered or unexported fields
}

func New

func New(
	redis *redis.Client,
	logger *logrus.Logger,
	cache cache.UserAPI,
	auth auth.API,
	alliance alliance.API,
	character character.API,
	corporation corporation.API,
	skills skill.API,
	clones clone.API,
	user skillz.UserRepository,
) *Service

func (*Service) CreateUserSettings

func (s *Service) CreateUserSettings(ctx context.Context, id string, settings *skillz.UserSettings) error

func (*Service) LoadAttributes

func (s *Service) LoadAttributes(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadCharacter

func (s *Service) LoadCharacter(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadFlyable

func (s *Service) LoadFlyable(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadImplants added in v0.4.0

func (s *Service) LoadImplants(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadSkillGrouped

func (s *Service) LoadSkillGrouped(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadSkillMeta

func (s *Service) LoadSkillMeta(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadSkillQueue

func (s *Service) LoadSkillQueue(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadSkills

func (s *Service) LoadSkills(ctx context.Context, user *skillz.User, entry *logrus.Entry, mx *sync.Mutex, wg *sync.WaitGroup)

func (*Service) LoadUserAll

func (s *Service) LoadUserAll(ctx context.Context, id string) (*skillz.User, error)

func (*Service) Login

func (s *Service) Login(ctx context.Context, code, state string) (*skillz.User, error)

func (*Service) ProcessUpdatableUsers

func (s *Service) ProcessUpdatableUsers(ctx context.Context) ([]*skillz.User, error)

func (*Service) Recent

func (s *Service) Recent(ctx context.Context) ([]*skillz.User, []*skillz.User, error)

func (*Service) RefreshUser

func (s *Service) RefreshUser(ctx context.Context, user *skillz.User) error

func (*Service) ResetUserCache added in v0.3.3

func (s *Service) ResetUserCache(ctx context.Context, user *skillz.User) error

func (*Service) SearchUsers

func (s *Service) SearchUsers(ctx context.Context, q string) ([]*skillz.UserSearchResult, error)

func (*Service) User

func (s *Service) User(ctx context.Context, id string, rels ...UserRel) (*skillz.User, error)

func (*Service) UserFromToken

func (s *Service) UserFromToken(ctx context.Context, token jwt.Token) (*skillz.User, error)

func (*Service) UserSettings

func (s *Service) UserSettings(ctx context.Context, id string) (*skillz.UserSettings, error)

func (*Service) ValidateCurrentToken

func (s *Service) ValidateCurrentToken(ctx context.Context, user *skillz.User) error

type UserRel

type UserRel uint
const (
	UserCharacterRel UserRel = iota
	UserAttributesRel
	UserSkillsRel
	UserFlyableRel
	UserSkillQueueRel
	UserSkillMetaRel
)

func (UserRel) Valid

func (r UserRel) Valid() bool

Jump to

Keyboard shortcuts

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