mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
32 lines
794 B
Go
32 lines
794 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
entity "gitlab.com/mbugroup/lti-api.git/internal/entities"
|
|
|
|
"gitlab.com/mbugroup/lti-api.git/internal/common/repository"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type AreaRepository interface {
|
|
repository.BaseRepository[entity.Area]
|
|
NameExists(ctx context.Context, name string, excludeID *uint) (bool, error)
|
|
}
|
|
|
|
type AreaRepositoryImpl struct {
|
|
*repository.BaseRepositoryImpl[entity.Area]
|
|
db *gorm.DB
|
|
}
|
|
|
|
func NewAreaRepository(db *gorm.DB) AreaRepository {
|
|
return &AreaRepositoryImpl{
|
|
BaseRepositoryImpl: repository.NewBaseRepository[entity.Area](db),
|
|
db: db,
|
|
}
|
|
}
|
|
|
|
func (r *AreaRepositoryImpl) NameExists(ctx context.Context, name string, excludeID *uint) (bool, error) {
|
|
return repository.ExistsByName[entity.Area](ctx, r.db, name, excludeID)
|
|
}
|