Help us shape the future of Go! Take the 2026 Go Developer Survey

input

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boilerplate

type Boilerplate interface {
	// SetBoilerplate sets the boilerplate text
	SetBoilerplate(string)
}

Boilerplate allows boilerplate text to be set on an object

type BoilerplatePath

type BoilerplatePath interface {
	// SetBoilerplatePath sets the boilerplate file path
	SetBoilerplatePath(string)
}

BoilerplatePath allows boilerplate file path to be set on an object

type Domain

type Domain interface {
	// SetDomain sets the domain
	SetDomain(string)
}

Domain allows a domain to be set on an object

type File

type File interface {
	// GetInput returns the Input for creating a scaffold file
	GetInput() (Input, error)
}

File is a scaffoldable file

type IfExistsAction

type IfExistsAction int

IfExistsAction determines what to do if the scaffold file already exists

const (
	// Skip skips the file and moves to the next one
	Skip IfExistsAction = iota

	// Error returns an error and stops processing
	Error

	// Overwrite truncates and overwrites the existing file
	Overwrite
)

type Input

type Input struct {
	// Path is the file to write
	Path string

	// IfExistsAction determines what to do if the file exists
	IfExistsAction IfExistsAction

	// TemplateBody is the template body to execute
	TemplateBody string

	// Boilerplate is the contents of a Boilerplate go header file
	Boilerplate string

	// BoilerplatePath is the path to a Boilerplate go header file
	BoilerplatePath string

	// Version is the project version
	Version string

	// Domain is the domain for the APIs
	Domain string

	// Repo is the go project package
	Repo string

	// ProjectPath is the relative path to the project root
	ProjectPath string
}

Input is the input for scaffoldig a file

func (*Input) SetBoilerplate

func (i *Input) SetBoilerplate(b string)

SetBoilerplate sets the boilerplate text

func (*Input) SetBoilerplatePath

func (i *Input) SetBoilerplatePath(bp string)

SetBoilerplatePath sets the boilerplate file path

func (*Input) SetDomain

func (i *Input) SetDomain(d string)

SetDomain sets the domain

func (*Input) SetProjectPath

func (i *Input) SetProjectPath(p string)

SetProjectPath sets the project path

func (*Input) SetRepo

func (i *Input) SetRepo(r string)

SetRepo sets the repo

func (*Input) SetVersion

func (i *Input) SetVersion(v string)

SetVersion sets the project version

type Options

type Options struct {
	// BoilerplatePath is the path to the boilerplate file
	BoilerplatePath string

	// Path is the path to the project
	ProjectPath string
}

Options are the options for executing scaffold templates

type ProjecPath

type ProjecPath interface {
	// SetProjectPath sets the project file location
	SetProjectPath(string)
}

ProjecPath allows the project path to be set on an object

type ProjectFile

type ProjectFile struct {
	// Version is the project version - defaults to "2"
	Version string `yaml:"version,omitempty"`

	// Domain is the domain associated with the project and used for API groups
	Domain string `yaml:"domain,omitempty"`

	// Repo is the go package name of the project root
	Repo string `yaml:"repo,omitempty"`
}

ProjectFile is deserialized into a PROJECT file

type Repo

type Repo interface {
	// SetRepo sets the repo
	SetRepo(string)
}

Repo allows a repo to be set on an object

type Validate

type Validate interface {
	// Validate returns true if the template has valid values
	Validate() error
}

Validate validates input

type Version

type Version interface {
	// SetVersion sets the project version
	SetVersion(string)
}

Version allows the project version to be set on an object

Jump to

Keyboard shortcuts

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