Formating using Gofmt with local tab=4*stops

This commit is contained in:
smavros 2019-04-05 00:22:08 +02:00
parent 608e772c9b
commit ae0f729a55
2 changed files with 79 additions and 79 deletions

View file

@ -26,27 +26,27 @@ func StartDB() {
db.AutoMigrate(&Simulator{})
db.AutoMigrate(&Signal{})
db.AutoMigrate(&SimulationModel{})
//db.AutoMigrate(&File{})
db.AutoMigrate(&File{})
db.AutoMigrate(&Project{})
db.AutoMigrate(&Simulation{})
//db.AutoMigrate(&User{})
db.AutoMigrate(&User{})
db.AutoMigrate(&Visualization{})
db.AutoMigrate(&Signal{})
db.AutoMigrate(&Widget{})
// Create
db.Create(&Simulator{UUID: "12"})
db.Create(&Signal{Name:"Some", Unit:"314"})
fooSimMod := SimulationModel{Name:"buz",
InputMapping: []Signal {
{Name:"foo", Unit:"42"},
{Name:"buz", Unit:"511"},
db.Create(&Signal{Name: "Some", Unit: "314"})
fooSimMod := SimulationModel{Name: "buz",
InputMapping: []Signal{
{Name: "foo", Unit: "42"},
{Name: "buz", Unit: "511"},
},
}
db.Create(&fooSimMod)
// get number of associations from SimulationModel table InputMapping column
fmt.Println( "Number of associations of InputMapping: ",
fmt.Println("Number of associations of InputMapping: ",
db.Model(&fooSimMod).Association("InputMapping").Count())
// get the associations from SimulationModel table InputMapping column

View file

@ -24,8 +24,8 @@ type File struct {
Path string `gorm:"not null"`
Type string `gorm:"not null"`
Size uint `gorm:"not null"`
ImageHeight uint //only required in case file is an image
ImageWidth uint //only required in case file is an image
ImageHeight uint // only required in case file is an image
ImageWidth uint // only required in case file is an image
User User `gorm:"not null"`
UserID uint `gorm:"not null"`
Date time.Time
@ -36,20 +36,20 @@ type Project struct {
Name string `gorm:"not null"`
User User `gorm:"not null"`
UserID uint `gorm:"not null"`
Visualizations []Visualization
Simulation Simulation `gorm:"not null"`
SimulationID uint `gorm:"not null"`
Visualizations []Visualization
}
type Simulation struct {
gorm.Model
Name string `gorm:"not null"`
Running bool `gorm:"default:false"`
Models []SimulationModel `gorm:"foreignkey:BelongsToSimulationID"`
Projects []Project
User User `gorm:"not null"`
UserID uint `gorm:"not null"`
StartParameters postgres.Jsonb // TODO default value
Models []SimulationModel `gorm:"foreignkey:BelongsToSimulationID"`
Projects []Project
}
type SimulationModel struct {
@ -57,8 +57,8 @@ type SimulationModel struct {
Name string `gorm:"not null"`
OutputLength int `gorm:"default:1"`
InputLength int `gorm:"default:1"`
OutputMapping []Signal //order of signals is important
InputMapping []Signal //order of signals is important
OutputMapping []Signal // order of signals is important
InputMapping []Signal // order of signals is important
StartParameters postgres.Jsonb // TODO: default value?
BelongsToSimulation Simulation `gorm:"not null"`
BelongsToSimulationID uint `gorm:"not null"`
@ -70,7 +70,7 @@ type User struct {
gorm.Model
Username string `gorm:"unique;not null"`
Password string `gorm:"not null"`
Mail string `gorm:"default:"`
Mail string `gorm:"default:''"`
Role string `gorm:"default:'user'"`
Projects []Project
Simulations []Simulation
@ -82,10 +82,10 @@ type Visualization struct {
Name string `gorm:"not null"`
Project Project `gorm:"not null"`
ProjectID uint `gorm:"not null"`
Widgets []Widget
Grid int `gorm:"default:15"`
VisualizationUser User `gorm:"not null"`
VisualizationUserID uint `gorm:"not null"`
Widgets []Widget
}
type Signal struct {
@ -108,6 +108,6 @@ type Widget struct {
Y int `gorm:"not null"`
Z int `gorm:"not null"`
IsLocked bool `gorm:"default:false"`
CustomProperties postgres.Jsonb //TODO: default value?
CustomProperties postgres.Jsonb // TODO: default value?
VisualizationID uint
}