weather

package
v0.0.0-...-61e9378 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TemperatureDTO

type TemperatureDTO struct {
	DateObserved *time.Time
	Temperature  *float64
	Max          *float64
	Min          *float64
	From         *time.Time
	To           *time.Time
}

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

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

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) Get

Get calls GetFunc.

func (*WeatherServiceQueryMock) GetByID

GetByID calls GetByIDFunc.

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

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())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL