mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-04-12 08:56:28 +00:00
19 lines
529 B
Go
19 lines
529 B
Go
package factory
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/emochka2007/block-accounting/internal/pkg/config"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/repository"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/repository/users"
|
|
)
|
|
|
|
func provideUsersRepository(c config.Config) (users.Repository, func(), error) {
|
|
db, close, err := repository.ProvideDatabaseConnection(c)
|
|
if err != nil {
|
|
return nil, func() {}, fmt.Errorf("error connect to database. %w", err)
|
|
}
|
|
|
|
return users.NewRepository(db), close, nil
|
|
}
|