Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Tables of SQL entities. Tables = []interface{}{ new(User), new(Role), new(Team), new(Absence), new(Reason), } // FKeys are foreign keys. FKeys = []database.FKey{ database.FKey{ Model: &User{}, Args: [...]string{"role", "roles(name)", "SET NULL", "NO ACTION"}, }, database.FKey{ Model: &Absence{}, Args: [...]string{"user_id", "users(id)", "CASCADE", "NO ACTION"}, }, database.FKey{ Model: &Absence{}, Args: [...]string{"reason_id", "reasons(id)", "CASCADE", "NO ACTION"}, }, } )
Functions ¶
This section is empty.
Types ¶
type Absence ¶
type Absence struct { Model UserID uint `json:"user"` ReasonID uint `json:"reason"` From time.Time `json:"from"` To time.Time `json:"to"` }
func NewAbsence ¶
type Model ¶
type Model struct {
ID uint `gorm:"primary_key" json:"id"`
}
Model is the base model for all data models.
type Reason ¶
type Team ¶
type User ¶
type User struct { Model Email string `json:"email" gorm:"not null;unique" validate:"email"` Password string `json:"-" gorm:"not null"` Role *string `json:"role"` Firstname *string `json:"firstname" validate:"min=1,max=25"` Lastname *string `json:"lastname" validate:"min=1,max=25"` TeamID *uint `json:"team"` }
func (*User) BeforeSave ¶
BeforeSave runs before insert or update.
Click to show internal directories.
Click to hide internal directories.