edb

package module
v0.0.0-...-95f36d5 Latest Latest
Warning

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

Go to latest
Published: May 5, 2015 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

edb

A simple database for tracking events.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB represents the application level database.

func NewDB

func NewDB() *DB

NewDB returns a new instance of DB.

func (*DB) Close

func (db *DB) Close() error

Close closes the underlying database.

func (*DB) Events

func (db *DB) Events() ([]Event, error)

Events returns a list of all events from the database.

func (*DB) EventsByActor

func (db *DB) EventsByActor(actor string) ([]Event, error)

EventsByActor returns a list of events from the database for a single actor.

func (*DB) Open

func (db *DB) Open(path string) error

Open opens the underlying database.

func (*DB) SaveEvents

func (db *DB) SaveEvents(events []Event) error

SaveEvents stores events in the database.

type Event

type Event struct {
	ID         string    `json:"id"`
	Type       string    `json:"type"`
	Timestamp  time.Time `json:"timestamp"`
	Username   string    `json:"username"`
	Actor      string    `json:"actor"`
	Repository string    `json:"repository"`
}

Event returns a genericized event.

type Events

type Events []Event

func (Events) Len

func (a Events) Len() int

func (Events) Less

func (a Events) Less(i, j int) bool

func (Events) Swap

func (a Events) Swap(i, j int)

type GitHubFetcher

type GitHubFetcher struct {
	Client   *github.Client
	DB       *DB
	Username string

	Logger *log.Logger
}

GitHubFetcher periodically fetches new events for a user.

func NewGitHubFetcher

func NewGitHubFetcher(client *github.Client, db *DB, username string) *GitHubFetcher

NewGitHubFetcher returns a new GitHubFetcher for a user.

func (*GitHubFetcher) Run

func (f *GitHubFetcher) Run(closing chan struct{})

type Handler

type Handler struct {
	DB *DB

	// Enables the use of the local file system for assets, when true.
	LocalMode bool
}

Handler represents the HTTP interface to the database.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
cmd
edbd command

Jump to

Keyboard shortcuts

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