Documentation ¶
Index ¶
- func NewUserStorage() (model.UserStorage, error)
- type UserStorage
- func (us *UserStorage) AddUserWithFederatedID(user model.User, provider string, id, role string) (model.User, error)
- func (us *UserStorage) AddUserWithPassword(user model.User, password, role string, isAnonymous bool) (model.User, error)
- func (us *UserStorage) AllDeviceTokens(userID string) ([]string, error)
- func (us *UserStorage) AttachDeviceToken(id, token string) error
- func (us *UserStorage) CheckPassword(id, password string) error
- func (us *UserStorage) Close()
- func (us *UserStorage) DeleteUser(id string) error
- func (us *UserStorage) DetachDeviceToken(token string) error
- func (us *UserStorage) FetchUsers(filterString string, skip, limit int) ([]model.User, int, error)
- func (us *UserStorage) ImportJSON(data []byte) error
- func (us *UserStorage) RequestScopes(userID string, scopes []string) ([]string, error)
- func (us *UserStorage) ResetPassword(id, password string) error
- func (us *UserStorage) Scopes() []string
- func (us *UserStorage) UpdateLoginMetadata(userID string)
- func (us *UserStorage) UpdateUser(userID string, newUser model.User) (model.User, error)
- func (us *UserStorage) UserByEmail(email string) (model.User, error)
- func (us *UserStorage) UserByFederatedID(provider string, id string) (model.User, error)
- func (us *UserStorage) UserByID(id string) (model.User, error)
- func (us *UserStorage) UserByPhone(phone string) (model.User, error)
- func (us *UserStorage) UserBySocialID(id string) (model.User, error)
- func (us *UserStorage) UserByUsername(username string) (model.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUserStorage ¶
func NewUserStorage() (model.UserStorage, error)
NewUserStorage creates and inits in-memory user storage. Use it only for test purposes and in CI, all data is wiped on exit.
Types ¶
type UserStorage ¶
type UserStorage struct{}
UserStorage is an in-memory user storage .
func (*UserStorage) AddUserWithFederatedID ¶
func (us *UserStorage) AddUserWithFederatedID(user model.User, provider string, id, role string) (model.User, error)
AddUserWithFederatedID returns randomly generated user.
func (*UserStorage) AddUserWithPassword ¶
func (us *UserStorage) AddUserWithPassword(user model.User, password, role string, isAnonymous bool) (model.User, error)
AddUserWithPassword creates new user and saves it in the database.
func (*UserStorage) AllDeviceTokens ¶
func (us *UserStorage) AllDeviceTokens(userID string) ([]string, error)
TODO: implement get all device tokens logic
func (*UserStorage) AttachDeviceToken ¶
func (us *UserStorage) AttachDeviceToken(id, token string) error
AttachDeviceToken does nothing here.
func (*UserStorage) CheckPassword ¶
func (us *UserStorage) CheckPassword(id, password string) error
CheckPassword does nothig here.
func (*UserStorage) DeleteUser ¶
func (us *UserStorage) DeleteUser(id string) error
DeleteUser does nothing here.
func (*UserStorage) DetachDeviceToken ¶
func (us *UserStorage) DetachDeviceToken(token string) error
DetachDeviceToken does nothing here.
func (*UserStorage) FetchUsers ¶
FetchUsers returns randomly generated user enclosed in slice.
func (*UserStorage) ImportJSON ¶
func (us *UserStorage) ImportJSON(data []byte) error
ImportJSON imports data from JSON.
func (*UserStorage) RequestScopes ¶
func (us *UserStorage) RequestScopes(userID string, scopes []string) ([]string, error)
RequestScopes always returns requested scopes.
func (*UserStorage) ResetPassword ¶
func (us *UserStorage) ResetPassword(id, password string) error
ResetPassword does nothing here.
func (*UserStorage) Scopes ¶
func (us *UserStorage) Scopes() []string
Scopes returns supported scopes, could be static data of database.
func (*UserStorage) UpdateLoginMetadata ¶
func (us *UserStorage) UpdateLoginMetadata(userID string)
UpdateLoginMetadata does nothing here.
func (*UserStorage) UpdateUser ¶
UpdateUser returns what it receives.
func (*UserStorage) UserByEmail ¶
func (us *UserStorage) UserByEmail(email string) (model.User, error)
UserByEmail returns randomly generated user.
func (*UserStorage) UserByFederatedID ¶
UserByFederatedID returns randomly generated user.
func (*UserStorage) UserByID ¶
func (us *UserStorage) UserByID(id string) (model.User, error)
UserByID returns randomly generated user.
func (*UserStorage) UserByPhone ¶
func (us *UserStorage) UserByPhone(phone string) (model.User, error)
UserByPhone returns randomly generated user.
func (*UserStorage) UserBySocialID ¶
func (us *UserStorage) UserBySocialID(id string) (model.User, error)
UserBySocialID returns randomly generated user.
func (*UserStorage) UserByUsername ¶
func (us *UserStorage) UserByUsername(username string) (model.User, error)
UserByUsername returns randomly generated user.