badgedata

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2019 License: MIT Imports: 3 Imported by: 2

README

badgedata

Simple Go library to collect remote data for use as badgen badge source data.

go get golift.io/badgedata

Example

Simple example to show how to use it. You should put this library into your own web server code and give it a handler path you prefer. Has a simple pluggable structure to make creating new data sources simple. Contains one example for caching Grafana dashboard download counts.

package main

import (
	"net/http"

	"golift.io/badgedata"
	_ "golift.io/badgedata/grafana"
)

func main() {
	http.Handle("/bd/", badgedata.Handler())
	if err := http.ListenAndServe(":8080", nil); err != nil {
		log.Fatal(err)
	}
}

Currently only does one thing.

curl http://127.0.0.1:8080/bd/grafana/dashboard-count/10418,10417,10416,10415

Replace the numbers with IDs of dashboards on Grafana.com you want download counts for.

In Action: grafana

Documentation

Overview

Package badgedata provides a collection of methods to retreive, store and re-display data from other websites. The intent is to use the displayed data with badgen.net.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler() http.HandlerFunc

Handler returns the main handler for /badgedata endpoint.

func Register

func Register(name string, function http.HandlerFunc)

Register should only be called from init functions. Registrations created after calling Handler() will not work.

Types

This section is empty.

Directories

Path Synopsis
Package grafana provides an input to the badgedata library to retreive dashboard download count from the public Grafana API.
Package grafana provides an input to the badgedata library to retreive dashboard download count from the public Grafana API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL