usercache

package
v0.0.0-...-be25ffa Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DirectiveFactory = func(loader func(v interface{}) error) (usersystem.Directive, error) {
	c := &Config{}
	err := loader(c)

	if err != nil {
		return nil, err
	}

	return c, nil
}
View Source
var ErrUserAccountServiceNotInstalled = errors.New("usercache:user account service not installed")
View Source
var ErrUserRoleServiceNotInstalled = errors.New("usercache:user role service not installed")
View Source
var ErrUserStatusServiceNotInstalled = errors.New("usercache:user status service not installed")
View Source
var ErrUserTermServiceNotInstalled = errors.New("usercache:user term service not installed")

Functions

This section is empty.

Types

type Account

type Account struct {
	Cache *Cache
	useraccount.Service
	Preset *cachepreset.Preset
}

func (*Account) MustAccounts

func (a *Account) MustAccounts(uid string) *user.Accounts

Accounts return accounts of give uid.

func (*Account) MustBindAccount

func (a *Account) MustBindAccount(uid string, account *user.Account)

BindAccount bind account to user. If account exists,user.ErrAccountBindingExists should be rasied.

func (*Account) MustUnbindAccount

func (a *Account) MustUnbindAccount(uid string, account *user.Account)

UnbindAccount unbind account from user. If account not exists,user.ErrAccountUnbindingNotExists should be rasied.

func (*Account) Purge

func (a *Account) Purge(uid string) error

Purge purge user data cache

func (*Account) Start

func (a *Account) Start() error

Start start service

func (*Account) Stop

func (a *Account) Stop() error

Stop stop service

type Cache

type Cache struct {
	Stroage       *herbcache.Storage
	Preset        *cachepreset.Preset
	PrefixStatus  string
	PrefixAccount string
	PrefixTerm    string
	PrefixRole    string
	PrefixProfile string
	// contains filtered or unexported fields
}

func (*Cache) CreateAccount

func (c *Cache) CreateAccount(service useraccount.Service, preset *cachepreset.Preset) (*Account, error)

func (*Cache) CreateProfile

func (c *Cache) CreateProfile(service userprofile.Service, preset *cachepreset.Preset) (*Profile, error)

func (*Cache) CreateRole

func (c *Cache) CreateRole(service userrole.Service, preset *cachepreset.Preset) (*Role, error)

func (*Cache) CreateStatus

func (c *Cache) CreateStatus(service userstatus.Service, preset *cachepreset.Preset) (*Status, error)

func (*Cache) CreateTerm

func (c *Cache) CreateTerm(service userterm.Service, preset *cachepreset.Preset) (*Term, error)

func (*Cache) Execute

func (c *Cache) Execute(s *usersystem.UserSystem) error

func (*Cache) Start

func (c *Cache) Start() error

func (*Cache) Stop

func (c *Cache) Stop() error

type Config

type Config struct {
	Cache         *cacheconfig.Config
	PrefixStatus  string
	PrefixTerm    string
	PrefixAccount string
	PrefixRole    string
	PrefixProfile string
}

func (*Config) Execute

func (c *Config) Execute(s *usersystem.UserSystem) error

type Profile

type Profile struct {
	Cache *Cache
	userprofile.Service
	Preset *cachepreset.Preset
}

func (*Profile) MustGetProfile

func (p *Profile) MustGetProfile(id string) *profile.Profile

func (*Profile) MustUpdateProfile

func (p *Profile) MustUpdateProfile(id string, pf *profile.Profile)

func (*Profile) Purge

func (p *Profile) Purge(uid string) error

Purge purge user data cache

func (*Profile) Start

func (p *Profile) Start() error

Start start service

func (*Profile) Stop

func (p *Profile) Stop() error

Stop stop service

type Role

type Role struct {
	Cache *Cache
	userrole.Service
	Preset *cachepreset.Preset
}

func (*Role) MustRoles

func (r *Role) MustRoles(uid string) *role.Roles

func (*Role) Purge

func (r *Role) Purge(uid string) error

Purge purge user data cache

func (*Role) Start

func (r *Role) Start() error

Start start service

func (*Role) Stop

func (r *Role) Stop() error

Stop stop service

type Status

type Status struct {
	Cache *Cache
	userstatus.Service
	Preset *cachepreset.Preset
}

func (*Status) MustLoadStatus

func (s *Status) MustLoadStatus(id string) (status.Status, bool)

func (*Status) MustRemoveStatus

func (s *Status) MustRemoveStatus(id string)

MustRemoveStatus remove user status

func (*Status) MustUpdateStatus

func (s *Status) MustUpdateStatus(id string, st status.Status)

MustUpdateStatus update user status.

func (*Status) Purge

func (s *Status) Purge(id string) error

MustRemoveStatus list user by status Purge purge user data cache

func (*Status) Start

func (s *Status) Start() error

Start start service

func (*Status) Stop

func (s *Status) Stop() error

Stop stop service

type Term

type Term struct {
	Cache *Cache
	userterm.Service
	Preset *cachepreset.Preset
}

func (*Term) MustCurrentTerm

func (t *Term) MustCurrentTerm(uid string) string

func (*Term) MustStartNewTerm

func (t *Term) MustStartNewTerm(uid string) string

func (*Term) Purge

func (t *Term) Purge(uid string) error

Purge purge user data cache

func (*Term) Start

func (t *Term) Start() error

Start start service

func (*Term) Stop

func (t *Term) Stop() error

Stop stop service

Jump to

Keyboard shortcuts

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