27 lines
355 B
Go
27 lines
355 B
Go
package user
|
|
|
|
type User struct {
|
|
Username string
|
|
Password string
|
|
Email *string
|
|
Role string
|
|
}
|
|
|
|
type NewUserParams struct {
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
func NewUser(params NewUserParams) User {
|
|
|
|
return User{
|
|
Username: params.Username,
|
|
Password: params.Password,
|
|
}
|
|
|
|
}
|
|
|
|
func (u *User) Is(role string) bool {
|
|
return role == u.Role
|
|
}
|