craban/server/model/user.go
Miguel de la Cruz ca0bfa2398 Rename to craban
2021-09-12 18:57:42 +02:00

33 lines
477 B
Go

package model
import (
"fmt"
)
type User struct {
ID int
Name string
Mail string
Username string
Password string
}
func (u *User) IsValid() error {
if u.Name == "" {
return fmt.Errorf("name must not be empty")
}
if u.Mail == "" {
return fmt.Errorf("mail must not be empty")
}
if u.Username == "" {
return fmt.Errorf("username must not be empty")
}
if u.Password == "" {
return fmt.Errorf("password must not be empty")
}
return nil
}