cml04-plb018/internal/types/zebra.go
albert 76e3bdcce1 wip2
2
2024-08-20 15:50:52 +02:00

29 lines
456 B
Go

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
}