package models import ( "time" "gorm.io/gorm" ) type CPU struct { gorm.Model `json:"-"` ID uint `json:"id" gorm:"primary_key"` Time time.Time `json:"time" gorm:"autoCreateTime"` Name string `json:"name"` Socket int `json:"socket"` Cores int `json:"cores"` } type Memory struct { gorm.Model `json:"-"` ID uint `json:"id" gorm:"primary_key"` Time time.Time `json:"time" gorm:"autoCreateTime"` Type string `json:"type"` Total int `json:"total"` Used int `json:"used"` Usage float64 `json:"Usage"` } type Host struct { gorm.Model `json:"-"` ID uint `json:"id" gorm:"primary_key"` Hostname string `json:"hostname" gorm:"unique"` Cpus []CPU `json:"cpus" gorm:"foreignKey:ID"` Memory []Memory `json:"memory" gorm:"foreignKey:ID"` } type CreateHostInput struct { Hostname string `json:"hostname"` }