generator

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// OutPkg holds the name of the output package
	OutPkg string
	// Files holds the code generation configuration for every file being processed
	Files []*FileConfig
	// IgnoreNoReturnMethods determines whether methods that don't return anything should be wrapped in the middleware or not.
	IgnoreNoReturnMethods bool
}

Config holds the code generation configuration for all of desired types

type FileConfig

type FileConfig struct {
	// contains filtered or unexported fields
}

FileConfig holds the code generation configuration for a specific type

func NewFileConfig

func NewFileConfig(srcTypeName, outTypeName string, typeParams []jen.Code, typeArgs []jen.Code, methods []*method.Method) *FileConfig

NewFileConfig creates a new instance of the FileConfig which holds code generation configuration

type Generated

type Generated struct {
	// Common is the golang code that is shared across all generated types
	Common string
	// Files is the golang code that was generated for every type that was processed
	Files []*GeneratedFile
}

Generated contains the code generation out for all the processed types

func Generate

func Generate(cfg Config) (*Generated, error)

Generate processes the given configuration and performs reinforcer's code generation

type GeneratedFile

type GeneratedFile struct {
	// TypeName is the type's name that has been generated, note that this is the output version not the source
	TypeName string
	// Contents is the golang code that was generated
	Contents string
}

GeneratedFile contains the code generation output for a specific type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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