Documentation ¶
Index ¶
- func AddComponent(parent *ast.File, compo *adl.Struct) (component *ast.Struct, _ error)
- func AddParseEnvFunc(fieldPrefix string, node *ast.Struct) (*ast.Func, error)
- func AddParseFlagFunc(fieldPrefix string, node *ast.Struct) (*ast.Func, error)
- func AddResetFunc(node *ast.Struct) (*ast.Func, error)
- func GlobalFlatName(n ast.NamedType) string
- func GlobalFlatName2(n ast.TypeDecl) string
- func ImplementFunctions(from *ast.Interface, to *ast.Struct)
- func MakePkgPath(frags ...string) string
- func MakePrivate(str string) string
- func MakePublic(str string) string
- func MkFile(dst *ast.Prj, modName, pkgName, fname string) *ast.File
- func ModName(n ast.Node) string
- func PkgName(n ast.Node) string
- func PkgPathBase(p string) string
- func PkgPathDir(p string) string
- func PkgRelativeName(n ast.Node) string
- func ShortModName(n ast.Node) string
- func SimulateDefaultJson(node *ast.Struct) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddComponent ¶
AddComponent transpiles the given component and may optionally create multiple additional helper types, like default implementations and configuration types.
func AddParseEnvFunc ¶
AddParseEnvFunc appends a method named "ParseEnv" which has the given struct as a pointer receiver and sets all defined environment variables to the environment one.
func AddParseFlagFunc ¶
AddParseFlagFunc appends a method named "ConfigureFlags" which has the given struct as a pointer receiver and sets all defined struct variables to the flag ones. The go flags package to be parsed by the according struct instance. The naming is <a>-<b>-<c> for the flags. On unix, camel case is discouraged, so we have only the alternatives of . _ or - and we decided for now, to use -.
func AddResetFunc ¶
AddResetFunc appends a method named "Reset" which has the given struct as a pointer receiver and sets all literals back to default.
func GlobalFlatName ¶
GlobalFlatName tries to generate a readable and globally unique name without evaluating the actual context.
func GlobalFlatName2 ¶
GlobalFlatName2 tries to generate a readable and globally unique name without evaluating the actual context.
func ImplementFunctions ¶
ImplementFunctions appends all interface methods to the given struct. Funcs with errors will return a not-implemented-error, otherwise a panic is raised.
func MakePkgPath ¶
MakePkgPath takes arbitrary fragments and creates a more or less idiomatic path of it.
func PkgPathBase ¶
PkgPathBase is like filepath.Base but always with /
func PkgPathDir ¶
PkgPathDir is like filepath.Dir but always with /
func PkgRelativeName ¶
PkgRelativeName returns the relative path within the given module name.
func ShortModName ¶
func SimulateDefaultJson ¶
SimulateDefaultJson inspects the fields default values and estimates how a potential json serialization may look like. Better to call AddResetFunc before, to ensure more correctly defined default values.
Types ¶
This section is empty.