Documentation ¶
Index ¶
- type UserModel
- func (m *UserModel) All() ([]models.User, error)
- func (m *UserModel) FindByEmail(email string) (*models.User, error)
- func (m *UserModel) FindById(id string) (*models.User, error)
- func (m *UserModel) FindByUsername(username string) (*models.User, error)
- func (m *UserModel) InsertUser(user *models.User) (*mongo.InsertOneResult, error)
- func (m *UserModel) UpdateUser(user *models.User) (*mongo.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserModel ¶
type UserModel struct {
C *mongo.Collection
}
UserModel wraps a mongo collection and provides methods to query it
func (*UserModel) FindByEmail ¶
FindByEmail finds a user by email
func (*UserModel) FindByUsername ¶
FindByUsername finds a user by username
func (*UserModel) InsertUser ¶
InsertUser inserts a new user to the database
func (*UserModel) UpdateUser ¶
UpdateUser updates the user with the given id when posts, comments or subscribes are added/removed/updated
Click to show internal directories.
Click to hide internal directories.