29 lines
446 B
Go
29 lines
446 B
Go
package initialize
|
|
|
|
import (
|
|
"context"
|
|
"gitea.pena/SQuiz/common/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.PostgresURL, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
chDal, err := dal.NewClickHouseDAL(ctx, cfg.ClickhouseURL)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &DALs{
|
|
PgDAL: pgDal,
|
|
ChDAL: chDal,
|
|
}, nil
|
|
}
|