source

package
v0.9.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallError added in v0.8.4

func CallError(errIdent string) *ast.CallExpr

func ErrorCheckReturn added in v0.8.0

func ErrorCheckReturn(errVarIdent string, body ...ast.Stmt) *ast.IfStmt

func FieldIndex added in v0.8.0

func FieldIndex(fields []*ast.Field, i int) (*ast.Ident, ast.Expr, bool)

func Format added in v0.4.1

func Format(node ast.Node) string

func GenerateParseValueFromStringStatements added in v0.8.4

func GenerateParseValueFromStringStatements(imports *Imports, tmp string, str, typeExp ast.Expr, errCheck func(expr ast.Expr) ast.Stmt, validations []ast.Stmt, assignment func(ast.Expr) ast.Stmt) ([]ast.Stmt, error)

func GenerateValidations added in v0.8.4

func GenerateValidations(imports *Imports, variable, variableType ast.Expr, inputQuery, inputName, responseIdent string, fragment spec.DocumentFragment) ([]ast.Stmt, error, bool)

func HTTPStatusCode added in v0.8.0

func HTTPStatusCode(imports *Imports, n int) ast.Expr

func HTTPStatusName added in v0.8.2

func HTTPStatusName(name string) (int, error)

func Ident added in v0.8.4

func Ident(n string) *ast.Ident

func Int added in v0.8.0

func Int(n int) *ast.BasicLit

func IterateFieldTypes added in v0.7.0

func IterateFieldTypes(list []*ast.Field) func(func(int, ast.Expr) bool)

func IterateFunctions

func IterateFunctions(files []*ast.File) func(func(*ast.File, *ast.FuncDecl) bool)

func IterateGenDecl

func IterateGenDecl(files []*ast.File, tok token.Token) func(func(*ast.File, *ast.GenDecl) bool)

func IterateValueSpecs

func IterateValueSpecs(files []*ast.File) func(func(*ast.File, *ast.ValueSpec) bool)

func Nil added in v0.8.4

func Nil() *ast.Ident

func ParseStringWithType added in v0.8.4

func ParseStringWithType(val string, tp ast.Expr) (reflect.Value, error)

func String added in v0.8.4

func String(s string) *ast.BasicLit

func Templates

func Templates(workingDirectory, templatesVariable string, fileSet *token.FileSet, files []*ast.File, embeddedAbsolutePath []string) (*template.Template, error)

Types

type Imports added in v0.8.4

type Imports struct {
	*ast.GenDecl
}

func NewImports added in v0.8.4

func NewImports(decl *ast.GenDecl) *Imports

func (*Imports) Add added in v0.8.4

func (imports *Imports) Add(pkgIdent, pkgPath string) string

func (*Imports) AddContext added in v0.8.4

func (imports *Imports) AddContext() string

func (*Imports) AddHTMLTemplate added in v0.8.4

func (imports *Imports) AddHTMLTemplate() string

func (*Imports) AddNetHTTP added in v0.8.4

func (imports *Imports) AddNetHTTP() string

func (*Imports) Call added in v0.8.4

func (imports *Imports) Call(pkgName, pkgPath, funcIdent string, args []ast.Expr) *ast.CallExpr

func (*Imports) HTTPErrorCall added in v0.8.4

func (imports *Imports) HTTPErrorCall(response ast.Expr, message ast.Expr, code int) *ast.CallExpr

func (*Imports) Ident added in v0.8.4

func (imports *Imports) Ident(pkgPath string) string

func (*Imports) ImportSpecs added in v0.8.4

func (imports *Imports) ImportSpecs() []*ast.ImportSpec

func (*Imports) SortImports added in v0.8.4

func (imports *Imports) SortImports()

func (*Imports) StrconvAtoiCall added in v0.8.4

func (imports *Imports) StrconvAtoiCall(expr ast.Expr) *ast.CallExpr

func (*Imports) StrconvParseBoolCall added in v0.8.4

func (imports *Imports) StrconvParseBoolCall(expr ast.Expr) *ast.CallExpr

func (*Imports) StrconvParseFloatCall added in v0.8.4

func (imports *Imports) StrconvParseFloatCall(expr ast.Expr, size int) *ast.CallExpr

func (*Imports) StrconvParseIntCall added in v0.8.4

func (imports *Imports) StrconvParseIntCall(expr ast.Expr, base, size int) *ast.CallExpr

func (*Imports) StrconvParseUintCall added in v0.8.4

func (imports *Imports) StrconvParseUintCall(expr ast.Expr, base, size int) *ast.CallExpr

func (*Imports) TimeParseCall added in v0.8.4

func (imports *Imports) TimeParseCall(layout string, expr ast.Expr) *ast.CallExpr

type MaxValidation added in v0.8.4

type MaxValidation struct {
	Name   string
	MinExp ast.Expr
}

func (MaxValidation) GenerateValidation added in v0.8.4

func (val MaxValidation) GenerateValidation(_ *Imports, variable ast.Expr, handleError func(string) ast.Stmt) ast.Stmt

type MinValidation added in v0.8.4

type MinValidation struct {
	Name   string
	MinExp ast.Expr
}

func (MinValidation) GenerateValidation added in v0.8.4

func (val MinValidation) GenerateValidation(_ *Imports, variable ast.Expr, handleError func(string) ast.Stmt) ast.Stmt

type PatternValidation added in v0.8.4

type PatternValidation struct {
	Name string
	Exp  *regexp.Regexp
}

func (PatternValidation) GenerateValidation added in v0.8.4

func (val PatternValidation) GenerateValidation(imports *Imports, variable ast.Expr, handleError func(string) ast.Stmt) ast.Stmt

type ValidationGenerator added in v0.8.4

type ValidationGenerator interface {
	GenerateValidation(imports *Imports, variable ast.Expr, handleError func(string) ast.Stmt) ast.Stmt
}

func ParseInputValidations added in v0.8.4

func ParseInputValidations(name string, input spec.Element, tp ast.Expr) ([]ValidationGenerator, error)

Jump to

Keyboard shortcuts

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