Documentation
¶
Index ¶
- Variables
- type APIErrorResponse
- type APIResponseLink
- type APIResponseNextLink
- type APIResponsePreviousLink
- type APIResponseSelfLink
- type Boat
- type BoatManeuver
- type Boats
- type BordeauxAPIResponse
- type BordeauxAPIResponseForecast
- type BordeauxAPIResponseForecastField
- type BordeauxAPIResponseParameters
- type ClosingReason
- type ClosingType
- type Forecast
- type ForecastMongoCountResponse
- type ForecastMongoResponse
- type ForecastRepository
- type ForecastResponse
- type ForecastUseCase
- type Forecasts
- type ForecastsResponse
- type HealthCheckRepository
- type HealthCheckUsecase
- type Sync
- type SyncRepository
- type SyncUseCase
- type SystemHealthNOK
- type SystemHealthOK
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ForecastCollection = os.Getenv("MONGO_FORECASTS_COLLECTION_NAME")
)
View Source
var (
SyncCollection = os.Getenv("MONGO_SYNCS_COLLECTION_NAME")
)
Functions ¶
This section is empty.
Types ¶
type APIErrorResponse ¶
type APIErrorResponse struct {
Error string `json:"error" example:"error in params"`
}
type APIResponseLink ¶
type APIResponseLink struct {
Link string `json:"href"`
}
type APIResponseNextLink ¶
type APIResponseNextLink struct {
Self APIResponseLink `json:"next"`
}
type APIResponsePreviousLink ¶
type APIResponsePreviousLink struct {
Self APIResponseLink `json:"previous"`
}
type APIResponseSelfLink ¶
type APIResponseSelfLink struct {
Self APIResponseLink `json:"self"`
}
type Boat ¶
type Boat struct {
Name string `json:"name" bson:"name" example:"EUROPA 2"`
Maneuver BoatManeuver `json:"maneuver" bson:"maneuver"`
CrossingDateApproximation time.Time `` /* 126-byte string literal not displayed */
}
type BoatManeuver ¶
type BoatManeuver string
const ( Leaving BoatManeuver = "leaving_bordeaux" Entering BoatManeuver = "entering_in_bordeaux" )
type BordeauxAPIResponse ¶
type BordeauxAPIResponse struct {
Hits int `json:"nhits"`
Parameters BordeauxAPIResponseParameters `json:"parameters"`
Records []BordeauxAPIResponseForecast `json:"records"`
}
type BordeauxAPIResponseForecast ¶
type BordeauxAPIResponseForecast struct {
DatasetID string `json:"datasetid"`
RecordID string `json:"recordid"`
Fields BordeauxAPIResponseForecastField `json:"fields"`
RecordTimestamp time.Time `json:"record_timestamp"`
}
type BordeauxAPIResponseForecastField ¶
type BordeauxAPIResponseForecastField struct {
ClosingDate string `json:"date_passage"`
ClosingTime string `json:"fermeture_a_la_circulation"`
OpeningTime string `json:"re_ouverture_a_la_circulation"`
TotalClosing string `json:"fermeture_totale"`
Boat string `json:"bateau"`
ClosingType string `json:"type_de_fermeture"`
}
type ClosingReason ¶
type ClosingReason string
const ( BoatReason ClosingReason = "boat" Maintenance ClosingReason = "maintenance" WineFestivalBoats ClosingReason = "wine_festival_boats" SpecialEvent ClosingReason = "special_event" )
type ClosingType ¶
type ClosingType string
const ( TwoWay ClosingType = "two_way" OneWay ClosingType = "one_way" )
type Forecast ¶
type Forecast struct {
ID string `json:"id" bson:"_id" example:"63a6430fc07ff1d895c9555ef2ef6e41c1e3b1f5"`
ClosingType ClosingType `json:"closing_type" bson:"closing_type"`
ClosingDuration time.Duration `` /* 152-byte string literal not displayed */
CirculationClosingDate time.Time `` /* 171-byte string literal not displayed */
CirculationReopeningDate time.Time `` /* 171-byte string literal not displayed */
ClosingReason ClosingReason `json:"closing_reason" bson:"closing_reason"`
Boats Boats `json:"boats,omitempty" bson:"boats,omitempty"`
Link APIResponseSelfLink `` /* 192-byte string literal not displayed */
SpecialEventName string `` /* 193-byte string literal not displayed */
}
func (*Forecast) ChangeLocation ¶
type ForecastMongoCountResponse ¶
type ForecastMongoCountResponse struct {
ItemCount int `json:"itemCount" bson:"itemCount"`
}
type ForecastMongoResponse ¶
type ForecastMongoResponse struct {
Results Forecasts `json:"results" bson:"results"`
Count []ForecastMongoCountResponse `json:"count" bson:"count"`
}
type ForecastRepository ¶
type ForecastRepository interface {
GetByID(ctx context.Context, id string, forecast *Forecast) error
GetAllBetweenTwoDates(
ctx context.Context,
offset int,
limit int,
from time.Time,
to time.Time,
forecasts *Forecasts,
totalItemCount *int,
) error
GetAllFiltered(
ctx context.Context,
offset int,
limit int,
from time.Time,
reason string,
maneuver string,
boat string,
forecasts *Forecasts,
totalItemCount *int,
) error
DeleteAll(ctx context.Context) (int64, error)
InsertAll(ctx context.Context, forecasts Forecasts) (int, error)
GetNextForecast(
ctx context.Context,
forecast *Forecast,
now time.Time,
) error
GetCurrentForecast(
ctx context.Context,
forecast *Forecast,
) error
}
type ForecastResponse ¶
type ForecastUseCase ¶
type ForecastUseCase interface {
GetByID(
ctx context.Context,
id string,
forecast *Forecast,
location *time.Location,
) errors.CustomError
GetCurrentForecast(
ctx context.Context,
forecast *Forecast,
location *time.Location,
) errors.CustomError
GetNextForecast(
ctx context.Context,
forecast *Forecast,
location *time.Location,
) errors.CustomError
GetTodayForecasts(
ctx context.Context,
forecasts *Forecasts,
offset int,
limit int,
location *time.Location,
totalItemCount *int,
) errors.CustomError
GetAllFiltered(
ctx context.Context,
location *time.Location,
offset int,
limit int,
from time.Time,
reason string,
maneuver string,
boat string,
forecasts *Forecasts,
totalItemCount *int,
) errors.CustomError
TryToSyncAll(ctx context.Context) (Sync, errors.CustomError)
ComputeBordeauxAPIResponse(
forecasts *Forecasts,
boredeauxAPIResponse BordeauxAPIResponse,
) errors.CustomError
SyncIsNeeded(ctx context.Context) bool
}
type ForecastsResponse ¶
type HealthCheckRepository ¶
type HealthCheckUsecase ¶
type HealthCheckUsecase interface {
GetHealth(ctx context.Context) errors.CustomError
}
type Sync ¶
type Sync struct {
ID primitive.ObjectID `json:"-" bson:"_id,omitempty"`
ItemCount int `json:"item_count" bson:"item_count" example:"10"`
Duration time.Duration `json:"duration_ms" bson:"duration_ms" example:"130" swaggertype:"primitive,integer"`
Timestamp time.Time `` /* 128-byte string literal not displayed */
}
type SyncRepository ¶
type SyncUseCase ¶
type SyncUseCase interface {
InsertOne(ctx context.Context, sync Sync) errors.CustomError
GetLast(ctx context.Context, sync *Sync) errors.CustomError
}
type SystemHealthNOK ¶
type SystemHealthNOK struct {
Error string `json:"error" example:"system is not running properly"`
}
type SystemHealthOK ¶
type SystemHealthOK struct {
Message string `json:"message" example:"system is running properly"`
}
Click to show internal directories.
Click to hide internal directories.