1package model 2 3import "time" 4 5type User struct { 6 ID string `json:"id" orm:"column(id)"` 7 UserName string `json:"userName"` 8 Name string `json:"name"` 9 Email string `json:"email"` 10 Password string `json:"password"` 11 IsAdmin bool `json:"isAdmin"` 12 LastLoginAt *time.Time `json:"lastLoginAt"` 13 LastAccessAt *time.Time `json:"lastAccessAt"` 14 CreatedAt time.Time `json:"createdAt"` 15 UpdatedAt time.Time `json:"updatedAt"` 16 // TODO ChangePassword string `json:"password"` 17} 18 19type Users []User 20 21type UserRepository interface { 22 CountAll(...QueryOptions) (int64, error) 23 Get(id string) (*User, error) 24 Put(*User) error 25 FindFirstAdmin() (*User, error) 26 // FindByUsername must be case-insensitive 27 FindByUsername(username string) (*User, error) 28 UpdateLastLoginAt(id string) error 29 UpdateLastAccessAt(id string) error 30} 31