package
3.11.4+incompatible
Repository: https://github.com/whitewater-guide/gorge.git
Documentation: pkg.go.dev
# Functions
Cancelable is helper function that cancels channel once context is canceled.
No description provided by the author
CodeFromName is used to generate stable ids for gauges that only have name.
CoordinateToTimezone returns IANA timezone for coordinate.
FilterMeasurements filters channel of measurements using any number of filters It also supports context cancelation.
GaugesCodes is helper method used to get codes from job description.
GaugeSinkToSlice converts gauges channels to struct and error.
GenerateRandGauge generates random gauge for testing purposes.
GenerateRandMeasurement generates random measurement for testing purposes if value is not 0, it value will be returned for both level and flow otherwise level and flow will be random numbers in [min, max] range.
GenFromSlice creates channel of Measurements from slice.
HarvestSlice is test helper that runs script's harvest and returns result as slice.
NewClient constructs new HTTPClient with options.
No description provided by the author
No description provided by the author
NewRegistry creates new ScriptRegistry.
NPrecision is like Precision but for nullables.
NTruncCoord is same as TruncCoord but for nullable values.
Precision truncates float64 to given precision.
SinkToSlice takes channel of measurements and produces channel that will receive slice of measurements once input channel is closed or context is canceled.
Split splits one channel of measurements into two.
ToEPSG4326 converts coordinate from given coordinate system definition to EPSG4326 Definition can be obtained using following url https://epsg.io/<EPSG_CODE>.proj4 For example https://epsg.io/31257.proj4 Human-friendly page is https://epsg.io/31257 Coordinates are rounded to 5-digits precision (~1 meter) (https://en.wikipedia.org/wiki/Decimal_degrees).
TruncCoord truncates locations to 5 digits precision [link](https://en.wikipedia.org/wiki/Decimal_degrees).
No description provided by the author
No description provided by the author
# Variables
Client is default client for scripts It will be reinitialized during server creation This default value will be used in tests.
ErrScriptNotFound means that script is not registered in registry.
# Structs
ClientOptions are HTTPClient that can be passed as args at startup.
CodesFilter return measurements filter that accepts only measuerments with given gauge codes.
CSVStreamOptions contains commons options for streaming data from CSV files.
Doc extends goquery.Document with a Close() method.
No description provided by the author
No description provided by the author
Gauge represents gauge/station from upstream source.
GaugeID identifies gauge using script and code pair.
HTime is just a wrapped around time which marshals/unmarshalt to/from RFC3339 string and can be stored in DB.
HTTPClient is like default client, but with some conveniency methods for common scenarios.
JobDescription represents task that will run on schedule and harvest measurements from some source.
LatestFilter returns measurements filter that accepts only measurements that are either - newer than latest measurement for same gauge in the map - or if no latest measurement is found, are no older than "After" date.
Location is EPSG4326 coordinate.
LoggingScript is used to inject loggers into scripts It must be embedded into concrete scripts.
Measurement represents water level and/or flow value returned by gauge at the timestamp.
MeasurementsFactory is helper used in tests.
PartitionRangeFilter filters old measurements from partitions that should already be archived (see 'retention' column of partman.part_config table) It also filters garbage measurements from the future (see 'premake' column of partman.part_config table) If any of such measurements gets saved, partman will throw constraint violation during maintetance (see https://github.com/pgpartman/pg_partman/issues/247).
RequestOptions are additional per-request options.
ScriptDescriptor represents a script registered in gorge.
ScriptRegistry is where all the script we can use must be registered.
Status contains information about job's last execution.
UnhealthyJob describes a job that haven't run successfully for a certain period of time It's used to notify interested parties.
# Interfaces
BatchableOptions is an interface that options of batched script must implement.
JobScheduler is responsible for running harvest jobs on schedule.
MeasurementsFilter is used to skip unwanted measurements based on code, timestamp, etc...
Script represents bunch of methods to harvest measurements and gauges from certain upstream source.
# Type aliases
No description provided by the author
Gauges is slice of Gauge with helper methods for sorting.
HarvestMode determines how the schedule for script is generated.
Measurements is helper for sorting.
ScriptFactory creates an instance of script and provides is with options It must faile if generic options cannot be cast to script's internal options.
StringSet is a helper for sets of gauge codes.