mirror of
https://github.com/directorz/mailfull-go.git
synced 2025-12-18 10:07:03 +00:00
39 lines
711 B
Go
39 lines
711 B
Go
package mailfull
|
|
|
|
// User represents a User.
|
|
type User struct {
|
|
name string
|
|
hashedPassword string
|
|
forwards []string
|
|
}
|
|
|
|
// NewUser creates a new User instance.
|
|
func NewUser(name, hashedPassword string, forwards []string) (*User, error) {
|
|
if !validUserName(name) {
|
|
return nil, ErrInvalidUserName
|
|
}
|
|
|
|
u := &User{
|
|
name: name,
|
|
hashedPassword: hashedPassword,
|
|
forwards: forwards,
|
|
}
|
|
|
|
return u, nil
|
|
}
|
|
|
|
// Name returns name.
|
|
func (u *User) Name() string {
|
|
return u.name
|
|
}
|
|
|
|
// HashedPassword returns hashedPassword.
|
|
func (u *User) HashedPassword() string {
|
|
return u.hashedPassword
|
|
}
|
|
|
|
// Forwards returns forwards.
|
|
func (u *User) Forwards() []string {
|
|
return u.forwards
|
|
}
|