github

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 11 Imported by: 0

README

github

This driver is catered for those that want to source migrations from github.com. The URL scheme doesn't require a hostname, as it just simply defaults to github.com.

Authenticated client: github://user:personal-access-token@owner/repo/path#ref

Unauthenticated client: github://owner/repo/path#ref

URL Query WithInstance Config Description
user (optional) The username of the user connecting
personal-access-token (optional) An access token from GitHub (https://github.com/settings/tokens)
owner the repo owner
repo the name of the repository
path path in repo to migrations
ref (optional) can be a SHA, branch, or tag

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUserInfo          = fmt.Errorf("no username:token provided")
	ErrNoAccessToken       = fmt.Errorf("no access token")
	ErrInvalidRepo         = fmt.Errorf("invalid repo")
	ErrInvalidGithubClient = fmt.Errorf("expected *github.Client")
	ErrNoDir               = fmt.Errorf("no directory")
)

Functions

func WithInstance

func WithInstance(client *github.Client, config *Config) (source.Driver, error)

Types

type Config

type Config struct {
	Owner string
	Repo  string
	Path  string
	Ref   string
}

type Github

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

func (*Github) Close

func (g *Github) Close() error

func (*Github) First

func (g *Github) First() (version uint, err error)

func (*Github) Next

func (g *Github) Next(version uint) (nextVersion uint, err error)

func (*Github) Open

func (g *Github) Open(url string) (source.Driver, error)

func (*Github) Prev

func (g *Github) Prev(version uint) (prevVersion uint, err error)

func (*Github) ReadDown

func (g *Github) ReadDown(version uint) (r io.ReadCloser, identifier string, err error)

func (*Github) ReadUp

func (g *Github) ReadUp(version uint) (r io.ReadCloser, identifier string, err error)

Jump to

Keyboard shortcuts

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