gop

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource

func CreateResource(repo, resource, version string) string

func HandleHTTPStatus

func HandleHTTPStatus(statusCode int) error

func IsHash

func IsHash(s string) bool

func ProcessRepo

func ProcessRepo(resource string) (repo, relresource, version string)

func ProcessRequest

func ProcessRequest(resource string) (string, string, string, error)

func ToStatusCode

func ToStatusCode(err error) (info string, httpCode int)

Types

type Cacher

type Cacher interface {
	Cache(resource string, content []byte) (err error)
}

Cacher is an interface that saves the res object to a data source

type Config

type Config struct {
	Username      string `yaml:"username"`
	Token         string `yaml:"token"`
	CacheLocation string `yaml:"cachelocation"`
	FsType        string `yaml:"fstype"` // one of "os", "mem"
	ImportRegex   string `yaml:"importregex"`
	Proxy         string `yaml:"proxy"`
}

type Error

type Error int
const (
	UnknownError Error = iota
	BadRequestError
	ApiRateLimitError
	BadReferenceError
	InternalError
	UnauthorizedError
	TimeoutError
	CacheAccessError
	CacheReadError
	ProxyReadError
	DownstreamError
	CacheWriteError
	FileNotFoundError
	FileReadError
	GitCloneError
	GitCheckoutError
	GithubFetchError
)

func (Error) Error

func (k Error) Error() string

func (Error) String

func (k Error) String() string

type Gopper

type Gopper interface {
	Retriever
	Cacher
}

Gopper is the composition of both Retriever and Cacher

type Logger

type Logger func(format string, args ...interface{})

type Object

type Object struct {
	Content  []byte `json:"content"`
	Resource string `json:"resource"`
}

Object ...

type Resolver

type Resolver interface {
	Resolve(resource string) (resolved string, err error)
}

type Retriever

type Retriever interface {
	Retrieve(resource string) (content []byte, cached bool, err error)
}

Retriever is an interface that returns a Object and if the object should be cached in later steps

type Updater

type Updater interface {
	Resolve(resource string) (resolved string)
	Update(version string) error
	UpdateAll() error
	UpdateTo(from, to string) error
	Init() error
	Get(repo string) error
}

Updater is an interface that returns the resolved version of the original resource

Jump to

Keyboard shortcuts

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