source

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSourceEmpty = fmt.Errorf("invalid source, must specify at least one type of source configuration")

Functions

This section is empty.

Types

type Entry

type Entry map[string]any

Entry is a single sourced entry. It's just a basic map, but makes it much clearer when building lists of this type, as the type syntax can get a bit messy.

type Source

type Source struct {
	Local  *SourceLocal  `json:"local,omitempty"`
	Inline *SourceInline `json:"inline,omitempty" doc:"Define entries on this source to load them directly."`
}

Source is instantiated from configuration and represents a source of catalog files.

func (Source) Load

func (s Source) Load(ctx context.Context) ([]*SourceEntry, error)

func (Source) Name

func (s Source) Name() string

func (Source) Validate

func (s Source) Validate() error

type SourceEntry

type SourceEntry struct {
	Origin  string
	Content []byte
}

SourceEntry is an entry that has been discovered in a source, with the contents of the source file and an Origin that explains where the entry came from, specific to the type of source that produced it.

func (SourceEntry) Parse

func (e SourceEntry) Parse() ([]Entry, error)

type SourceInline

type SourceInline struct {
	Entries []map[string]any `json:"entries"`
}

func (SourceInline) Load

func (s SourceInline) Load(ctx context.Context) ([]*SourceEntry, error)

type SourceLocal

type SourceLocal struct {
	Files []string `json:"files"`
}

func (SourceLocal) Load

func (s SourceLocal) Load(ctx context.Context) ([]*SourceEntry, error)

Jump to

Keyboard shortcuts

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