generate

package
v0.0.0-...-22c902c Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Import = "github.com/miekg/dnsv2"

Import is our package name.

Variables

View Source
var Funcs = template.FuncMap{
	"ToUpper": strings.ToUpper,
	"ToLower": strings.ToLower,
}

Funcs are default funcs we use in the templates.

Functions

func Hdr

func Hdr(w io.Writer, name string, imports ...[]string)

Hdr is the header each generator puts at the top of the generated file.

func Load

func Load() (*types.Package, error)

Load retrieves package description for a given module.

func Name

func Name(w io.Writer, name string, last bool)

Name writes the Go code to set an Name.

func New

func New(name, s string) *template.Template

New returns a new template use for generating Go code.

func RR

func RR(t types.Type, scope *types.Scope) *types.Struct

RR will take a type and the package scope, and return the (innermost) struct if the type is considered a RR type

func SaveSource

func SaveSource(buf []byte, filename string) error

SaveSource formats the source in buf and saves it into filename. Filename should start with a 'z'.

func Types

func Types(pkg *types.Package, prefix string) []string

Types returns the types that share the prefix, prefix<None> is always excluded.

func TypesOf

func TypesOf(pkg *types.Package, typ string) []string

TypesOf returns the types the implement the type typ.

func Uint16

func Uint16(w io.Writer, name string, last bool)

Uint16 writes the Go code to set an [2]byte.

func Uint32

func Uint32(w io.Writer, name string, last bool)

Uint32 writes the Go code to set an [4]byte.

Types

This section is empty.

Jump to

Keyboard shortcuts

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