Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name string, customizer Customizer)
Register makes a Customizer available by name. If a Customizer by the same name is registered, an error is thrown.
Types ¶
type Customizer ¶
type Customizer interface { // FileNamePrefix gives a prefix for the generated file name. FileNamePrefix() string // FactorySuffix provides a variant typed suffix for a Factory method // generated for the middleware. FactorySuffix() string // ConfigureModel takes the given ServiceModel and can apply any specifications // such as desired inputs to the Factory method, ConfigureModel(model *ServiceModel) GetRequiredImportNames() map[string]string // GenerateFunctionImplementation will be passed in a builder // of pre-computed code statements as the function declaration // as described by the passed-in DeclaredFunction. It is important // to note that no code blocks have been created at this point, see // jen.Block for more details. GenerateFunctionImplementation(builder *jen.Statement, service *ServiceModel, method interpreter.DeclaredFunction) jen.Code }
Customizer is utilized by Generator to specify the generated output of a desired middleware. Each instance should be registered with generator.Register.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is an object to take an interpreted interpreter.ServiceModel and using a Customizer, generates the middleware output.
func (*Generator) AddFileHeader ¶
func (*Generator) AddModel ¶
func (g *Generator) AddModel(model *ServiceModel)
func (*Generator) SetupCustomizer ¶
type MiddlewareParameter ¶
type ServiceModel ¶
type ServiceModel struct { TypeName string Middleware string StructPrefix string Interface []interpreter.DeclaredFunction InputParameters []MiddlewareParameter StructPtr string ServicePtr string }
Click to show internal directories.
Click to hide internal directories.