model

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

func (u Universe) InjectInto(builder file.Builder)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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