source

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingSource  = errors.New("missing source")
	ErrNoReleaseFound = errors.New("no release found")
	ErrAssetNotFound  = errors.New("asset not found")
)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name string
	URL  string
	Size int
}

type ByVersion

type ByVersion []*Release

func (ByVersion) Len

func (vs ByVersion) Len() int

func (ByVersion) Less

func (vs ByVersion) Less(i, j int) bool

func (ByVersion) Swap

func (vs ByVersion) Swap(i, j int)

type Driver

type Driver interface {
	GetRelease(ctx context.Context, version string) (*Release, error)
	ListReleases(ctx context.Context) ([]*Release, error)
	DownloadAsset(ctx context.Context, version, name string) ([]byte, error)
	UploadAsset(ctx context.Context, version, name string, data []byte) error
}

type ListOptions

type ListOptions struct {
	// Version constraint e.g. 'v1.2.4', 'v1', '>= v1.1.0, < v2.1'
	Version string

	// Include pre-releases
	Prerelease bool
}

type Release

type Release struct {
	Name        string
	Description string
	Date        time.Time
	Version     string
	Prerelease  bool
	Assets      []*Asset
}

type Source

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

func New

func New(driver Driver) *Source

func (*Source) DownloadAsset

func (s *Source) DownloadAsset(ctx context.Context, version, name string) ([]byte, error)

func (*Source) GetRelease

func (s *Source) GetRelease(ctx context.Context, version string) (*Release, error)

func (*Source) ListReleases

func (s *Source) ListReleases(ctx context.Context, opt *ListOptions) ([]*Release, error)

func (*Source) UploadAsset

func (s *Source) UploadAsset(ctx context.Context, version, name string, data []byte) error

Directories

Path Synopsis
Package local is a source backend for loading packages from a single directory.
Package local is a source backend for loading packages from a single directory.

Jump to

Keyboard shortcuts

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