uidaccount

package
v0.0.0-...-2c17daf Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

View Source
var ErrAccountKeywordNotMatch = errors.New("uidaccount: account keyword not match")

ErrAccountKeywordNotMatch error raised when account keyword not match

View Source
var ErrPrefixOrSuffixNotMatch = errors.New("uidaccount:prefix or suffix not match")

ErrPrefixOrSuffixNotMatch error raised when prefix or suffix not match

View Source
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.

Jump to

Keyboard shortcuts

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