Add implemetation for db.UserIdentifiable for type in db package

This commit is contained in:
qowevisa 2024-10-31 11:11:39 +02:00
parent 7d1ca772c0
commit 020a5e6e40

View File

@ -15,6 +15,21 @@ type Type struct {
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 (
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")
@ -36,7 +51,3 @@ func (t *Type) BeforeSave(tx *gorm.DB) error {
return nil
}
func (t *Type) GetID() uint {
return t.ID
}