mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Changes to model's tags:
For multiple tag strings use __single space__ as separator according to the ```reflect``` package. Commas will __NOT__ work. That way the tags can be ordered arbitrarily.
This commit is contained in:
parent
a1b8d93263
commit
61ccdb00c6
1 changed files with 7 additions and 7 deletions
|
@ -10,25 +10,25 @@ import (
|
|||
// The type Model is exactly the same with gorm.Model (see jinzhu/gorm)
|
||||
// except the json tags that are needed for serializing the models
|
||||
type Model struct {
|
||||
ID uint `json:"id",gorm:"primary_key"`
|
||||
ID uint `json:"id" gorm:"primary_key:true"`
|
||||
CreatedAt time.Time `json:"-"`
|
||||
UpdatedAt time.Time `json:"-"`
|
||||
DeletedAt *time.Time `json:"-",sql:"index"`
|
||||
DeletedAt *time.Time `json:"-" sql:"index"`
|
||||
}
|
||||
|
||||
// User data model
|
||||
type User struct {
|
||||
Model
|
||||
// Username of user
|
||||
Username string `json:"username",gorm:"unique;not null"`
|
||||
Username string `json:"username" gorm:"unique;not null"`
|
||||
// Password of user
|
||||
Password string `json:"-",gorm:"not null"`
|
||||
Password string `json:"-" gorm:"not null"`
|
||||
// Mail of user
|
||||
Mail string `json:"mail",gorm:"default:''"`
|
||||
Mail string `json:"mail" gorm:"default:''"`
|
||||
// Role of user
|
||||
Role string `json:"role",gorm:"default:'user'"`
|
||||
Role string `json:"role" gorm:"default:'user'"`
|
||||
// Scenarios to which user has access
|
||||
Scenarios []*Scenario `json:"-",gorm:"many2many:user_scenarios"`
|
||||
Scenarios []*Scenario `json:"-" gorm:"many2many:user_scenarios"`
|
||||
}
|
||||
|
||||
// Scenario data model
|
||||
|
|
Loading…
Add table
Reference in a new issue