githubstream

package module
v0.0.0-...-68a8014 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2014 License: MIT Imports: 3 Imported by: 2 modules, 2 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

go-githubstream

GoDoc Build Status

Fetch commits from a GitHub repository periodically. Uses go-github under the hood.

Installation

$ go get github.com/jsantell/go-githubstream

Documentation

Document can be found on GoDoc

Example

package main

import "fmt"
import "time"
import "github.com/jsantell/go-githubstream"

var TOKEN string = os.Getenv("GITHUB_ACCESS_TOKEN")

func main() {
  ghs := githubstream.NewGithubStream(time.Hour, time.Hour * 10, "jsantell", "go-githubstream", "master", TOKEN)

  // This fetches the github repo `jsantell/go-githubstream` once an hour,
  // fetching commits from that point to 10 hours prior,
  // and prints the commits
  for commits := range ghs.Start() {
    fmt.Println(commits)
  }
}

License

MIT, Copyright (c) 2014 Jordan Santell

Documentation

Index

Constants

View Source
const VERSION = "0.2.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type GithubStream

type GithubStream struct {
	Stream chan []github.RepositoryCommit
	Client *github.Client
	Ticker *time.Ticker
	Owner  string
	Repo   string
	Branch string
	Token  string

	// How often the Github repository should be queried.
	Frequency time.Duration

	// From when should the commits be fetched; a `Since` of 8 hours
	// indicates that on every query, get all commits from 8 hours ago
	// up to the current time.
	Since time.Duration
}

func NewGithubStream

func NewGithubStream(frequency time.Duration, since time.Duration, owner string, repo string, branch string, token string) *GithubStream

func (*GithubStream) Start

func (ghs *GithubStream) Start() chan []github.RepositoryCommit

func (*GithubStream) Stop

func (ghs *GithubStream) Stop()

Jump to

Keyboard shortcuts

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