Documentation ¶
Index ¶
- Variables
- func ErrCloningRepo(err error) error
- func ErrInvalidSizeFile(err error) error
- type DirInterceptor
- type Directory
- type File
- type FileInterceptor
- type Git
- func (g *Git) BaseURL(baseurl string) *Git
- func (g *Git) Branch(branch string) *Git
- func (g *Git) MaxFileSize(size int64) *Git
- func (g *Git) Owner(owner string) *Git
- func (g *Git) RegisterDirInterceptor(i DirInterceptor) *Git
- func (g *Git) RegisterFileInterceptor(i FileInterceptor) *Git
- func (g *Git) Repo(repo string) *Git
- func (g *Git) Root(root string) *Git
- func (g *Git) ShowLogs() *Git
- func (g *Git) Walk() error
- type Github
- func (g *Github) Branch(branch string) *Github
- func (g *Github) Owner(owner string) *Github
- func (g *Github) RegisterDirInterceptor(i GithubDirInterceptor) *Github
- func (g *Github) RegisterFileInterceptor(i GithubFileInterceptor) *Github
- func (g *Github) Repo(repo string) *Github
- func (g *Github) Root(root string) *Github
- func (g *Github) Walk() error
- type GithubContentAPI
- type GithubDirInterceptor
- type GithubDirectoryContentAPI
- type GithubFileInterceptor
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidSizeFileCode = "11072" ErrCloningRepoCode = "11073" )
Functions ¶
func ErrCloningRepo ¶
func ErrInvalidSizeFile ¶
Types ¶
type DirInterceptor ¶
type FileInterceptor ¶
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git represents the Git Walker
func (*Git) BaseURL ¶
BaseURL sets git repository base URL and returns a pointer to the same Git instance
func (*Git) Branch ¶
Branch sets git repository branch which will be cloned and returns a pointer to the same Git instance
func (*Git) MaxFileSize ¶
BaseURL sets git repository base URL and returns a pointer to the same Git instance
func (*Git) RegisterDirInterceptor ¶
func (g *Git) RegisterDirInterceptor(i DirInterceptor) *Git
func (*Git) RegisterFileInterceptor ¶
func (g *Git) RegisterFileInterceptor(i FileInterceptor) *Git
func (*Git) Root ¶
Root sets git repository root node from where Git walker needs to start traversing and returns a pointer to the same Git 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 path will be prefixed with "/" if not already.
type Github ¶
type Github struct {
// contains filtered or unexported fields
}
Github represents the Github Walker
func (*Github) Branch ¶
Branch sets github repository branch which will be traversed and returns a pointer to the same Github instance
func (*Github) Owner ¶
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) Root ¶
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
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