make an interface for State object

This commit is contained in:
Sam Lewis
2023-10-22 18:16:20 -04:00
parent 824d6c12d1
commit 1932f1edf7
8 changed files with 30 additions and 30 deletions

6
app.go
View File

@@ -29,7 +29,7 @@ type App struct {
httpClient *http.HttpClient
service *Service
state *State
state *StateImpl
schedules pq.PriorityQueue
intervals pq.PriorityQueue
@@ -192,7 +192,7 @@ func (a *App) RegisterEventListeners(evls ...EventListener) {
}
}
func getSunriseSunset(s *State, sunrise bool, dateToUse carbon.Carbon, offset ...DurationString) carbon.Carbon {
func getSunriseSunset(s *StateImpl, sunrise bool, dateToUse carbon.Carbon, offset ...DurationString) carbon.Carbon {
date := dateToUse.Carbon2Time()
rise, set := sunriseLib.SunriseSunset(s.latitude, s.longitude, date.Year(), date.Month(), date.Day())
rise, set = rise.Local(), set.Local()
@@ -291,6 +291,6 @@ func (a *App) GetService() *Service {
return a.service
}
func (a *App) GetState() *State {
func (a *App) GetState() State {
return a.state
}