Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeTypesMaps ¶
func MergeTypesMaps(maps ...stringlist.StringMap) stringlist.StringMap
MergeTypesMaps Merge merges all properties from an ancestor TypeMap.
Types ¶
type Config ¶
type Config struct {
// Database connection
DB DBInput `yaml:"db,omitempty"`
// List of file sets
Files FileInputMap `yaml:"files,omitempty"`
// Format Defaults (e.g. go, openapi, swift).
Formats Processes `yaml:"formats,omitempty"`
// Map of all processes
Processes Processes `yaml:"processes,omitempty"`
}
type DBInput ¶
type DBInput struct {
// DB Connection string.
// e.g. `host=localhost dbname=MyProject sslmode=disable`
Connection string `yaml:"connection,omitempty"`
// Regex for filtering the properties.
// e.g. ".*\\.schema_migrations"
Filter stringlist.Strings `yaml:"filter,omitempty"`
}
type FileHandler ¶
type FileInput ¶
type FileInput struct {
// Files to process, supports glob syntax https://golang.org/pkg/path/filepath/#Match
Files stringlist.Strings
// Optional regex for filtering the files. The filename must not match any of the filter
// expressions to be considered valid.
Filter stringlist.Strings `yaml:"filter,omitempty"`
Rewrite stringlist.StringMap `yaml:"rewrite,omitempty"` // Optional rules for rewriting file names
}
type FileInputMap ¶
func (FileInputMap) Merge ¶
func (ff FileInputMap) Merge(from FileInputMap) FileInputMap
Merge merges all properties from an ancestor FileInputMap.
type Maps ¶
type Maps struct {
Type stringlist.StringMap `yaml:"type,omitempty"` // Type maps (varchar -> string)
Nullable stringlist.StringMap `yaml:"nullable,omitempty"` // Type maps for nullable types (varchar -> sql.NullString)
Name stringlist.StringMap `yaml:"name,omitempty"` // Name maps (addr_l1 -> address_line_1)
// special purpose case settings. Can be used in templates with "caseType" command.
Case stringlist.StringMap `yaml:"case,omitempty"`
}
Maps are a set of lookups for mapping various attributes (type, name, case) for welds.
type Output ¶
type Output map[string]stringlist.StringMap
func (Output) All ¶
func (o Output) All() stringlist.StringMap
All merges all the mapped TypeMaps into a single StringMap, useful for getting the list of all templates.
type ParamMap ¶
func (ParamMap) GetWithDefault ¶ added in v0.1.1
GetWithDefault returns a string param identified by `name`, otherwise returns the default.
type Process ¶
type Process struct {
Output `yaml:",inline"`
// Used to make a bundle of processes, if populated all other attributes are ignored
Processes stringlist.Strings `yaml:"processes,omitempty,flow"`
// ID of the process (used for bundle processes), populated by Processes.Merge
ID string `yaml:"-"`
// Output format, used to get defaults for naming, mapping, post processor
Format string `yaml:"format,omitempty"`
// Default case function (e.g snake, pascal, camel, kebab)
Case string `yaml:"case,omitempty"`
// Used for mapping data from Input to Output
Maps Maps `yaml:"maps,omitempty"`
// List of post-processing commands for each file generated (commonly used to invoke formatters like goimports)
Post stringlist.Strings2D `yaml:"post,omitempty,flow"`
// Custom parameters that can be passed into each template
Params ParamMap `yaml:"params,omitempty"`
// List of files to use as input
Files FileInput `yaml:"files,omitempty"`
// Root directory for outputs
RootDir string `yaml:"rootDir,omitempty"`
// ID of shared resources used for file input
Resources stringlist.Strings `yaml:"resources,omitempty,flow"`
}
Process encapsulates all data for executing a weld.
type Processes ¶
func (Processes) ApplyFormat ¶
ApplyFormat merges linked format into each process config.
func (Processes) Keys ¶
func (pp Processes) Keys() stringlist.Strings
Keys is a simple helper that returns the list of keys in the processes map.
Click to show internal directories.
Click to hide internal directories.