codegen

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderStringFromGenerator

func RenderStringFromGenerator(s string, g Generator) (string, error)

RenderStringFromGenerator receives a Generator that is used to render the received template string.

Types

type CodeGen

type CodeGen struct {
	TemplateDir     string
	TemplateName    string
	DestinationDir  string
	DestinationFile string
	Source          Path
	Destination     Path
}

func (*CodeGen) WriteFile

func (c *CodeGen) WriteFile(g Generator) error

WriteFile creates a new file, where the output from rendering template using the received Generator will be stored.

type Generator

type Generator interface {
	Generate(*schema.Schema, *config.GeneratorConfig, *config.PackageConfig) error
	Execute(*config.GeneratorConfig, *config.PackageConfig) error
}

Generator aspires to implement the interface between a NerdGraph schema and generated code for another project.

type Path

type Path struct {
	// Directory is the path to directory that will store the file, eg: pkg/nerdgraph
	Directory string
	// File is the name of the file within the directory
	File string
}

Jump to

Keyboard shortcuts

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