source

package
v0.8.8-dev.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 22 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 FindFieldWithName added in v0.8.4

func FindFieldWithName(list *ast.FieldList, name string) (*ast.Field, 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 ast.Expr, variableType types.Type, 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 HasFieldWithName added in v0.8.4

func HasFieldWithName(list *ast.FieldList, name string) bool

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 Load added in v0.8.9

func Load(dir string, patterns ...string) ([]*packages.Package, error)

func Nil added in v0.8.4

func Nil() *ast.Ident

func ParseStringWithType added in v0.8.4

func ParseStringWithType(val string, tp types.Type) (reflect.Value, error)

func String added in v0.8.4

func String(s string) *ast.BasicLit

func Templates

func Templates(workingDirectory, templatesVariable string, pkg *packages.Package) (*template.Template, error)

Types

type Imports added in v0.8.4

type Imports struct {
	*ast.GenDecl
	// contains filtered or unexported fields
}

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) AddPackages added in v0.8.9

func (imports *Imports) AddPackages(p *types.Package)

func (*Imports) Call added in v0.8.4

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

func (*Imports) FieldTag added in v0.8.9

func (imports *Imports) FieldTag(pos token.Pos) (*ast.Field, error)

func (*Imports) FileSet added in v0.8.9

func (imports *Imports) FileSet() *token.FileSet

func (*Imports) HTTPErrorCall added in v0.8.4

func (imports *Imports) HTTPErrorCall(response, 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) OutputPackage added in v0.8.9

func (imports *Imports) OutputPackage() string

func (*Imports) SetOutputPackage added in v0.8.9

func (imports *Imports) SetOutputPackage(pkgPath string)

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) SyntaxFile added in v0.8.9

func (imports *Imports) SyntaxFile(pos token.Pos) (*ast.File, *token.FileSet, error)

func (*Imports) TimeParseCall added in v0.8.4

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

func (*Imports) Types added in v0.8.9

func (imports *Imports) Types(pkgPath string) (*types.Package, bool)

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 types.Type) ([]ValidationGenerator, error)

Jump to

Keyboard shortcuts

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