sources

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSupportedFile added in v0.5.0

func IsSupportedFile(name string) bool

func ToDir added in v1.3.1

func ToDir(path string) string

Types

type Aggregate

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

func NewAggregate

func NewAggregate(sources ...Source) *Aggregate

func (*Aggregate) Add

func (a *Aggregate) Add(src Source)

func (*Aggregate) Read

func (a *Aggregate) Read(ctx context.Context) (<-chan File, <-chan Error)

func (*Aggregate) Resolve added in v1.1.0

func (a *Aggregate) Resolve(_ context.Context, _ *url.URL) (<-chan File, <-chan Error)

type Error added in v1.1.0

type Error struct {
	Filename string
	Message  string
}

func NewError added in v1.1.0

func NewError(filename string, message string) Error

func NewErrorFrom added in v1.1.0

func NewErrorFrom(filename string, err error) Error

func (Error) Error added in v1.1.0

func (e Error) Error() string

type File

type File struct {
	Source  Source
	Name    string
	Content []byte
}

func (File) Resolve added in v1.3.1

func (f File) Resolve(ctx context.Context, u *url.URL) (onNext <-chan File, onError <-chan Error)

type FileSystem

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

func (*FileSystem) Read

func (fs *FileSystem) Read(ctx context.Context) (<-chan File, <-chan Error)

func (*FileSystem) Resolve added in v1.1.0

func (fs *FileSystem) Resolve(ctx context.Context, u *url.URL) (<-chan File, <-chan Error)

type Git

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

func (*Git) Read

func (g *Git) Read(ctx context.Context) (<-chan File, <-chan Error)

func (*Git) Resolve added in v1.1.0

func (g *Git) Resolve(ctx context.Context, u *url.URL) (<-chan File, <-chan Error)

type HTTP added in v1.1.0

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

func (*HTTP) Read added in v1.1.0

func (src *HTTP) Read(ctx context.Context) (<-chan File, <-chan Error)

func (*HTTP) Resolve added in v1.1.0

func (src *HTTP) Resolve(ctx context.Context, u *url.URL) (<-chan File, <-chan Error)

type Noop

type Noop struct{}

func NewNoop

func NewNoop() *Noop

func (Noop) Read

func (n Noop) Read(_ context.Context) (<-chan File, <-chan Error)

func (Noop) Resolve added in v1.1.0

func (n Noop) Resolve(ctx context.Context, _ *url.URL) (<-chan File, <-chan Error)

type Source

type Source interface {
	Read(ctx context.Context) (onNext <-chan File, onError <-chan Error)
	Resolve(ctx context.Context, url *url.URL) (onNext <-chan File, onError <-chan Error)
}

func Create added in v1.1.0

func Create(str string) (Source, error)

func CreateFrom added in v1.1.0

func CreateFrom(u *url.URL) (Source, error)

func New

func New(locations ...string) (Source, error)

func NewFileSystem

func NewFileSystem(u *url.URL) (Source, error)

func NewGit

func NewGit(u *url.URL) (Source, error)

func NewGitFrom added in v1.1.0

func NewGitFrom(repo *git.Repository, filter glob.Glob) (Source, error)

func NewHTTP added in v1.1.0

func NewHTTP(u *url.URL) (Source, error)

type SourceFactory added in v1.1.0

type SourceFactory func(u *url.URL) (Source, error)

type SourceType added in v1.1.0

type SourceType int
const (
	SourceTypeUnknown SourceType = 0
	SourceTypeFS      SourceType = 1
	SourceTypeHTTP    SourceType = 2
	SourceTypeGIT     SourceType = 3
)

func GetType added in v1.1.0

func GetType(u *url.URL) SourceType

Jump to

Keyboard shortcuts

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