Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPluginError ¶
IsPluginError checks if the error was returned by Plugin.Pipe
func NewPluginError ¶
NewPluginError wraps an error to specify it was returned by Plugin.Pipe
func WithoutBoilerplate ¶
func WithoutBoilerplate(universe *Universe)
WithoutBoilerplate is used for files that do not require a boilerplate
Types ¶
type Plugin ¶
type Plugin interface { // Pipe is the core plugin interface, that transforms a UniverseModel Pipe(*Universe) error }
Plugin is the interface that a plugin must implement We will (later) have an ExecPlugin that implements this by exec-ing a binary
type Universe ¶
type Universe struct { // Config stores the project configuration Config config.Config `json:"config,omitempty"` // Boilerplate is the copyright comment added at the top of scaffolded files Boilerplate string `json:"boilerplate,omitempty"` // Resource contains the information of the API that is being scaffolded Resource *resource.Resource `json:"resource,omitempty"` // Files contains the model of the files that are being scaffolded Files map[string]*file.File `json:"files,omitempty"` }
Universe describes the entire state of file generation
func NewUniverse ¶
func NewUniverse(options ...UniverseOption) *Universe
NewUniverse creates a new Universe
func (Universe) InjectInto ¶
InjectInto injects fields from the universe into the builder
type UniverseOption ¶
type UniverseOption func(*Universe)
UniverseOption configure Universe
func WithBoilerplate ¶
func WithBoilerplate(boilerplate string) UniverseOption
WithBoilerplate stores the already loaded project configuration
func WithConfig ¶
func WithConfig(projectConfig config.Config) UniverseOption
WithConfig stores the already loaded project configuration
func WithResource ¶
func WithResource(resource *resource.Resource) UniverseOption
WithResource stores the provided resource