generators

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(pkgName string, data []Data) []byte

Types

type BuildValues

type BuildValues struct {
	BuilderValues
	BuilderMethodName string
	ArgumentType      string
	FakeName          string
}

type BuilderGenerator

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

func NewBuilderGenerator

func NewBuilderGenerator(node *ast.TypeSpec, annotation annotations.Builder, an annotation.Node) *BuilderGenerator

func (*BuilderGenerator) Generate

func (g *BuilderGenerator) Generate(pcvs []PostConstructValues) ([]byte, []Import, error)

func (*BuilderGenerator) Name

func (g *BuilderGenerator) Name() string

type BuilderValues

type BuilderValues struct {
	BuilderTypeName      string
	ConstructorName      string
	BuildMethodName      string
	ReturnType           string
	IsParametrized       bool
	IsPointer            bool
	ParameterConstraints string
	Parameters           string
	Arguments            []struct {
		FakeName string
		Name     string
		Type     string
	}
	Fields []struct {
		FakeName string
		Name     string
		Value    string
	}
	PostConstructs []string
}

type ConstructorGenerator

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

func NewConstructorGenerator

func NewConstructorGenerator(node *ast.TypeSpec, annotation annotations.Constructor, an annotation.Node) *ConstructorGenerator

func (*ConstructorGenerator) Generate

func (g *ConstructorGenerator) Generate(pcvs []PostConstructValues) ([]byte, []Import, error)

func (*ConstructorGenerator) Name

func (g *ConstructorGenerator) Name() string

type ConstructorValues

type ConstructorValues struct {
	FunctionName         string
	Arguments            []string
	ReturnType           string
	IsPointer            bool
	IsParametrized       bool
	ParameterConstraints string
	Parameters           string
	Fields               []struct {
		Name  string
		Value string
	}
	PostConstructs []string
}

type Data

type Data struct {
	Data    []byte
	Imports []Import
}

type FileValues

type FileValues struct {
	PackageName string
	HasImports  bool
	Imports     []Import
	Data        string
}

type Import

type Import struct {
	Alias   string
	Package string
}

type OptionalGenerator

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

func NewOptionalGenerator

func NewOptionalGenerator(node *ast.TypeSpec, annotation annotations.Optional, an annotation.Node) *OptionalGenerator

func (*OptionalGenerator) Generate

func (g *OptionalGenerator) Generate(pcvs []PostConstructValues) ([]byte, []Import, error)

func (*OptionalGenerator) Name

func (g *OptionalGenerator) Name() string

type OptionalValues

type OptionalValues struct {
	OptionalTypeName     string
	FunctionName         string
	ReturnType           string
	IsParametrized       bool
	IsPointer            bool
	ParameterConstraints string
	Parameters           string
	Fields               []struct {
		Name  string
		Value string
	}
	PostConstructs []string
}

type PostConstructValues

type PostConstructValues struct {
	Annotation annotations.PostConstruct
	MethodName string
}

func PostConstructReceiverName

func PostConstructReceiverName(node annotation.Node) (string, PostConstructValues, error)

type WithValues

type WithValues struct {
	OptionalValues
	WithFunctionName string
	ArgumentType     string
	FieldName        string
}

Jump to

Keyboard shortcuts

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