package
1.11.0
Repository: https://github.com/nextmv-io/nextroute.git
Documentation: pkg.go.dev

# Packages

Package errors contains errors contains information about errors returned by nextmv functions.

# Functions

All returns true if all the given predicate evaluations evaluate to condition.
AllFalse returns true if all the given predicate evaluations is false.
AllTrue returns true if all the given predicate evaluations are true.
CopyMap copies all key/value pairs in source adding them to destination.
CopySliceFrom cuts of a slice from `alloc` and copies the data from `data` into it.
DefensiveCopy returns a defensive copy of a slice.
DefineLazy returns a Lazy[T] that will call the given function to calculate the value.
DurationValue returns the value of a duration in the given time unit.
Filter filters a slice using a predicate function.
FindIndex returns the first index i satisfying predicate(s[i]).
GroupBy groups the elements of a slice by a key function.
Has returns true if any of the given predicate evaluations is condition.
HasFalse returns true if any of the given predicate evaluations evaluate to false.
HasTrue returns true if any of the given predicate evaluations evaluate to true.
Haversine calculates the distance between two locations using the Haversine formula.
Intersect returns the intersection of two slices.
Keys returns a slice of all values in the given map.
Map maps a slice of type T to a slice of type R using the function f.
MapSlice maps a slice of type T to a slice of type R using the function f returning a slice of R.
NewAlias creates a new Alias from the given weights.
NewBoundingBox returns a bounding box for the given locations.
NewDistance returns a new distance.
NewDuration returns a new duration by unit.
NewFastHaversine returns a new FastHaversine.
NewIntervalCheckerSliceLookup returns a new slice based interval checker.
NewInvalidBoundingBox returns an invalid bounding box.
NewInvalidLocation creates a new invalid Location.
NewLocation creates a new Location.
NewSpeed creates a new speed.
NewSpeedUnit returns a new speed unit.
NewStatistics creates a new statistics object.
NotUnique returns the duplicate instances.
NotUniqueDefined returns the instances for which f returns identical values.
NSmallest returns the n-smallest items in the slice items using the function f to determine the value of each item.
RandomElement returns a random element from the given slice.
RandomElementIndices returns a slice of n random element indices from the given slice.
RandomElements returns a slice of n random elements from the given slice.
RandomIndex returns a random index from the given size.
RangeMap ranges over a map in deterministic order by first sorting the keys.
Reverse reverses the given slice in place and returns it.
Shuffle returns a shuffled copy of the given slice.
Truncate truncates a float64 to the given unit.
TryAssertFloat64Matrix tries to assert that the given matrix is a [][]float64.
TryAssertStringSlice attempts to convert a slice of any to a slice of strings.
Unique is a universal duplicate removal function for type instances in a slice that implement the comparable interface.
UniqueDefined is a universal duplicate removal function for type instances in a slice that implement the comparable interface.
Values returns a slice of all values in the given map.
WithinTolerance returns true if a and b are within the given tolerance.

# Constants

Day is 24 hours.
Hour is 60 minutes.
Kilometers is 1000 meters.
Meters is the distance travelled by light in a vacuum in 1/299,792,458 seconds.
MicroSecond is 1/1,000,000 of a second.
Miles is 1609.34 meters.
MilliSecond is 1/1,000 of a second.
Minute is 60 seconds.
NanoSecond is 1/1,000,000,000 of a second.
Second is the SI unit of time.

# Variables

KilometersPerHour is a speed unit of kilometers per hour.
MetersPerSecond is a speed unit of meters per second.
MilesPerHour is a speed unit of miles per hour.

# Structs

Distance is a distance in a given unit.
FastHaversine is a fast approximation of the haversine distance.
Interval represents a time interval.
Location represents a location on earth.
Statistics describes statistics.

# Interfaces

Alias is an interface that allows for sampling from a discrete distribution in O(1) time.
BoundingBox contains information about a box.
Comparable is a type constraint for three types: int, int64, and string.
IntervalChecker is used to check whether a given time is in an interval.
Speed is the interface for a speed.
SpeedUnit represents a unit of speed.

# Type aliases

DistanceUnit is the unit of distance.
DurationUnit is the unit of duration.
Lazy is a function that returns a value of type T.
Locations is a slice of Location.