casecatalog

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package casecatalog owns the shareable filesystem case catalog. Built-in cases and executable-relative user cases use the same group/case layout.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid   = errors.New("case catalog: invalid input")
	ErrCollision = errors.New("case catalog: duplicate case identity")
)

Functions

func UserRootForExecutable

func UserRootForExecutable(executablePath string) (string, error)

Types

type Case

type Case struct {
	ID            string                     `json:"id"`
	Revision      uint64                     `json:"revision"`
	Group         string                     `json:"group"`
	Directory     string                     `json:"directory"`
	Key           string                     `json:"key"`
	Name          string                     `json:"name"`
	Description   string                     `json:"description,omitempty"`
	Dimension     string                     `json:"dimension"`
	Enabled       bool                       `json:"enabled"`
	Default       bool                       `json:"default"`
	Severity      domain.CaseSeverity        `json:"severity"`
	ExecutionMode domain.CaseExecutionMode   `json:"execution_mode"`
	Source        Source                     `json:"source"`
	Definitions   domain.ProtocolDefinitions `json:"definitions"`
}

type Entry

type Entry struct {
	Group     string
	Directory string
	Source    Source
	TestCase  domain.TestCase
}

type Group

type Group struct {
	Name  string `json:"name"`
	Cases []Case `json:"cases"`
}

type Options

type Options struct {
	Builtin  fs.FS
	UserRoot string
	Now      func() time.Time
}

type Service

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

func New

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

func (*Service) Count

func (service *Service) Count(ctx context.Context) (int, error)

Count validates current content and counts metadata without cloning authored bodies.

func (*Service) Delete

func (service *Service) Delete(ctx context.Context, id string, expectedRevision uint64) error

func (*Service) Entries

func (service *Service) Entries(ctx context.Context) ([]Entry, error)

func (*Service) Find

func (service *Service) Find(ctx context.Context, id string) (Entry, error)

func (*Service) Save

func (service *Service) Save(ctx context.Context, group, directory string, raw []byte) error

func (*Service) SaveCase

func (service *Service) SaveCase(ctx context.Context, group, directory string, testCase domain.TestCase) error

func (*Service) Snapshot

func (service *Service) Snapshot(ctx context.Context) (Snapshot, error)

type Snapshot

type Snapshot struct {
	Groups []Group `json:"groups"`
}

type Source

type Source string
const (
	SourceBuiltin Source = "builtin"
	SourceUser    Source = "user"
)

Jump to

Keyboard shortcuts

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