31 lines
629 B
Go
31 lines
629 B
Go
package initialize
|
|
|
|
import (
|
|
"context"
|
|
"github.com/minio/minio-go/v7"
|
|
dalBS "penahub.gitlab.yandexcloud.net/backend/quiz/answerer/internal/dal"
|
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
|
|
)
|
|
|
|
type DALs struct {
|
|
PgDAL *dal.DAL
|
|
BlobStore *dalBS.Storer
|
|
}
|
|
|
|
func NewDALs(ctx context.Context, cfg Config, minioClient *minio.Client) (*DALs, error) {
|
|
pgDAL, err := dal.New(ctx, cfg.PostgresCredentials, minioClient)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
blobStore, err := dalBS.New(ctx, minioClient)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &DALs{
|
|
PgDAL: pgDAL,
|
|
BlobStore: blobStore,
|
|
}, nil
|
|
}
|