1package types
 2
 3import (
 4	"net/mail"
 5	"time"
 6)
 7
 8// User is a user database model.
 9type User struct {
10	ID        int
11	Name      string
12	Login     *string
13	Email     *string
14	Password  *string
15	Admin     bool
16	CreatedAt *time.Time
17	UpdatedAt *time.Time
18}
19
20// Address returns the email address of the user.
21func (u *User) Address() *mail.Address {
22	if u.Email == nil {
23		return nil
24	}
25	return &mail.Address{
26		Name:    u.Name,
27		Address: *u.Email,
28	}
29}
30
31// String returns the name of the user.
32func (u *User) String() string {
33	return u.Name
34}