Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrParamNameInvalid = fmt.Errorf("invalid name in parameter definition") ErrParamTypeUnsupported = fmt.Errorf("unsupported type in parameter definition") )
ErrParamNameInvalid occurs when a parameter definition specifies an invalid parameter name. ErrParamTypeUnsupported occurs when a parameter definition specifies an unsupported parameter type.
var FileSystem embed.FS
Functions ¶
func UploadTomes ¶
UploadTomes traverses the provided filesystem and creates tomes using the provided graph. Each directory at the root of the filesystem is a tome, and must contain the required "metadata.yml" and "main.eldritch" files. You may use the tomes.FileSystem to include the default tomes specified here.
Types ¶
type GitImportOption ¶ added in v0.0.7
type GitImportOption func(*GitImporter)
GitImportOption provides configuration for creating a new GitImporter.
type GitImporter ¶ added in v0.0.7
type GitImporter struct {
// contains filtered or unexported fields
}
A GitImporter imports tomes from a provided Git URL.
func NewGitImporter ¶ added in v0.0.7
func NewGitImporter(graph *ent.Client, options ...GitImportOption) *GitImporter
NewGitImporter initializes and returns a new GitImporter. If no SSH Private Key is provided, a new ECDSA P256 private key is generated. This panics if a new SSH Private Key cannot be generated.
func (*GitImporter) Import ¶ added in v0.0.7
func (importer *GitImporter) Import(ctx context.Context, entRepo *ent.Repository, filters ...func(path string) bool) error
Import clones a git repository from the provided URL in memory. It walks the directory structure, looking for 'main.eldritch' files. For each 'main.eldritch' file found, it's parent directory is treated as the tome's root. All files in that directory and it's subdirectories (recursively) aside from the reserved metadata.yml file are uploaded as the tome's assets.
Provided filters on tome paths may be used to limit included directories by returning true if the result should be included.
type MetadataDefinition ¶ added in v0.0.7
type MetadataDefinition struct { Name string `yaml:"name"` Description string `yaml:"description"` Author string `yaml:"author"` SupportModel string `yaml:"support_model"` Tactic string `yaml:"tactic"` ParamDefs []ParamDefinition }
MetadataDefinition defines the contents that should be present in all tome metadata.yml files
func (MetadataDefinition) Validate ¶ added in v0.0.7
func (meta MetadataDefinition) Validate() error
Validate ensures the Tome metadata has been properly configured.
type ParamDefinition ¶ added in v0.0.5
type ParamDefinition struct { Name string `yaml:"name" json:"name"` Label string `yaml:"label" json:"label"` Type string `yaml:"type" json:"type"` Placeholder string `yaml:"placeholder" json:"placeholder"` }
ParamDefinition provides structured information for a tome to define a parameter.
func (ParamDefinition) Validate ¶ added in v0.0.5
func (paramDef ParamDefinition) Validate() error
Validate the parameter definition, returning an error if an invalid definition has been defined.