walker

package
v0.5.63-rc-1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Github

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

Github represents the Github Walker

func NewGithub

func NewGithub() *Github

NewGithub returns a pointer to an instance of Github

func (*Github) Branch

func (g *Github) Branch(branch string) *Github

Branch sets github repository branch which will be traversed and returns a pointer to the same Github instance

func (*Github) Owner

func (g *Github) Owner(owner string) *Github

Owner sets github repository owner and returns a pointer to the same Github instance

func (*Github) RegisterDirInterceptor

func (g *Github) RegisterDirInterceptor(i GithubDirInterceptor) *Github

RegisterFileInterceptor takes in a directory interceptor which will be invoked on each "directory" node and it returns pointer to the same github instance

Github Walker walks the nodes concurrently so if the interceptor is reading or writing to any variable from a higher namespace then those operations should be done in thread safe manner in order to avoid data races

func (*Github) RegisterFileInterceptor

func (g *Github) RegisterFileInterceptor(i GithubFileInterceptor) *Github

RegisterFileInterceptor takes in a file interceptor which will be invoked on each "file" node and it returns pointer to the same github instance

Github Walker walks the nodes concurrently so if the interceptor is reading or writing to any variable from a higher namespace then those operations should be done in thread safe manner in order to avoid data races

func (*Github) Repo

func (g *Github) Repo(repo string) *Github

Repo sets github repository and returns a pointer to the same Github instance

func (*Github) Root

func (g *Github) Root(root string) *Github

Root sets github repository root node from where Github walker needs to start traversing and returns a pointer to the same Github instance

If the root parameter ends with a "/**" then github walker will run in "traversal" mode, ie. it will look into each sub directory of the root node

If the root node ends with an extension, then that file will be returned and github walker will not traverse deeper

func (*Github) Walk

func (g *Github) Walk() error

Walk will initiate traversal process

type GithubContentAPI

type GithubContentAPI struct {
	Name        string `json:"name,omitempty"`
	Path        string `json:"path,omitempty"`
	SHA         string `json:"sha,omitempty"`
	Size        int64  `json:"size,omitempty"`
	URL         string `json:"url,omitempty"`
	HTMLURL     string `json:"html_url,omitempty"`
	GitURL      string `json:"git_url,omitempty"`
	DownloadURL string `json:"download_url,omitempty"`
	Type        string `json:"type,omitempty"`
	// Content will be empty when the path is of a directory
	Content string `json:"content,omitempty"`
	// Encoding will be empty when the path is of a directory
	Encoding string `json:"encoding,omitempty"`
}

GithubContentAPI represents Github API v3 response to /repos/{owner}/{repo}/contents/{path}?ref={branch}

type GithubDirInterceptor

type GithubDirInterceptor func(GithubDirectoryContentAPI) error

GithubDirInterceptor represents function signature which will be used on "dir" nodes when the github walker traverses the paths

type GithubDirectoryContentAPI

type GithubDirectoryContentAPI []GithubContentAPI

GithubDirectoryContentAPI represents Github API v3 response to /repos/{owner}/{repo}/contents/{path}?ref={branch} when "path" is of a directory

type GithubFileInterceptor

type GithubFileInterceptor func(GithubContentAPI) error

GithubFileInterceptor represents function signature which will be used on "file" nodes when the github walker traverses the paths

Jump to

Keyboard shortcuts

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