Documentation ¶
Index ¶
- func GetVesselLastKnownPosition(db *sql.DB, imo string) ([]float64, error)
- func GetVesselRoute(db *sql.DB, mmsi string) ([][]float64, error)
- func GetVesselsByIMOs(db *sql.DB, imos []string) (map[string]Vessel, error)
- func InitDB() (*sql.DB, error)
- func InsertPositionReport(db *sql.DB, mmsi string, positionReport aisstream.PositionReport, ...) error
- func UpdateLocationCoordinates(db *sql.DB, unlocode string, latitude, longitude float64) error
- func UpdateTrackedVessels(db *sql.DB, mmsis []string) (int64, error)
- func UpsertLocations(db *sql.DB, locations []models.MaerskLocation) error
- func UpsertVessel(db *sql.DB, vessel Vessel) error
- type Location
- type OceanProduct
- type TransportLeg
- type Vessel
- type VesselPosition
- type VesselRoute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertPositionReport ¶
func InsertPositionReport(db *sql.DB, mmsi string, positionReport aisstream.PositionReport, timestamp models.CustomTime) error
id SERIAL PRIMARY KEY,
vessel_id INTEGER REFERENCES vessels(id), mmsi TEXT REFERENCES vessels(mmsi), latitude DECIMAL(10,8), longitude DECIMAL(11,8), timestamp TIMESTAMP NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
func UpsertLocations ¶
func UpsertLocations(db *sql.DB, locations []models.MaerskLocation) error
Types ¶
type Location ¶
type Location struct { ID int `json:"id"` Unlocode string `json:"unlocode"` Name string `json:"name"` CountryCode string `json:"country_code"` Location []float64 `json:"location"` IsAirport bool `json:"is_airport"` IsPort bool `json:"is_port"` IsTrainStation bool `json:"is_train_station"` CreatedAt time.Time `json:"created_at"` MaerskID string `json:"maersk_id"` }
Location struct to match the database schema
type OceanProduct ¶
type OceanProduct struct { ID int `db:"id"` CarrierProductID string `db:"carrier_product_id"` ProductValidToDate time.Time `db:"product_valid_to_date"` ProductValidFromDate time.Time `db:"product_valid_from_date"` OriginCity string `db:"origin_city"` OriginName string `db:"origin_name"` OriginCountry string `db:"origin_country"` OriginPortUNLoCode string `db:"origin_port_un_lo_code"` OriginCarrierSiteGeoID string `db:"origin_carrier_site_geo_id"` OriginCarrierCityGeoID string `db:"origin_carrier_city_geo_id"` DestinationCity string `db:"destination_city"` DestinationName string `db:"destination_name"` DestinationCountry string `db:"destination_country"` DestinationPortUNLoCode string `db:"destination_port_un_lo_code"` DestinationCarrierSiteGeoID string `db:"destination_carrier_site_geo_id"` DestinationCarrierCityGeoID string `db:"destination_carrier_city_geo_id"` DepartureVesselCarrierCode string `db:"departure_vessel_carrier_code"` DepartureVesselName string `db:"departure_vessel_name"` DepartureVesselIMONumber string `db:"departure_vessel_imo_number"` DepartureVesselMMSI string `db:"departure_vessel_mmsi"` DepartureDateTime time.Time `db:"departure_date_time"` ArrivalDateTime time.Time `db:"arrival_date_time"` TransitTime int `db:"transit_time"` CreatedAt time.Time `db:"created_at"` }
type TransportLeg ¶
type TransportLeg struct { ID int `db:"id"` OceanProductID int `db:"ocean_product_id"` DepartureDateTime time.Time `db:"departure_date_time"` ArrivalDateTime time.Time `db:"arrival_date_time"` VesselCarrierCode string `db:"vessel_carrier_code"` VesselName string `db:"vessel_name"` VesselIMONumber string `db:"vessel_imo_number"` VesselMMSI string `db:"vessel_mmsi"` OriginCity string `db:"origin_city"` OriginName string `db:"origin_name"` OriginCountry string `db:"origin_country"` OriginPortUNLoCode string `db:"origin_port_un_lo_code"` OriginCarrierSiteGeoID string `db:"origin_carrier_site_geo_id"` OriginCarrierCityGeoID string `db:"origin_carrier_city_geo_id"` DestinationCity string `db:"destination_city"` DestinationName string `db:"destination_name"` DestinationCountry string `db:"destination_country"` DestinationPortUNLoCode string `db:"destination_port_un_lo_code"` DestinationCarrierSiteGeoID string `db:"destination_carrier_site_geo_id"` DestinationCarrierCityGeoID string `db:"destination_carrier_city_geo_id"` CreatedAt time.Time `db:"created_at"` }
type Vessel ¶
type Vessel struct { ID int `db:"id"` IMONumber string `db:"imo_number"` MMSI string `db:"mmsi"` Name string `db:"name"` IsTracked bool `db:"is_tracked"` CarrierCode string `db:"carrier_code"` AppearanceCount int `db:"appearance_count"` LastSeen time.Time `db:"last_seen"` CreatedAt time.Time `db:"created_at"` LastKnownPosition []float64 `db:"last_known_position"` }
func GetTopVessels ¶
GetTopVessels returns the most frequently appearing vessels
type VesselPosition ¶
Click to show internal directories.
Click to hide internal directories.