forked from baron/baron-sso
25 lines
587 B
Go
25 lines
587 B
Go
package repository
|
|
|
|
import (
|
|
"baron-sso-backend/internal/domain"
|
|
"context"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type GormFederationRepository struct {
|
|
db *gorm.DB
|
|
}
|
|
|
|
func NewGormFederationRepository(db *gorm.DB) *GormFederationRepository {
|
|
return &GormFederationRepository{db: db}
|
|
}
|
|
|
|
func (r *GormFederationRepository) FindProviderByID(ctx context.Context, providerID string) (*domain.IdentityProviderConfig, error) {
|
|
var provider domain.IdentityProviderConfig
|
|
if err := r.db.WithContext(ctx).First(&provider, "id = ?", providerID).Error; err != nil {
|
|
return nil, err
|
|
}
|
|
return &provider, nil
|
|
}
|