gen

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: 5 Imported by: 0

Documentation

Overview

Package gen provides generic code generation helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DomFile

func DomFile(fname string, pr *dom.Project) (*dom.Schema, error)

Types

type Gen

type Gen struct {
	bfr.Ctx
	*dom.Project
	Pkg    string
	Target string
	Header string
	OpPrec int
	Pkgs   map[string]string
	Imports
}

Gen is the code generation context holding the buffer and additional information.

func (*Gen) Prec

func (c *Gen) Prec(prec int) (restore func())

func (*Gen) Prepend

func (c *Gen) Prepend(text, prefix string)

Prepend write each line in text prepended with prefix to the buffer. It strips the ascii whitespace bytes after the first linebreak, and tries to remove the same from each following line. If text starts with an empty line, that line is ignored.

type Imports

type Imports struct {
	List []string
}

Imports has a list of alphabetically sorted dependencies. A dependency can be any string recognized by the generator. For go imports the dependency is a package path.

func (*Imports) Add

func (i *Imports) Add(path string)

Add inserts path into the import list if not already present.

Directories

Path Synopsis
Package gengo provides code generation helpers go code generation.
Package gengo provides code generation helpers go code generation.
Package genpg provides code generation helpers postgresql query and schema generation.
Package genpg provides code generation helpers postgresql query and schema generation.

Jump to

Keyboard shortcuts

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