Documentation ¶
Index ¶
- Constants
- Variables
- func AddCobraCommands(parent *cobra.Command, generators []Generator)
- func ExecuteTemplate(content string, data interface{}) (string, error)
- func WriteFile(file *CodeFile, overwrite bool) (bool, error)
- func WriteFiles(files []CodeFile, overwrite bool, processedFile ProcessedFileCallback) error
- type Arg
- type CodeFile
- type Config
- type Generator
- type GeneratorArg
- type GeneratorArgsValues
- type GeneratorFunc
- type ProcessedFileCallback
- type Sources
- func (sources *Sources) AddGenerated(files ...*CodeFile)
- func (sources *Sources) AddGeneratedAll(files []CodeFile)
- func (sources *Sources) AddScaffolded(files ...*CodeFile)
- func (sources *Sources) AddScaffoldedAll(files []CodeFile)
- func (sources *Sources) Write(overwriteAll bool, processedFile ProcessedFileCallback) error
- type TheWriter
- func (w *TheWriter) EmptyLine()
- func (w *TheWriter) Indent()
- func (w *TheWriter) IndentWith(size int)
- func (w *TheWriter) Indented() Writer
- func (w *TheWriter) IndentedWith(size int) Writer
- func (w *TheWriter) Line(format string, args ...interface{})
- func (w *TheWriter) LineAligned(format string, args ...interface{})
- func (w *TheWriter) Lines(content string)
- func (w *TheWriter) String() string
- func (w *TheWriter) Template(data map[string]string, content string)
- func (w *TheWriter) ToCodeFile() *CodeFile
- func (w *TheWriter) Unindent()
- func (w *TheWriter) UnindentWith(size int)
- type Writer
Constants ¶
View Source
const Client = "client"
View Source
const ClientDescription = "client HTTP library"
View Source
const ClientTitle = "Client library"
View Source
const GeneratePath = "generate-path"
View Source
const GeneratePathDescription = "path to generate source code into"
View Source
const GeneratePathTitle = "Generate path"
View Source
const Jsonlib = "jsonlib"
View Source
const JsonlibDescription = "json serialization/deserialization library"
View Source
const JsonlibTitle = "JSON library"
View Source
const ModuleName = "module-name"
View Source
const ModuleNameDescription = "module name"
View Source
const ModuleNameTitle = "Module name"
View Source
const OutFile = "out-file"
View Source
const OutFileDescription = "path to output file"
View Source
const OutFileTitle = "Output file path"
View Source
const PackageName = "package-name"
View Source
const PackageNameDescription = "package name"
View Source
const PackageNameTitle = "Package name"
View Source
const Server = "server"
View Source
const ServerDescription = "server HTTP library/framework"
View Source
const ServerTitle = "Server library"
View Source
const ServicesPath = "services-path"
View Source
const ServicesPathDescription = "path to scaffold services code"
View Source
const ServicesPathTitle = "Services path"
View Source
const SpecFile = "spec-file"
View Source
const SpecFileDescription = "path to specification file"
View Source
const SpecFileTitle = "Spec file path"
View Source
const SwaggerPath = "swagger-path"
View Source
const SwaggerPathDescription = "path of generated OpenAPI (Swagger) specification file"
View Source
const SwaggerPathTitle = "Swagger path"
View Source
const Validation = "validation"
View Source
const ValidationDescription = "type validation library"
View Source
const ValidationTitle = "Type validation library"
Variables ¶
View Source
var ArgClient = Arg{Client, ClientTitle, ClientDescription}
View Source
var ArgGeneratePath = Arg{GeneratePath, GeneratePathTitle, GeneratePathDescription}
View Source
var ArgJsonlib = Arg{Jsonlib, JsonlibTitle, JsonlibDescription}
View Source
var ArgModuleName = Arg{ModuleName, ModuleNameTitle, ModuleNameDescription}
View Source
var ArgOutFile = Arg{OutFile, OutFileTitle, OutFileDescription}
View Source
var ArgPackageName = Arg{PackageName, PackageNameTitle, PackageNameDescription}
View Source
var ArgServer = Arg{Server, ServerTitle, ServerDescription}
View Source
var ArgServicesPath = Arg{ServicesPath, ServicesPathTitle, ServicesPathDescription}
View Source
var ArgSpecFile = Arg{SpecFile, SpecFileTitle, SpecFileDescription}
View Source
var ArgSwaggerPath = Arg{SwaggerPath, SwaggerPathTitle, SwaggerPathDescription}
View Source
var ArgValidation = Arg{Validation, ValidationTitle, ValidationDescription}
Functions ¶
func AddCobraCommands ¶
func ExecuteTemplate ¶
func WriteFiles ¶
func WriteFiles(files []CodeFile, overwrite bool, processedFile ProcessedFileCallback) error
Types ¶
type Generator ¶
type Generator struct { Name string Title string Usage string Args []GeneratorArg Generator GeneratorFunc }
type GeneratorArgsValues ¶
type GeneratorFunc ¶
type GeneratorFunc func(specification *spec.Spec, params GeneratorArgsValues) *Sources
type ProcessedFileCallback ¶
type Sources ¶
func NewSources ¶
func NewSources() *Sources
func (*Sources) AddGenerated ¶
func (*Sources) AddGeneratedAll ¶
func (*Sources) AddScaffolded ¶
func (*Sources) AddScaffoldedAll ¶
type TheWriter ¶
type TheWriter struct {
// contains filtered or unexported fields
}
func (*TheWriter) IndentWith ¶
func (*TheWriter) IndentedWith ¶
func (*TheWriter) LineAligned ¶
func (*TheWriter) ToCodeFile ¶
func (*TheWriter) UnindentWith ¶
type Writer ¶
type Writer interface { Line(format string, args ...interface{}) Lines(format string) Template(data map[string]string, content string) EmptyLine() LineAligned(format string, args ...interface{}) Indent() Unindent() IndentWith(size int) UnindentWith(size int) Indented() Writer IndentedWith(size int) Writer ToCodeFile() *CodeFile String() string }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.