github

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 11 Imported by: 0

README

github

This github database is used to write(set) and read(get) files to a github repository. The URL scheme doesn't require a hostname, it defaults to github.com.

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

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

URL Query 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/organization
repo the name of the repository
path path in repo to read and write
ref (optional) can be a SHA, branch, or tag

You must use an authenticated URL if you want to,

  1. Write/Set
  2. The repo doesn't exist. Repo will be created if it doesn't exist

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUserInfo  = fmt.Errorf("no username:token provided")
	ErrNoAccess    = fmt.Errorf("personal access token needed")
	ErrInvalidRepo = fmt.Errorf("invalid repo")
	ErrInvalidRef  = fmt.Errorf("invalid ref")
)

Functions

This section is empty.

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) Get

func (g *Github) Get(file string) (contents string, err error)

func (*Github) Open

func (g *Github) Open(url string, subDirectory string) (database.Database, error)

func (*Github) Path

func (g *Github) Path() string

func (*Github) Set

func (g *Github) Set(file, contents string) error

Jump to

Keyboard shortcuts

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