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