Documentation ¶ Index ¶ func Distance(p, q Coord) (mi, km float64) type Attributes func NewAttributes(name string, lat, lng float64) Attributes type Coord type Place func (p Place) DistanceToKm(q Place) float64 Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Distance ¶ func Distance(p, q Coord) (mi, km float64) Distance calculates the shortest path between two coordinates on the surface of the Earth. This function returns two units of measure, the first is the distance in miles, the second is the distance in kilometers. Types ¶ type Attributes ¶ type Attributes struct { Coord Name string CreatedAt time.Time } func NewAttributes ¶ func NewAttributes(name string, lat, lng float64) Attributes type Coord ¶ type Coord struct { Lat float64 Lng float64 } type Place ¶ type Place struct { ID int64 Attributes } func (Place) DistanceToKm ¶ func (p Place) DistanceToKm(q Place) float64 Source Files ¶ View all Source files distance.go model.go Click to show internal directories. Click to hide internal directories.