1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2025-12-17 09:37:02 +00:00

Implement some parts for loading data from a directory

This commit is contained in:
teru
2016-07-31 10:06:30 +09:00
parent d5d735e559
commit 7cac94f0f3
10 changed files with 853 additions and 0 deletions

38
user.go Normal file
View File

@@ -0,0 +1,38 @@
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
}