linstrom/storage/emote.go

26 lines
512 B
Go
Raw Permalink Normal View History

package storage
import "gorm.io/gorm"
type Emote struct {
gorm.Model
// Metadata MediaMetadata // `gorm:"foreignKey:MetadataId"`
MetadataId string
Name string
// Server RemoteServer // `gorm:"foreignKey:ServerId;references:ID"`
2024-11-18 11:18:57 +00:00
ServerId uint
}
func (s *Storage) GetEmoteById(id uint) (*Emote, error) {
out := Emote{}
err := s.db.First(&out, id).Error
switch err {
case nil:
return &out, nil
case gorm.ErrRecordNotFound:
return nil, ErrEntryNotFound
default:
return nil, err
}
}