mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-22 14:25:45 +00:00
31 lines
728 B
Go
31 lines
728 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 UserRepository interface {
|
|
repository.BaseRepository[entity.User]
|
|
IdExists(ctx context.Context, id uint) (bool, error)
|
|
}
|
|
|
|
type UserRepositoryImpl struct {
|
|
*repository.BaseRepositoryImpl[entity.User]
|
|
db *gorm.DB
|
|
}
|
|
|
|
func NewUserRepository(db *gorm.DB) UserRepository {
|
|
return &UserRepositoryImpl{
|
|
BaseRepositoryImpl: repository.NewBaseRepository[entity.User](db),
|
|
db: db,
|
|
}
|
|
}
|
|
|
|
func (r *UserRepositoryImpl) IdExists(ctx context.Context, id uint) (bool, error) {
|
|
return repository.Exists[entity.User](ctx, r.db, id)
|
|
}
|