Skip to content

Go package to implement the go-whosonfirst-iterate/v2/emitter.Emitter interface for iterating multiple repositories in a GitHub organization.

License

Notifications You must be signed in to change notification settings

whosonfirst/go-whosonfirst-iterate-organization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-whosonfirst-iterate-organization

Go package to implement the whosonfirst/go-whosonfirst-iterate/v2/emitter.Emitter interface for iterating multiple repositories in a GitHub organization.

Motivation

This package is designed for situations where you need to iterate over multiple Who's On First -style repositories in a GitHub organization.

Under the hood it is thin wrapper around the whosonfirst/go-whosonfirst-github package, used to fetch a list of repositories for an organization, and the whosonfirst/go-whosonfirst-iterate-git to fetch each repository and iterate over its files.

It implements the whosonfirst/go-whosonfirst-iterate/v2/emitter.Emitter interface so it will work with any existing code and callback functions designed for use with the go-whosonfirst-iterate package.

Documentation

Go Reference

Example

Iterate over all the sfomuseum-data/sfomuseum-data-flights-* repositories, excluding sfomuseum-data-flights-YYYY-MM, cloning each repository to /tmp before processing. (Each repository will be deleted after processing).

package main

import (
	_ "github.com/whosonfirst/go-whosonfirst-iterate-organization"
)

import (
	"context"
	"io"
	"fmt"
	"testing"
	"github.com/whosonfirst/go-whosonfirst-iterate/v2/iterator"
)

func main()

	ctx := context.Background()

	iter_uri := "org:///tmp"
	
	iter_cb := func(ctx context.Context, path string, r io.ReadSeeker, args ...interface{}) error {
		fmt.Println(path)
		return nil
	}

	iter, _ := iterator.NewIterator(ctx, iter_uri, iter_cb)

	iter.IterateURIs(ctx, "sfomuseum-data://?prefix=sfomuseum-data-flights-&exclude=sfomuseum-data-flights-YYYY-MM")
}

Error handling omitted for the sake of brevity.

See also

About

Go package to implement the go-whosonfirst-iterate/v2/emitter.Emitter interface for iterating multiple repositories in a GitHub organization.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages