Add implemetation for db.UserIdentifiable for type in db package
This commit is contained in:
parent
7d1ca772c0
commit
020a5e6e40
19
db/type.go
19
db/type.go
|
@ -15,6 +15,21 @@ type Type struct {
|
||||||
User *User
|
User *User
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements db.UserIdentifiable:1
|
||||||
|
func (t Type) GetID() uint {
|
||||||
|
return t.ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements db.UserIdentifiable:2
|
||||||
|
func (t Type) GetUserID() uint {
|
||||||
|
return t.UserID
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implements db.UserIdentifiable:3
|
||||||
|
func (t *Type) SetUserID(id uint) {
|
||||||
|
t.UserID = id
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ERROR_TYPE_NAME_EMPTY = errors.New("The 'Name' field of 'Type' cannot be empty")
|
ERROR_TYPE_NAME_EMPTY = errors.New("The 'Name' field of 'Type' cannot be empty")
|
||||||
ERROR_TYPE_NAME_NOT_UNIQUE = errors.New("The 'Name' field of 'Type' have to be unique for user")
|
ERROR_TYPE_NAME_NOT_UNIQUE = errors.New("The 'Name' field of 'Type' have to be unique for user")
|
||||||
|
@ -36,7 +51,3 @@ func (t *Type) BeforeSave(tx *gorm.DB) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Type) GetID() uint {
|
|
||||||
return t.ID
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user