Documentation
¶
Index ¶
- func CacheDir(projectRoot string) string
- func FetchGraphQL(endpoint, query string) (interface{}, error)
- func FetchPluginSource(name string, config map[string]interface{}) (interface{}, error)
- func FetchREST(url string) (interface{}, error)
- func FetchRESTWithRefetch(url string, cacheDir string, refetch bool) (interface{}, error)
- func GetCached(name, cacheDir string, ttl int) (interface{}, bool)
- func GetCachedWithTTL(name, cacheDir string, ttlSeconds int) (interface{}, bool, error)
- func ParseCSVResponse(data []byte) ([]map[string]string, error)
- func ParseXML(data []byte) (map[string]interface{}, error)
- func RegisterPluginSource(name string, handler PluginSourceHandler)
- func RegisteredPluginSources() []string
- func ResetPluginSources()
- func SaveCache(name, cacheDir string, data interface{}) error
- func UnwrapGraphQLData(raw map[string]interface{}) (interface{}, error)
- type FetchResult
- type PluginSourceHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchGraphQL ¶
FetchGraphQL sends a GraphQL query and returns the unwrapped data.
func FetchPluginSource ¶
FetchPluginSource invokes the registered plugin source handler by name.
func FetchRESTWithRefetch ¶
FetchRESTWithRefetch fetches from a REST endpoint, bypassing cache when refetch is true. On success the result is saved to cache so subsequent non-refetch calls can use it.
func GetCachedWithTTL ¶
GetCachedWithTTL returns cached data only if it hasn't expired.
func ParseCSVResponse ¶
ParseCSVResponse parses a CSV response body into rows of maps. First row is treated as headers.
func RegisterPluginSource ¶
func RegisterPluginSource(name string, handler PluginSourceHandler)
RegisterPluginSource registers a named plugin source handler.
func RegisteredPluginSources ¶
func RegisteredPluginSources() []string
RegisteredPluginSources returns the names of all registered plugin source handlers.
func ResetPluginSources ¶
func ResetPluginSources()
ResetPluginSources clears all registered plugin source handlers. Intended for test isolation.
func UnwrapGraphQLData ¶
UnwrapGraphQLData extracts the "data" field from a GraphQL JSON response.
Types ¶
type FetchResult ¶
FetchResult holds fetched data along with cache metadata.
type PluginSourceHandler ¶
PluginSourceHandler is a function provided by a plugin to fetch data.