Documentation
¶
Index ¶
- Constants
- func FileArguments(workingDirectory, routesFunction string) (map[string][]string, error)
- func GenerateValidations(im astgen.ImportManager, variable ast.Expr, variableType types.Type, ...) ([]ast.Stmt, error, bool)
- type AssertionFailureReporter
- type File
- func (file *File) Import(pkgIdent, pkgPath string) string
- func (file *File) ImportSpecs() []*ast.ImportSpec
- func (file *File) OutputPackage() *packages.Package
- func (file *File) Package(path string) (*packages.Package, bool)
- func (file *File) StructField(pos token.Pos) (*ast.Field, error)
- func (file *File) SyntaxFile(pos token.Pos) (*ast.File, *token.FileSet, error)
- func (file *File) TypeASTExpression(tp types.Type) (ast.Expr, error)
- func (file *File) Types(pkgPath string) (*types.Package, bool)
- type GeneratedFile
- type MaxLengthValidation
- type MaxValidation
- type MinLengthValidation
- type MinValidation
- type PatternValidation
- type RoutesFileConfiguration
- type ValidationErrorBlock
- type ValidationGenerator
Constants ¶
View Source
const ( InputAttributeNameStructTag = "name" InputAttributeTemplateStructTag = "template" )
View Source
const ( TemplateDataFieldIdentifierResult = "result" TemplateDataFieldIdentifierOkay = "okay" TemplateDataFieldIdentifierRedirectURL = "redirectURL" TemplateDataFieldIdentifierError = "errList" TemplateDataFieldIdentifierReceiver = "receiver" TemplateDataFieldIdentifierStatusCode = "statusCode" TemplateDataFieldIdentifierErrStatusCode = "errStatusCode" )
Variables ¶
This section is empty.
Functions ¶
func FileArguments ¶
FileArguments scans the working directory for muxt-generated Go files.
Files are identified by: 1. Having a "// Code generated by muxt generate" comment on the first line 2. Matching the routes function name extracted from the generation comment
Returns a map of absolute file paths and the muxt arguments passed to generate them.
func GenerateValidations ¶
func GenerateValidations(im astgen.ImportManager, variable ast.Expr, variableType types.Type, inputQuery, inputName, responseIdent string, fragment spec.DocumentFragment, validationFailureBlock ValidationErrorBlock) ([]ast.Stmt, error, bool)
Types ¶
type AssertionFailureReporter ¶
type AssertionFailureReporter struct{}
func (AssertionFailureReporter) Errorf ¶
func (AssertionFailureReporter) Errorf(format string, args ...interface{})
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) ImportSpecs ¶
func (file *File) ImportSpecs() []*ast.ImportSpec
func (*File) OutputPackage ¶
func (*File) SyntaxFile ¶
func (*File) TypeASTExpression ¶
type GeneratedFile ¶
func TemplateRoutesFile ¶
func TemplateRoutesFile(wd string, config RoutesFileConfiguration, fileSet *token.FileSet, pl []*packages.Package, logger *log.Logger) ([]GeneratedFile, error)
type MaxLengthValidation ¶
func (MaxLengthValidation) GenerateValidation ¶
func (val MaxLengthValidation) GenerateValidation(_ astgen.ImportManager, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt
type MaxValidation ¶
func (MaxValidation) GenerateValidation ¶
func (val MaxValidation) GenerateValidation(_ astgen.ImportManager, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt
type MinLengthValidation ¶
func (MinLengthValidation) GenerateValidation ¶
func (val MinLengthValidation) GenerateValidation(_ astgen.ImportManager, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt
type MinValidation ¶
func (MinValidation) GenerateValidation ¶
func (val MinValidation) GenerateValidation(_ astgen.ImportManager, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt
type PatternValidation ¶
func (PatternValidation) GenerateValidation ¶
func (val PatternValidation) GenerateValidation(im astgen.ImportManager, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt
type RoutesFileConfiguration ¶
type RoutesFileConfiguration struct {
MuxtVersion,
PackageName,
PackagePath,
TemplatesVariable,
RoutesFunction,
ReceiverType,
ReceiverPackage,
ReceiverInterface,
TemplateDataType,
TemplateRoutePathsTypeName string
OutputFileName string
PathPrefix bool
Logger bool
Verbose bool
OutputMultipleFiles bool
HTMXHelpers bool
}
type ValidationErrorBlock ¶
type ValidationGenerator ¶
type ValidationGenerator interface {
GenerateValidation(im astgen.ImportManager, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt
}
func ParseInputValidations ¶
Click to show internal directories.
Click to hide internal directories.