29 lines
486 B
Go
29 lines
486 B
Go
|
package initialize
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
|
||
|
)
|
||
|
|
||
|
type DALs struct {
|
||
|
PgDAL *dal.DAL
|
||
|
ChDAL *dal.ClickHouseDAL
|
||
|
}
|
||
|
|
||
|
func NewDALs(ctx context.Context, cfg Config) (*DALs, error) {
|
||
|
pgDal, err := dal.New(ctx, cfg.PostgresCredentials, nil)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
chDal, err := dal.NewClickHouseDAL(ctx, cfg.ClickHouseCred)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return &DALs{
|
||
|
PgDAL: pgDal,
|
||
|
ChDAL: chDal,
|
||
|
}, nil
|
||
|
}
|