storage

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Unlicense Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapGitHubError added in v0.1.6

func WrapGitHubError(err error) error

WrapGitHubError returns a user-friendly error for common GitHub API failures (expired token, revoked token, etc.). Falls back to the original error otherwise.

Types

type GitHubStorage

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

func NewGitHubStorage

func NewGitHubStorage(token string) *GitHubStorage

func (*GitHubStorage) CreateRepo

func (g *GitHubStorage) CreateRepo(owner, name string, private bool) error

func (*GitHubStorage) HasRepoAccess

func (g *GitHubStorage) HasRepoAccess(owner, name string) (bool, error)

func (*GitHubStorage) ReadFile

func (g *GitHubStorage) ReadFile(repo, path string) ([]byte, error)

func (*GitHubStorage) RepoExists

func (g *GitHubStorage) RepoExists(owner, name string) (bool, error)

func (*GitHubStorage) WriteFile

func (g *GitHubStorage) WriteFile(repo, path string, content []byte) error

type MockStorage

type MockStorage struct {
	Repos map[string]bool              // "owner/name" -> exists
	Files map[string]map[string][]byte // "owner/name" -> path -> content
	// contains filtered or unexported fields
}

MockStorage is an in-memory Provider implementation for tests.

func NewMockStorage

func NewMockStorage() *MockStorage

NewMockStorage creates an empty mock storage.

func (*MockStorage) CreateRepo

func (m *MockStorage) CreateRepo(owner, name string, private bool) error

func (*MockStorage) HasRepoAccess

func (m *MockStorage) HasRepoAccess(owner, name string) (bool, error)

func (*MockStorage) ReadFile

func (m *MockStorage) ReadFile(repo, path string) ([]byte, error)

func (*MockStorage) RepoExists

func (m *MockStorage) RepoExists(owner, name string) (bool, error)

func (*MockStorage) WriteFile

func (m *MockStorage) WriteFile(repo, path string, content []byte) error

type Provider

type Provider interface {
	// RepoExists checks whether a repository exists and is accessible.
	RepoExists(owner, name string) (bool, error)

	// CreateRepo creates a new repository.
	CreateRepo(owner, name string, private bool) error

	// ReadFile reads a file from a repository. Returns nil, nil if not found.
	ReadFile(repo, path string) ([]byte, error)

	// WriteFile creates or updates a file in a repository.
	WriteFile(repo, path string, content []byte) error

	// HasRepoAccess checks if the authenticated user has access to a repo.
	HasRepoAccess(owner, name string) (bool, error)
}

Provider defines the storage backend interface. Implementations exist per git provider (GitHub, GitLab, etc.).

Jump to

Keyboard shortcuts

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