template

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCachedTemplate added in v0.8.0

func DeleteCachedTemplate(path string) error

func DeleteLocalCacheDir added in v0.8.0

func DeleteLocalCacheDir(cacheDir string) (string, error)

Types

type CacheSourceOpts added in v0.8.0

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

type GitSource added in v0.8.0

type GitSource[T TemplateType] struct {
	// contains filtered or unexported fields
}

func (*GitSource[T]) Parse added in v0.8.0

func (src *GitSource[T]) Parse() (*RawTemplate, error)

func (*GitSource[T]) Read added in v0.8.0

func (src *GitSource[T]) Read() (*TemplateInfo[T], error)

func (*GitSource[T]) Validate added in v0.8.0

func (src *GitSource[T]) Validate() ([]*TemplateValidated, error)

type GitSourceOptions added in v0.8.0

type GitSourceOptions struct {
	CacheBaseDir    string
	RepositoryUrl   string
	DefaultRevision string
	Revision        string
	AllowOffline    bool
}

func (*GitSourceOptions) CacheDirName added in v0.8.0

func (s *GitSourceOptions) CacheDirName() string

func (*GitSourceOptions) CachePath added in v0.8.0

func (s *GitSourceOptions) CachePath() string

type LocalSource added in v0.6.0

type LocalSource[T TemplateType] struct {
	// contains filtered or unexported fields
}

func (*LocalSource[T]) Parse added in v0.8.0

func (src *LocalSource[T]) Parse() (*RawTemplate, error)

func (*LocalSource[T]) Read added in v0.8.0

func (src *LocalSource[T]) Read() (*TemplateInfo[T], error)

func (*LocalSource[T]) Validate added in v0.8.0

func (src *LocalSource[T]) Validate() ([]*TemplateValidated, error)

type RawTemplate added in v0.8.0

type RawTemplate TemplateValue[string]

alias to fix receiver types with generics

func (*RawTemplate) ToJson added in v0.8.0

func (t *RawTemplate) ToJson() (*RawTemplate, error)

func (*RawTemplate) ToYaml added in v0.8.0

func (t *RawTemplate) ToYaml() (*RawTemplate, error)

type RemoteSource added in v0.6.0

type RemoteSource[T TemplateType] struct {
	// contains filtered or unexported fields
}

func (*RemoteSource[T]) Parse added in v0.8.0

func (src *RemoteSource[T]) Parse() (*RawTemplate, error)

func (*RemoteSource[T]) Read added in v0.8.0

func (src *RemoteSource[T]) Read() (*TemplateInfo[T], error)

func (*RemoteSource[T]) Validate added in v0.8.0

func (src *RemoteSource[T]) Validate() ([]*TemplateValidated, error)

type SourceLoader added in v0.8.0

type SourceLoader[T TemplateType] interface {
	Read() (*TemplateInfo[T], error)
}

func NewGitLoader added in v0.8.0

func NewGitLoader[T TemplateType](opts *GitSourceOptions, name string) SourceLoader[T]

func NewLocalCachedLoader added in v0.8.0

func NewLocalCachedLoader[T TemplateType](path string, cacheDir string) SourceLoader[T]

func NewLocalLoader added in v0.8.0

func NewLocalLoader[T TemplateType](path string) SourceLoader[T]

func NewRemoteLoader added in v0.8.0

func NewRemoteLoader[T TemplateType](url string, cacheDir string) SourceLoader[T]

type SourceType added in v0.8.0

type SourceType uint
const (
	Local SourceType = iota
	Remote
	Git
)

func (SourceType) String added in v0.8.0

func (s SourceType) String() string

type SourceValidator added in v0.8.0

type SourceValidator interface {
	Parse() (*RawTemplate, error)
	Validate() ([]*TemplateValidated, error)
}

func NewGitValidator added in v0.8.0

func NewGitValidator(opts *GitSourceOptions, name string) SourceValidator

func NewLocalValidator added in v0.8.0

func NewLocalValidator(path string) SourceValidator

func NewRemoteValidator added in v0.8.0

func NewRemoteValidator(url string) SourceValidator

type TemplateInfo added in v0.8.0

type TemplateInfo[T TemplateType] struct {
	Value      *TemplateValue[T]
	SourceType SourceType
	Path       string // absolute path cached or resolved git path
	Revision   string // local/remote or git commit
}

type TemplateType added in v0.8.0

type TemplateType interface {
	string | box.BoxV1 | lab.LabV1 | task.TaskV1 | lab.DumpV1
}

type TemplateValidated added in v0.6.0

type TemplateValidated struct {
	Value   *RawTemplate
	Path    string
	IsValid bool
}

type TemplateValue added in v0.6.0

type TemplateValue[T TemplateType] struct {
	Kind schema.SchemaKind
	Data T // string or actual model
}

Jump to

Keyboard shortcuts

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