modconfig

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceTypeMap = map[string]factoryFunc{
	constants.SqlExtension: func(modPath, filePath string) (MappableResource, error) { return QueryFromFile(modPath, filePath) },
}

Functions

func PseudoResourceNameFromPath

func PseudoResourceNameFromPath(modPath, filePath string) (string, error)

PseudoResourceNameFromPath :: convert a filepath into a resource name: 1) convert into a relative path from the working folder 2) remove extension 3) sluggify, with '_' as the divider

func RegisteredFileExtensions

func RegisteredFileExtensions() []string

Types

type MappableResource

type MappableResource interface {
	// initialise the mod resource from the file of the given path
	InitialiseFromFile(modPath, filePath string) (MappableResource, error)
}

MappableResource :: a mod resource which can be created directly from a content file (e.g. sql, markdown)

func QueryFromFile

func QueryFromFile(modPath, filePath string) (MappableResource, error)

QueryFromFile :: factory function

type Mod

type Mod struct {
	Name          string
	Title         string `hcl:"title"`
	Description   string `hcl:"description"`
	Version       string
	ModDepends    []*ModVersion
	PluginDepends []*PluginDependency
	Queries       []*Query
}

func (*Mod) FullName

func (m *Mod) FullName() string

func (*Mod) PopulateQueries

func (mod *Mod) PopulateQueries(queries map[string]*Query)

PopulateQueries :: convert a map of queries into a sorted array and set Queries property

func (*Mod) String

func (m *Mod) String() string

type ModMap

type ModMap map[string]*Mod

ModMap :: map of mod name to mod-version map

func (ModMap) String

func (m ModMap) String() string

type ModVersion

type ModVersion struct {
	// the fully qualified mod name, e.g. github.com/turbot/mod1
	Name    string  `hcl:"name"`
	Version string  `hcl:"version"`
	Alias   *string `hcl:"alias"`
}

func (*ModVersion) FullName

func (m *ModVersion) FullName() string

FullName :: return Name@Version

func (*ModVersion) HasVersion

func (m *ModVersion) HasVersion() bool

HasVersion :: if no version is specified, or the version is "latest", this is the latest version

func (*ModVersion) String

func (m *ModVersion) String() string

type PluginDependency

type PluginDependency struct {
	// the fully qualified plugin name, e.g. github.com/turbot/mod1
	Name string `hcl:"name"`
	// the version STREAM, can be either a major or minor version stream i.e. 1 or 1.1
	Version string `hcl:"version"`
}

func (*PluginDependency) FullName

func (p *PluginDependency) FullName() string

func (*PluginDependency) String

func (p *PluginDependency) String() string

type Query

type Query struct {
	Name        string
	Title       string `hcl:"title"`
	Description string `hcl:"description"`
	SQL         string `hcl:"sql"`
}

func (*Query) Equals

func (q *Query) Equals(other *Query) bool

func (*Query) InitialiseFromFile

func (q *Query) InitialiseFromFile(modPath, filePath string) (MappableResource, error)

InitialiseFromFile :: implementation of MappableResource

func (*Query) String

func (q *Query) String() string

Jump to

Keyboard shortcuts

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