Documentation
¶
Overview ¶
Package gengo provides code generation helpers go code generation.
Index ¶
- func DeclareType(c *gen.Gen, m *dom.Model) (err error)
- func DefaultPkgs() map[string]string
- func Import(c *gen.Gen, name string) string
- func NewCtx(pr *dom.Project, pkg, path string) *gen.Gen
- func NewCtxPkgs(pr *dom.Project, pkg, path string, pkgs map[string]string) *gen.Gen
- func RenderFile(c *gen.Gen, s *dom.Schema) error
- func WriteFile(c *gen.Gen, fname string, s *dom.Schema) error
- func WriteLit(c *gen.Gen, l lit.Lit) error
- func WriteType(c *gen.Gen, t typ.Type) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeclareType ¶
DeclareType writes a type declaration for bits, enum and rec types. For bits and enum types the declaration includes the constant declarations.
func DefaultPkgs ¶
func Import ¶
Import takes a qualified name of the form 'pkg.Decl', looks up a path from context packages map if available, otherwise the name is used as path. If the package path is the same as the context package it returns the 'Decl' part. Otherwise it adds the package path to the import list and returns a substring starting with last package path segment: 'pkg.Decl'.
func NewCtxPkgs ¶
func RenderFile ¶
RenderFile writes the elements to a go file with package and import declarations.
For now only bits, enum and rec type definitions are supported
Types ¶
This section is empty.