Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFileAlreadyExists = errors.New("file already exists") ErrUnknownAction = errors.New("unknown action") )
Functions ¶
This section is empty.
Types ¶
type HasModulePath ¶
type HasModulePath interface { // InjectModulePath sets the template module path. InjectModulePath(string) }
HasModulePath allows a module path to be used in a template.
type HasProjectName ¶
type HasProjectName interface { // InjectProjectName sets the template project name. InjectProjectName(string) }
HasProjectName allows a project name to be used in a template.
type HasProtobufSupport ¶
type HasProtobufSupport interface { // InjectProtobufSupport injects the template with protobuf support. InjectProtobufSupport(bool) }
HasProtobufSupport signals that the project should be generated with protobuf support.
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 overwrites the existing file. Overwrite )
type ModulePathMixin ¶
type ModulePathMixin struct { // ModulePath is the name of the Go module. ModulePath string }
func (*ModulePathMixin) InjectModulePath ¶
func (m *ModulePathMixin) InjectModulePath(modulePath string)
InjectModulePath implements HasModulePath.
type ProjectNameMixin ¶
type ProjectNameMixin struct { // ProjectName is the name of the project. ProjectName string }
func (*ProjectNameMixin) InjectProjectName ¶
func (m *ProjectNameMixin) InjectProjectName(projectName string)
InjectProjectName implements HasProjectName.
type ProtobufMixin ¶
type ProtobufMixin struct { // ProtobufSupport signals that the project should be generated with // protobuf support. ProtobufSupport bool }
func (*ProtobufMixin) InjectProtobufSupport ¶
func (m *ProtobufMixin) InjectProtobufSupport(protobufSupport bool)
InjectProtobufSupport implements ProtobufSupport.
type Scaffolder ¶
type Scaffolder struct {
// contains filtered or unexported fields
}
func NewScaffolder ¶
func NewScaffolder() *Scaffolder
type Template ¶
type Template interface { // GetPath returns the path to the file's location. GetPath() string // GetBody returns the template body. GetBody() string // GetIfExistsAction determines what to do if the file already exists. GetIfExistsAction() IfExistsAction // SetTemplateDefaults sets the default values for templates. SetTemplateDefaults() error }
type TemplateMixin ¶
type TemplateMixin struct { // Path is the path of the file. Path string // TemplateBody is the template body to execute. TemplateBody string // IFExistsAction determines what to do if the file exists. IfExistsAction IfExistsAction }
func (*TemplateMixin) GetBody ¶
func (m *TemplateMixin) GetBody() string
func (*TemplateMixin) GetPath ¶
func (m *TemplateMixin) GetPath() string
Click to show internal directories.
Click to hide internal directories.