cml04-plb018/internal/types/zebra.go

29 lines
456 B
Go
Raw Permalink Normal View History

2024-08-20 15:50:52 +02:00
package types
import (
"time"
"gorm.io/gorm"
)
type Zebra struct {
ID string `gorm:"primarykey"`
Address string
Port int
Enabled bool
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
func (z *Zebra) BeforeCreate(tx *gorm.DB) (err error) {
z.CreatedAt = time.Now()
z.UpdatedAt = time.Now()
return
}
func (z *Zebra) BeforeUpdate(tx *gorm.DB) (err error) {
z.UpdatedAt = time.Now()
return
}