This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/graph/model/models_db.go

37 lines
625 B
Go
Raw Normal View History

2021-02-03 03:55:35 +00:00
package model
import (
2021-02-04 10:16:13 +00:00
"github.com/google/uuid"
"gorm.io/gorm"
2021-02-03 03:55:35 +00:00
)
func (u *User) BeforeCreate(tx *gorm.DB) (err error) {
2021-02-04 10:16:13 +00:00
newID := uuid.New().String()
u.ID = newID
return
2021-02-03 03:55:35 +00:00
}
func (a *Album) BeforeCreate(tx *gorm.DB) (err error) {
2021-02-04 10:16:13 +00:00
newID := uuid.New().String()
a.ID = newID
return
2021-02-03 03:55:35 +00:00
}
func (m *MediaItem) BeforeCreate(tx *gorm.DB) (err error) {
2021-02-04 10:16:13 +00:00
newID := uuid.New().String()
m.ID = newID
return
2021-02-03 03:55:35 +00:00
}
func (t *Tag) BeforeCreate(tx *gorm.DB) (err error) {
2021-02-04 10:16:13 +00:00
newID := uuid.New().String()
t.ID = newID
return
2021-02-03 03:55:35 +00:00
}
func (d *Device) BeforeCreate(tx *gorm.DB) (err error) {
2021-02-04 10:16:13 +00:00
newID := uuid.New().String()
d.ID = newID
return
2021-02-03 03:55:35 +00:00
}