Documentation ¶
Index ¶
- Variables
- type UIDAccount
- func (u *UIDAccount) AccountToUID(account *user.Account) (uid string, err error)
- func (u *UIDAccount) AccountToUIDOrRegister(account *user.Account) (uid string, registerd bool, err error)
- func (u *UIDAccount) Accounts(uid ...string) (*member.Accounts, error)
- func (u *UIDAccount) BindAccount(uid string, account *user.Account) error
- func (u *UIDAccount) Execute(m *member.Service) error
- func (u *UIDAccount) Register(account *user.Account) (uid string, err error)
- func (u *UIDAccount) UnbindAccount(uid string, account *user.Account) error
Constants ¶
This section is empty.
Variables ¶
var DirectiveFactory = func(loader func(v interface{}) error) (member.Directive, error) { c := &UIDAccount{} err := loader(c) if err != nil { return nil, err } return c, nil }
DirectiveFactory factory to create uidaccount directive
var ErrAccountKeywordNotMatch = errors.New("uidaccount: account keyword not match")
ErrAccountKeywordNotMatch error raised when account keyword not match
var ErrPrefixOrSuffixNotMatch = errors.New("uidaccount:prefix or suffix not match")
ErrPrefixOrSuffixNotMatch error raised when prefix or suffix not match
var ErrUIDAndAccountNotMatch = errors.New("uidaccount:uid and account not match")
ErrUIDAndAccountNotMatch error raised when uid and account not match
Functions ¶
This section is empty.
Types ¶
type UIDAccount ¶
type UIDAccount struct { //AccountKeyword account keyword AccountKeyword string //Prefix uid prefix Prefix string //Suffix uid suffix Suffix string }
UIDAccount uidaccount directive struct
func (*UIDAccount) AccountToUID ¶
func (u *UIDAccount) AccountToUID(account *user.Account) (uid string, err error)
AccountToUID query uid by user account. Return user id and any error if raised. Return empty string as userid if account not found.
func (*UIDAccount) AccountToUIDOrRegister ¶
func (u *UIDAccount) AccountToUIDOrRegister(account *user.Account) (uid string, registerd bool, err error)
AccountToUIDOrRegister query uid by user account.Register user if account not found. Return user id and any error if raised.
func (*UIDAccount) Accounts ¶
func (u *UIDAccount) Accounts(uid ...string) (*member.Accounts, error)
Accounts return account map of given uid list. Return account map and any error if raised.
func (*UIDAccount) BindAccount ¶
func (u *UIDAccount) BindAccount(uid string, account *user.Account) error
BindAccount bind account to user. Return any error if raised. If account exists,user.ErrAccountBindingExists should be rasied.
func (*UIDAccount) Execute ¶
func (u *UIDAccount) Execute(m *member.Service) error
Execute apply uidaccount directive to member service
func (*UIDAccount) Register ¶
func (u *UIDAccount) Register(account *user.Account) (uid string, err error)
Register create new user with given account. Return created user id and any error if raised. Privoder should return ErrAccountRegisterExists if account is used.
func (*UIDAccount) UnbindAccount ¶
func (u *UIDAccount) UnbindAccount(uid string, account *user.Account) error
UnbindAccount unbind account from user. Return any error if raised. If account not exists,user.ErrAccountUnbindingNotExists should be rasied.