fix model validation and preloading

This commit is contained in:
Ben
2021-07-28 23:16:13 +02:00
parent 79bd7fed9c
commit 8ae1f7edcf
4 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ import (
type Host struct {
gorm.Model
Hostname string `gorm:"unique_index:idx_host_domain;not null" form:"hostname" validate:"required,hostname"`
Domain string `gorm:"unique_index:idx_host_domain;not null" validate:"required,hostname"`
Domain string `gorm:"unique_index:idx_host_domain;not null" form:"domain" validate:"required,hostname"`
Ip string `form:"ip" validate:"omitempty,ipv4"`
Ttl int `form:"ttl" validate:"required,min=20,max=86400"`
LastUpdate time.Time `form:"lastupdate"`