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 ¶
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) PopulateQueries ¶
PopulateQueries :: convert a map of queries into a sorted array and set Queries property
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) InitialiseFromFile ¶
func (q *Query) InitialiseFromFile(modPath, filePath string) (MappableResource, error)
InitialiseFromFile :: implementation of MappableResource
Click to show internal directories.
Click to hide internal directories.