30 lines
573 B
Go
30 lines
573 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"next-terminal/server/model"
|
|
)
|
|
|
|
var LogoRepository = new(logoRepository)
|
|
|
|
type logoRepository struct {
|
|
baseRepository
|
|
}
|
|
|
|
func (r logoRepository) FindAll(c context.Context) (o []model.Logo) {
|
|
if r.GetDB(c).Find(&o).Error != nil {
|
|
return nil
|
|
}
|
|
return
|
|
}
|
|
|
|
func (r logoRepository) Create(c context.Context, o *model.Logo) (err error) {
|
|
err = r.GetDB(c).Create(o).Error
|
|
return
|
|
}
|
|
|
|
func (r logoRepository) DeleteByName(c context.Context, name string) error {
|
|
return r.GetDB(c).Where("name = ?", name).Delete(model.Logo{}).Error
|
|
}
|