gengo

package
v0.0.0-...-86a089b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2019 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package gengo provides code generation helpers go code generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeclareType

func DeclareType(c *gen.Gen, m *dom.Model) (err error)

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 DefaultPkgs() map[string]string

func Import

func Import(c *gen.Gen, name string) string

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 NewCtx

func NewCtx(pr *dom.Project, pkg, path string) *gen.Gen

func NewCtxPkgs

func NewCtxPkgs(pr *dom.Project, pkg, path string, pkgs map[string]string) *gen.Gen

func RenderFile

func RenderFile(c *gen.Gen, s *dom.Schema) error

RenderFile writes the elements to a go file with package and import declarations.

For now only bits, enum and rec type definitions are supported

func WriteFile

func WriteFile(c *gen.Gen, fname string, s *dom.Schema) error

func WriteLit

func WriteLit(c *gen.Gen, l lit.Lit) error

WriteLit writes the native go literal for l to c or returns an error.

func WriteType

func WriteType(c *gen.Gen, t typ.Type) error

WriteType writes the native go type for t to c or returns an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL