speccatalog

package
v0.1.18-rc9 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRepositories = errors.New("no spec repositories configured")
	ErrNotFound       = errors.New("named spec not found")
)

Functions

This section is empty.

Types

type AmbiguousError

type AmbiguousError struct {
	Selector string
	Choices  []Entry
}
Example
err := (&AmbiguousError{
	Selector: "upgrade",
	Choices: []Entry{
		{Source: "https://git.example.com/acme/one", Path: "one.yaml"},
		{Source: "https://git.example.com/acme/two", Path: "two.yaml"},
	},
}).Error()
fmt.Println(err)
Output:
named spec selector upgrade is ambiguous: https://git.example.com/acme/one:one.yaml, https://git.example.com/acme/two:two.yaml

func (*AmbiguousError) Error

func (e *AmbiguousError) Error() string

type Catalog

type Catalog interface {
	List(context.Context) ([]Entry, error)
	Resolve(context.Context, string) (Entry, error)
	WithResolvedSource(context.Context, string, func(Entry, string) error) error
}

Catalog refreshes and resolves the configured Git-backed named-spec catalog.

type Entry

type Entry struct {
	Name        string
	Description string
	Source      string
	Path        string
	SHA         string
	CommittedAt time.Time
	// contains filtered or unexported fields
}

Entry identifies one named spec at the repository commit used for discovery.

type InvalidSelectorError

type InvalidSelectorError struct {
	Selector string
}

func (*InvalidSelectorError) Error

func (e *InvalidSelectorError) Error() string

type Options

type Options struct {
	Repositories []domaintypes.RepoURL
	CacheDir     string
	Auth         gitauth.Options
}

type Service

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

func New

func New(opts Options) (*Service, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Entry, error)

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, selector string) (Entry, error)

func (*Service) WithResolvedSource

func (s *Service) WithResolvedSource(ctx context.Context, selector string, use func(Entry, string) error) error

WithResolvedSource keeps the selected checkout at the resolved commit for the complete callback so a concurrent catalog refresh cannot change the files while the caller compiles them.

Jump to

Keyboard shortcuts

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