Documentation
¶
Index ¶
- Variables
- func InList(s string, ss []string) bool
- func IsEnvFile(path string) bool
- func IsJSONFile(path string) bool
- func IsSimpleValue(i interface{}) bool
- func IsTOMLFile(path string) bool
- func IsYAMLFile(path string) bool
- func OutputCfg(link *Link, outputType Format) (interface{}, error)
- func SimpleValueToString(i interface{}) (str string, err error)
- type CfgMap
- type Format
- type Gear
- type Link
- type LinkFilter
- type LinkMap
- type ReadType
- type Resolver
- type Visitor
Constants ¶
This section is empty.
Variables ¶
var EnvSubst bool = false
EnvSubst decides whether to use environmental substitution or not
var NoEnc bool = false
NoEnc decides whether to output encrypted variables or now
var RecursionLimit int = 12
RecursionLimit is the limit used to define when to abort successive traversals of gears
Functions ¶
func IsEnvFile ¶ added in v0.6.0
IsEnvFile returns true if a given file path corresponds to a .env file
func IsJSONFile ¶ added in v0.6.0
IsJSONFile returns true if a given file path corresponds to a JSON file
func IsSimpleValue ¶ added in v0.7.1
func IsSimpleValue(i interface{}) bool
IsSimpleValue is intended to see if the underlying value allows a flat map to be retained
func IsTOMLFile ¶ added in v0.6.0
IsTOMLFile returns true if a given file path corresponds to a TOML file
func IsYAMLFile ¶ added in v0.6.0
IsYAMLFile returns true if a given file path corresponds to a YAML file
func SimpleValueToString ¶ added in v0.7.2
SimpleValueToString converts an undelying type to a string, returning an error if it is not a simple value
Types ¶
type CfgMap ¶ added in v0.7.0
type CfgMap map[string]interface{}
CfgMap is meant to represent a map with values of one or more unknown types
type Format ¶ added in v0.6.0
type Format string
TODO reconcile readType and Format patterns Format represents the final marshalled k/v output type from a resolved Gear
const ( JSON Format = "json" YAML Format = "yaml" TOML Format = "toml" Dotenv Format = "dotenv" Raw Format = "raw" )
Formats for respective object notation
func FormatForPath ¶ added in v0.6.0
FormatForPath returns the correct format given the path to a file
func FormatLinkInput ¶ added in v0.7.2
FormatLinkInput returns the correct format given the readType
type Gear ¶
type Gear struct { Name string // contains filtered or unexported fields }
Gear represents one of the contexts in a cog manifest. The term "gear" is used to refer to the operating state of a machine (similar to how a microservice can operate locally or in a remote environment) rather than a gear object. The term "switching gears" is an apt representation of how one Cog manifest file can have many contexts/environments
func (*Gear) ResolveMap ¶
ResolveMap outputs the flat associative string, resolving potential filepath pointers held by Link objects by calling the .SetValue() method
type Link ¶ added in v0.7.0
type Link struct { KeyName string // the key name defined in the context file SearchName string // same as keyName unless redefined using the `name` key: var.name="other_name" Value interface{} // Holds a complex or simple value for the given Link Path string // filepath string where Link can be resolved SubPath string // object traversal string used to resolve Link if not at top level of document (yq syntax) // contains filtered or unexported fields }
Link holds all the data needed to resolve one string key value pair
type LinkFilter ¶ added in v0.7.1
LinkFilter if a function meant to filter a LinkMap
type LinkMap ¶ added in v0.7.0
LinkMap is used by Resolver to output the final k/v associative array
type ReadType ¶ added in v0.7.3
type ReadType string
ReadType represents the logic used to dereive the deserliazied value for a given Link
func (ReadType) GetUnmarshal ¶ added in v0.7.3
GetUnmarshal returns the corresponding function to unmarshal a given read type
type Resolver ¶
Resolver is meant to define an object that returns the final string map to be used in a configuration resolving any paths and sub paths defined in the underling config map
type Visitor ¶ added in v0.6.0
Visitor allows a query path to return the underlying value for a given visitor
func NewDotenvVisitor ¶ added in v0.6.0
NewDotenvVisitor returns a visitor object that satisfies the Visitor interface attempting to turn a supposed dotenv byte slice into a *yaml.Node object
func NewJSONVisitor ¶ added in v0.5.0
NewJSONVisitor returns a visitor object that satisfies the Visitor interface attempting to turn a supposed JSON byte slice into a *yaml.Node object
func NewTOMLVisitor ¶ added in v0.6.0
NewTOMLVisitor returns a visitor object that satisfies the Visitor interface attempting to turn a supposed TOML byte slice into a *yaml.Node object
func NewYAMLVisitor ¶ added in v0.6.0
NewYAMLVisitor returns a visitor object that satisfies the Visitor interface