github.com/shoshinnikita/budget-manager@v0.7.1-0.20220131195411-8c46ff1c6778/internal/web/api/api.go (about)

     1  package api
     2  
     3  import "github.com/ShoshinNikita/budget-manager/internal/logger"
     4  
     5  type Handlers struct {
     6  	MonthsHandlers
     7  	IncomesHandlers
     8  	MonthlyPaymentsHandlers
     9  	SpendsHandlers
    10  	SpendTypesHandlers
    11  	SearchHandlers
    12  }
    13  
    14  type DB interface {
    15  	MonthsDB
    16  	IncomesDB
    17  	MonthlyPaymentsDB
    18  	SpendsDB
    19  	SpendTypesDB
    20  	SearchDB
    21  }
    22  
    23  func NewHandlers(db DB, log logger.Logger) *Handlers {
    24  	return &Handlers{
    25  		MonthsHandlers:          MonthsHandlers{db: db, log: log},
    26  		IncomesHandlers:         IncomesHandlers{db: db, log: log},
    27  		MonthlyPaymentsHandlers: MonthlyPaymentsHandlers{db: db, log: log},
    28  		SpendsHandlers:          SpendsHandlers{db: db, log: log},
    29  		SpendTypesHandlers:      SpendTypesHandlers{db: db, log: log},
    30  		SearchHandlers:          SearchHandlers{db: db, log: log},
    31  	}
    32  }