codegenerator

package
v0.0.0-...-7144ed9 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCode

func GenerateCode(structs []*analyzer.Struct) (map[string]*Pkg, error)

func StructToTpl

func StructToTpl(st *analyzer.Struct) *structTpl

Types

type ConditionByType

type ConditionByType struct {
	AcceptedTypes []string
	ConditionTable
}

type ConditionTable

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

ConditionTable defines the template for generating a condition check for a specific type.

func GetConditionTable

func GetConditionTable(operation string, fieldType common.FieldType) (ConditionTable, error)

type GenValidations

type GenValidations struct {
	StructsWithValidation map[string]struct{}
	Struct                *analyzer.Struct
}

func (*GenValidations) BuildFuncValidatorCode

func (gv *GenValidations) BuildFuncValidatorCode() (string, error)

func (*GenValidations) BuildValidationCode

func (gv *GenValidations) BuildValidationCode(fieldName string, fieldType common.FieldType, fieldValidations []*analyzer.Validation) (string, error)

type Operation

type Operation struct {
	ConditionByTypes []ConditionByType
}

type Pkg

type Pkg struct {
	Name    string
	Path    string
	Imports map[string]parser.Import
	Structs map[string]*Struct
}

type Struct

type Struct struct {
	*analyzer.Struct
	ValidatorFuncCode string
}

type TestElements

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

func DefineTestElements

func DefineTestElements(fieldName string, fieldType common.FieldType, fieldValidation *analyzer.Validation) (TestElements, error)

Jump to

Keyboard shortcuts

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