INNER CODE UNIT · Go
NewContext
honmaple/maple-file · server/internal/app/app.go:25
func NewContext(cfg *config.Config, log *logger.Logger, db *database.DB) (*Context, error) {
if cfg == nil {
return nil, errors.New("config is required")
}
if log == nil {
return nil, errors.New("logger is required")
}
if db == nil {
return nil, errors.New("database is required")
}
return &Context{Context: context.Background(), Config: cfg, Logger: log, DB: db}, nil
}