Documentation ¶
Index ¶
- Variables
- func CreateUser(d mongo.Database, u *User) (err error)
- func IsErrNameCharsNotAllowed(err error) bool
- func IsErrNamePatternNotAllowed(err error) bool
- func IsErrNameReserved(err error) bool
- func IsErrUserAlreadyExist(err error) bool
- func IsUsableUsername(name string) error
- type ErrNameCharsNotAllowed
- type ErrNamePatternNotAllowed
- type ErrNameReserved
- type ErrUserAlreadyExist
- type User
- type UserList
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNameEmpty = errors.New("Name is empty")
)
View Source
var (
ErrUserNameIllegal = errors.New("User name contains illegal characters")
)
Functions ¶
func CreateUser ¶
CreateUser creates record of a new user.
func IsErrNameCharsNotAllowed ¶
IsErrNameCharsNotAllowed checks if an error is an ErrNameCharsNotAllowed.
func IsErrNameReserved ¶
IsErrNameReserved checks if an error is a ErrNameReserved.
func IsErrUserAlreadyExist ¶
IsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.
func IsUsableUsername ¶
Types ¶
type ErrNameCharsNotAllowed ¶
type ErrNameCharsNotAllowed struct {
Name string
}
func (ErrNameCharsNotAllowed) Error ¶
func (err ErrNameCharsNotAllowed) Error() string
type ErrNamePatternNotAllowed ¶
type ErrNamePatternNotAllowed struct {
Pattern string
}
func (ErrNamePatternNotAllowed) Error ¶
func (err ErrNamePatternNotAllowed) Error() string
type ErrNameReserved ¶
type ErrNameReserved struct {
Name string
}
func (ErrNameReserved) Error ¶
func (err ErrNameReserved) Error() string
type ErrUserAlreadyExist ¶
type ErrUserAlreadyExist struct {
Name string
}
func (ErrUserAlreadyExist) Error ¶
func (err ErrUserAlreadyExist) Error() string
type User ¶
type User struct { ID primitive.ObjectID `bson:"_id"` Username string `bson:"username"` Password string `bson:"password"` Email string `bson:"email"` FirstName string `bson:"firstName"` LastName string `bson:"lastName"` LastLogin time.Time `bson:"lastLogin"` }
User represents a user in the database
func (*User) HashPassword ¶
func (*User) SetLastLogin ¶
func (u *User) SetLastLogin()
func (*User) ValidatePassword ¶
Click to show internal directories.
Click to hide internal directories.