Documentation ¶
Index ¶
- type DB
- type MongoDB
- func (mdb *MongoDB) AddToBlackList(blacklist *models.Blacklist) error
- func (mdb *MongoDB) CreateUser(user *models.User) (*models.User, error)
- func (mdb *MongoDB) FindAllUsersExcept(except string) ([]models.User, error)
- func (mdb *MongoDB) FindUserByEmail(email string) (*models.User, error)
- func (mdb MongoDB) FindUserByPhone(phone string) (*models.User, error)
- func (mdb *MongoDB) FindUserByUsername(username string) (*models.User, error)
- func (mdb *MongoDB) Init()
- func (mdb *MongoDB) TokenInBlacklist(token *string) bool
- func (mdb *MongoDB) UpdateUser(user *models.User) error
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { CreateUser(user *models.User) (*models.User, error) FindUserByUsername(username string) (*models.User, error) FindUserByEmail(email string) (*models.User, error) UpdateUser(user *models.User) error AddToBlackList(blacklist *models.Blacklist) error TokenInBlacklist(token *string) bool FindUserByPhone(phone string) (*models.User, error) FindAllUsersExcept(except string) ([]models.User, error) }
DB provides access to the different db
type MongoDB ¶
MongoDB implements the DB interface
func (*MongoDB) AddToBlackList ¶
AddToBlackList puts blacklist into the blacklist collection
func (*MongoDB) CreateUser ¶
CreateUser creates a new user in the DB
func (*MongoDB) FindAllUsersExcept ¶
FindAllUsersExcept returns all the users expcept the one specified in the except parameter
func (*MongoDB) FindUserByEmail ¶
FindUserByEmail finds a user by email
func (MongoDB) FindUserByPhone ¶
FindUserByPhone finds a user by the phone
func (*MongoDB) FindUserByUsername ¶
FindUserByUsername finds a user by the username
func (*MongoDB) TokenInBlacklist ¶
TokenInBlacklist checks if token is already in the blacklist collection
type ValidationError ¶
ValidationError defines error that occur due to validation
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.