Documentation
¶
Index ¶
- type TemperatureDTO
- type WeatherDTO
- type WeatherService
- type WeatherServiceMock
- type WeatherServiceQuery
- type WeatherServiceQueryMock
- func (mock *WeatherServiceQueryMock) Aggr(res string) WeatherServiceQuery
- func (mock *WeatherServiceQueryMock) AggrCalls() []struct{ ... }
- func (mock *WeatherServiceQueryMock) BetweenTimes(from time.Time, to time.Time) WeatherServiceQuery
- func (mock *WeatherServiceQueryMock) BetweenTimesCalls() []struct{ ... }
- func (mock *WeatherServiceQueryMock) Get(ctx context.Context) ([]domain.Weather, error)
- func (mock *WeatherServiceQueryMock) GetByID(ctx context.Context) (domain.Weather, error)
- func (mock *WeatherServiceQueryMock) GetByIDCalls() []struct{ ... }
- func (mock *WeatherServiceQueryMock) GetCalls() []struct{ ... }
- func (mock *WeatherServiceQueryMock) ID(id string) WeatherServiceQuery
- func (mock *WeatherServiceQueryMock) IDCalls() []struct{ ... }
- func (mock *WeatherServiceQueryMock) NearPoint(distance int64, lat float64, lon float64) WeatherServiceQuery
- func (mock *WeatherServiceQueryMock) NearPointCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TemperatureDTO ¶
type WeatherDTO ¶
type WeatherDTO struct { ID string DateObserved *string Temperature *float64 Location *struct { Lat float64 Lon float64 } Temperatures []TemperatureDTO }
func NewDTO ¶
func NewDTO(id string) WeatherDTO
type WeatherService ¶
type WeatherService interface {
Query() WeatherServiceQuery
}
func NewWeatherService ¶
func NewWeatherService(ctx context.Context, contextBrokerURL string, contextBrokerTenant string) WeatherService
type WeatherServiceMock ¶
type WeatherServiceMock struct { // QueryFunc mocks the Query method. QueryFunc func() WeatherServiceQuery // contains filtered or unexported fields }
WeatherServiceMock is a mock implementation of WeatherService.
func TestSomethingThatUsesWeatherService(t *testing.T) { // make and configure a mocked WeatherService mockedWeatherService := &WeatherServiceMock{ QueryFunc: func() WeatherServiceQuery { panic("mock out the Query method") }, } // use mockedWeatherService in code that requires WeatherService // and then make assertions. }
func (*WeatherServiceMock) Query ¶
func (mock *WeatherServiceMock) Query() WeatherServiceQuery
Query calls QueryFunc.
func (*WeatherServiceMock) QueryCalls ¶
func (mock *WeatherServiceMock) QueryCalls() []struct { }
QueryCalls gets all the calls that were made to Query. Check the length with:
len(mockedWeatherService.QueryCalls())
type WeatherServiceQuery ¶
type WeatherServiceQuery interface { BetweenTimes(from, to time.Time) WeatherServiceQuery NearPoint(distance int64, lat, lon float64) WeatherServiceQuery ID(id string) WeatherServiceQuery Aggr(res string) WeatherServiceQuery Get(ctx context.Context) ([]domain.Weather, error) GetByID(ctx context.Context) (domain.Weather, error) }
type WeatherServiceQueryMock ¶
type WeatherServiceQueryMock struct { // AggrFunc mocks the Aggr method. AggrFunc func(res string) WeatherServiceQuery // BetweenTimesFunc mocks the BetweenTimes method. BetweenTimesFunc func(from time.Time, to time.Time) WeatherServiceQuery // GetFunc mocks the Get method. GetFunc func(ctx context.Context) ([]domain.Weather, error) // GetByIDFunc mocks the GetByID method. GetByIDFunc func(ctx context.Context) (domain.Weather, error) // IDFunc mocks the ID method. IDFunc func(id string) WeatherServiceQuery // NearPointFunc mocks the NearPoint method. NearPointFunc func(distance int64, lat float64, lon float64) WeatherServiceQuery // contains filtered or unexported fields }
WeatherServiceQueryMock is a mock implementation of WeatherServiceQuery.
func TestSomethingThatUsesWeatherServiceQuery(t *testing.T) { // make and configure a mocked WeatherServiceQuery mockedWeatherServiceQuery := &WeatherServiceQueryMock{ AggrFunc: func(res string) WeatherServiceQuery { panic("mock out the Aggr method") }, BetweenTimesFunc: func(from time.Time, to time.Time) WeatherServiceQuery { panic("mock out the BetweenTimes method") }, GetFunc: func(ctx context.Context) ([]domain.Weather, error) { panic("mock out the Get method") }, GetByIDFunc: func(ctx context.Context) (domain.Weather, error) { panic("mock out the GetByID method") }, IDFunc: func(id string) WeatherServiceQuery { panic("mock out the ID method") }, NearPointFunc: func(distance int64, lat float64, lon float64) WeatherServiceQuery { panic("mock out the NearPoint method") }, } // use mockedWeatherServiceQuery in code that requires WeatherServiceQuery // and then make assertions. }
func (*WeatherServiceQueryMock) Aggr ¶
func (mock *WeatherServiceQueryMock) Aggr(res string) WeatherServiceQuery
Aggr calls AggrFunc.
func (*WeatherServiceQueryMock) AggrCalls ¶
func (mock *WeatherServiceQueryMock) AggrCalls() []struct { Res string }
AggrCalls gets all the calls that were made to Aggr. Check the length with:
len(mockedWeatherServiceQuery.AggrCalls())
func (*WeatherServiceQueryMock) BetweenTimes ¶
func (mock *WeatherServiceQueryMock) BetweenTimes(from time.Time, to time.Time) WeatherServiceQuery
BetweenTimes calls BetweenTimesFunc.
func (*WeatherServiceQueryMock) BetweenTimesCalls ¶
func (mock *WeatherServiceQueryMock) BetweenTimesCalls() []struct { From time.Time To time.Time }
BetweenTimesCalls gets all the calls that were made to BetweenTimes. Check the length with:
len(mockedWeatherServiceQuery.BetweenTimesCalls())
func (*WeatherServiceQueryMock) GetByIDCalls ¶
func (mock *WeatherServiceQueryMock) GetByIDCalls() []struct { Ctx context.Context }
GetByIDCalls gets all the calls that were made to GetByID. Check the length with:
len(mockedWeatherServiceQuery.GetByIDCalls())
func (*WeatherServiceQueryMock) GetCalls ¶
func (mock *WeatherServiceQueryMock) GetCalls() []struct { Ctx context.Context }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedWeatherServiceQuery.GetCalls())
func (*WeatherServiceQueryMock) ID ¶
func (mock *WeatherServiceQueryMock) ID(id string) WeatherServiceQuery
ID calls IDFunc.
func (*WeatherServiceQueryMock) IDCalls ¶
func (mock *WeatherServiceQueryMock) IDCalls() []struct { ID string }
IDCalls gets all the calls that were made to ID. Check the length with:
len(mockedWeatherServiceQuery.IDCalls())
func (*WeatherServiceQueryMock) NearPoint ¶
func (mock *WeatherServiceQueryMock) NearPoint(distance int64, lat float64, lon float64) WeatherServiceQuery
NearPoint calls NearPointFunc.
func (*WeatherServiceQueryMock) NearPointCalls ¶
func (mock *WeatherServiceQueryMock) NearPointCalls() []struct { Distance int64 Lat float64 Lon float64 }
NearPointCalls gets all the calls that were made to NearPoint. Check the length with:
len(mockedWeatherServiceQuery.NearPointCalls())