remove uuid
This commit is contained in:
14
db/base.go
14
db/base.go
@@ -2,9 +2,6 @@ package db
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/twinj/uuid"
|
||||
)
|
||||
|
||||
type CrudBase struct {
|
||||
@@ -22,14 +19,3 @@ type Base struct {
|
||||
IDBase
|
||||
CrudBase
|
||||
}
|
||||
|
||||
// BaseWithUUID is the base model with an UUIDv4 primary key
|
||||
type BaseWithUUID struct {
|
||||
IDBase
|
||||
CrudBase
|
||||
}
|
||||
|
||||
// BeforeCreate is called by GORM to set the UUID primary key
|
||||
func (b *BaseWithUUID) BeforeCreate(scope *gorm.Scope) error {
|
||||
return scope.SetColumn("ID", uuid.NewV4().String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user