1234567891011121314151617181920212223242526272829303132 |
- // package fabrics -- грязная фабрика объектов
- package fabrics
- import (
- "fmt"
- "log"
- "adt/intertnal/serv_http"
- "adt/intertnal/serv_process"
- "adt/intertnal/service"
- "adt/intertnal/store_ram"
- "adt/pkg/types"
- )
- // MakeService -- возвращает новый объект сервиса
- func MakeService() (types.IService, error) {
- log.Println("MakeService()")
- store := store_ram.NewStoreRam()
- servProcess, err := serv_process.NewServProcess(store)
- if err != nil {
- return nil, fmt.Errorf("MakeService(): in create ServProcess, err=\n\t%w", err)
- }
- servHttp, err := serv_http.NewServHttp(servProcess)
- if err != nil {
- return nil, fmt.Errorf("MakeService(): in create ServHttp, err=\n\t%w", err)
- }
- sf, err := service.NewService(store, servHttp)
- if err != nil {
- return nil, fmt.Errorf("MakeService(): in service.NewService, err=\n\t%w", err)
- }
- return sf, nil
- }
|