Documentation
¶
Index ¶
- func DefNameIsAllowed(name string) error
- func FormatDefName(name string) string
- func FormatPkgName(name string) string
- func WriteTemplate(output string, tmpl string, data interface{}) error
- type ParamInfo
- type ParamScanner
- type Provider
- type RegisteredType
- type Scan
- type ScannedDef
- type Scanner
- type TypeManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefNameIsAllowed ¶
DefNameIsAllowed returns an error if the definition name is not allowed.
func FormatDefName ¶
FormatDefName is the function used to turn the definition name into something that can be used as a method name for the generated container.
func FormatPkgName ¶
FormatPkgName formats a package name by keeping only the letters.
func WriteTemplate ¶
WriteTemplate executes the given templates with the given data. Then it stores the result in the output file.
Types ¶
type ParamInfo ¶
type ParamInfo struct { Name string Index string ServiceName string Type string Empty string UndefinedStructParam bool Def *ScannedDef }
ParamInfo contains the parsed information about a parameter.
type ParamScanner ¶
type ParamScanner struct {
// contains filtered or unexported fields
}
ParamScanner helps the Scanner. It scans information about params.
func (*ParamScanner) Scan ¶
func (s *ParamScanner) Scan(scan *Scan) error
Scan updates the given Scan with data about params.
type Provider ¶
Provider is an interface that contains the public methods of the generated Provider. It is used in the Scanner because it avoids generating a Scanner from a template to include the generated Provider.
type RegisteredType ¶
RegisteredType is the representation of a type. It contains the type name and how to write its empty value in a go file.
func NewRegisteredType ¶
func NewRegisteredType(typ, empty string) *RegisteredType
NewRegisteredType is the RegisteredType constructor.
type Scan ¶
type Scan struct { TypeManager *TypeManager ImportsWithoutParams map[string]string Defs []*ScannedDef }
Scan contains the parsed information about the service definitions.
type ScannedDef ¶
type ScannedDef struct { Def *dingo.Def Name string FormattedName string Scope string ObjectType string EmptyObject string BuildIsFunc bool BuildType string Params map[string]*ParamInfo CloseType string }
ScannedDef contains the parsed information about a service definition.
func (*ScannedDef) BuildDependsOnRawDef ¶
func (def *ScannedDef) BuildDependsOnRawDef() bool
BuildDependsOnRawDef returns true if the service contructor needs the definition contained in the Provider.
func (*ScannedDef) ParamsString ¶
func (def *ScannedDef) ParamsString() string
ParamsString returns the parameters as they should appear in a structure inside a go file.
type Scanner ¶
type Scanner struct { Provider Provider ParamScanner ParamScanner // contains filtered or unexported fields }
Scanner analyzes the definitions provided by a Provider.
type TypeManager ¶
type TypeManager struct {
// contains filtered or unexported fields
}
TypeManager maintains a list of all the import paths that are used in the types that it has registered. It associates a unique alias to all the import paths.
func (*TypeManager) Imports ¶
func (tm *TypeManager) Imports() map[string]string
Imports returns a map with all the imports that are used in the registered types. The key is the import path and the value is the alias that has been given by the TypeManager.
func (*TypeManager) Register ¶
func (tm *TypeManager) Register(t reflect.Type) (*RegisteredType, error)
Register adds a new type in the TypeManager.