domains

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 struct {
	Link string `json:"href"`
}
type APIResponseNextLink struct {
	Self APIResponseLink `json:"next"`
}
type APIResponsePreviousLink struct {
	Self APIResponseLink `json:"previous"`
}
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 */
}

func (Boat) IsEqual

func (b Boat) IsEqual(other Boat) bool

type BoatManeuver

type BoatManeuver string
const (
	Leaving  BoatManeuver = "leaving_bordeaux"
	Entering BoatManeuver = "entering_in_bordeaux"
)

type Boats

type Boats []Boat

func (Boats) AreEqual

func (boats Boats) AreEqual(other Boats) bool

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 BordeauxAPIResponseParameters

type BordeauxAPIResponseParameters struct {
	Dataset  string   `json:"dataset"`
	Row      int      `json:"rows"`
	Start    int      `json:"start"`
	Sort     []string `json:"sort"`
	Format   string   `json:"format"`
	Timezone string   `json:"timezone"`
}

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

func (f *Forecast) ChangeLocation(location *time.Location)

func (*Forecast) IsEqual

func (f *Forecast) IsEqual(other Forecast) bool

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 ForecastResponse struct {
	Timezone string   `json:"timezone" example:"UTC"`
	Forecast Forecast `json:"forecast"`
}

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 Forecasts

type Forecasts []Forecast

func (*Forecasts) AreEqual

func (forecasts *Forecasts) AreEqual(other Forecasts) bool

func (*Forecasts) ChangeLocations

func (forecasts *Forecasts) ChangeLocations(location *time.Location)

type ForecastsResponse

type ForecastsResponse struct {
	Hits      int           `json:"hits"`
	Limit     int           `json:"limit"`
	Offset    int           `json:"offset"`
	Timezone  string        `json:"timezone"         example:"UTC"`
	Links     []interface{} `json:"_links,omitempty"`
	Forecasts Forecasts     `json:"forecasts"`
}

type HealthCheckRepository

type HealthCheckRepository interface {
	GetDBHealth(ctx context.Context) error
}

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 SyncRepository interface {
	InsertOne(ctx context.Context, sync Sync) error
	GetLast(ctx context.Context, sync *Sync) error
}

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"`
}

Jump to

Keyboard shortcuts

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