Documentation ¶
Index ¶
- Constants
- func BillingDay(url string, matched string, modifier string, when *time.Time) (newUrl string)
- func BillingMonth(url string, matched string, modifier string, when *time.Time) (newUrl string)
- func Day(url string, matched string, modifier string, when *time.Time) (newUrl string)
- func FuncNameAndModifier(match string) (funcName string, modifier string)
- func GetAll(scheme string, addr string, paths map[string]string) (responses map[string]*HttpHandler, err error)
- func Month(url string, matched string, modifier string, when *time.Time) (newUrl string)
- func Path(url string) (parsed string)
- type HttpGet
- type HttpHandler
Constants ¶
const TIMEOUT time.Duration = time.Second * 4
TIMEOUT is used to control the max duration of an external call
Variables ¶
This section is empty.
Functions ¶
func BillingDay ¶
BillingDay replaces {billingDay} | {billingDay:<modifier>} patterns with a real value
Implements replaceFunc
func BillingMonth ¶
BillingMonth replaces {billingMonth} | {billingMonth:<modifier>} patterns with a real value
Implements replaceFunc
func FuncNameAndModifier ¶
FuncNameAndModifier takes a matched string ({<func>:<modifier>}) and returns the values for <func> and <modifier>
func GetAll ¶
func GetAll(scheme string, addr string, paths map[string]string) (responses map[string]*HttpHandler, err error)
GetAll fetches multiple api responses at once tracking them in the map keys passed along
the map is from config.nav datasources
func Month ¶
Month replaces {month} | {month:<modifier>} patterns with a real value
Implements replaceFunc
func Path ¶
Path takes the original string and converts it to a parsed version with the known {<func>:<modifier>} replaced with real versions
Uses a regex to find all patterns that match `{.*}`, parses each of those looking for a matching function name from functionMap and calls the replacer function to swap with real values
Types ¶
type HttpHandler ¶
type HttpHandler struct { DataSource *HttpGet Response *http.Response StatusCode int Duration float64 Url *url.URL }
func Get ¶
func Get(scheme string, addr string, path string) (response *HttpHandler, err error)
Get combines creating a new instance of HttpHandler and then also calls .Get() method to retrive the data directly
func New ¶
func New(scheme string, addr string, path string) *HttpHandler
New creates a pre configures HttpHandler
func (*HttpHandler) Get ¶
func (a *HttpHandler) Get() (err error)
Get calls remotedata source methof to fetch it and