source

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const IntBitLength = 32 << (^uint(0) >> 63)

Variables

This section is empty.

Functions

func Bool added in v0.16.0

func Bool(b bool) *ast.Ident

func CallError added in v0.8.4

func CallError(errIdent string) *ast.CallExpr

func EmptyStructType added in v0.16.0

func EmptyStructType() *ast.StructType

func ExecuteTemplateArguments added in v0.12.0

func ExecuteTemplateArguments(node ast.Node, info *types.Info, templatesVariableName string) (string, types.Type, bool)

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 FormatFile added in v0.11.1

func FormatFile(filePath string, f *ast.File) (string, error)

func GenerateValidations added in v0.8.4

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

func HTTPStatusCode added in v0.8.0

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

func HTTPStatusName added in v0.8.2

func HTTPStatusName(name string) (int, error)

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 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 types.Type) (reflect.Value, error)

func String added in v0.8.4

func String(s string) *ast.BasicLit

Types

type File added in v0.16.0

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

func NewFile added in v0.16.0

func NewFile(filePath string, fileSet *token.FileSet, list []*packages.Package) (*File, error)

func (*File) AddNetHTTP added in v0.16.0

func (file *File) AddNetHTTP() string

func (*File) BytesNewBuffer added in v0.16.0

func (file *File) BytesNewBuffer(expr ast.Expr) *ast.CallExpr

func (*File) Call added in v0.16.0

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

func (*File) Format added in v0.16.0

func (file *File) Format(variable ast.Expr, kind types.BasicKind) (ast.Expr, error)

func (*File) FormatBool added in v0.16.0

func (file *File) FormatBool(in ast.Expr) *ast.CallExpr

func (*File) FormatInt added in v0.16.0

func (file *File) FormatInt(in ast.Expr) *ast.CallExpr

func (*File) FormatInt16 added in v0.16.0

func (file *File) FormatInt16(in ast.Expr) *ast.CallExpr

func (*File) FormatInt32 added in v0.16.0

func (file *File) FormatInt32(in ast.Expr) *ast.CallExpr

func (*File) FormatInt64 added in v0.16.0

func (file *File) FormatInt64(in ast.Expr) *ast.CallExpr

func (*File) FormatInt8 added in v0.16.0

func (file *File) FormatInt8(in ast.Expr) *ast.CallExpr

func (*File) FormatUint added in v0.16.0

func (file *File) FormatUint(in ast.Expr) *ast.CallExpr

func (*File) FormatUint16 added in v0.16.0

func (file *File) FormatUint16(in ast.Expr) *ast.CallExpr

func (*File) FormatUint32 added in v0.16.0

func (file *File) FormatUint32(in ast.Expr) *ast.CallExpr

func (*File) FormatUint64 added in v0.16.0

func (file *File) FormatUint64(in ast.Expr) *ast.CallExpr

func (*File) FormatUint8 added in v0.16.0

func (file *File) FormatUint8(in ast.Expr) *ast.CallExpr

func (*File) HTTPErrorCall added in v0.16.0

func (file *File) HTTPErrorCall(response, message ast.Expr, code int) *ast.CallExpr

func (*File) HTTPHeader added in v0.16.0

func (file *File) HTTPHeader() *ast.SelectorExpr

func (*File) HTTPRequestPtr added in v0.16.0

func (file *File) HTTPRequestPtr() *ast.StarExpr

func (*File) HTTPResponseWriter added in v0.16.0

func (file *File) HTTPResponseWriter() *ast.SelectorExpr

func (*File) Import added in v0.16.0

func (file *File) Import(pkgIdent, pkgPath string) string

func (*File) ImportSpecs added in v0.16.0

func (file *File) ImportSpecs() []*ast.ImportSpec

func (*File) OutputPackage added in v0.16.0

func (file *File) OutputPackage() *packages.Package

func (*File) Package added in v0.16.0

func (file *File) Package(path string) (*packages.Package, bool)

func (*File) SlogString added in v0.16.0

func (file *File) SlogString(key string, val ast.Expr) *ast.CallExpr

func (*File) StrconvAtoiCall added in v0.16.0

func (file *File) StrconvAtoiCall(expr ast.Expr) *ast.CallExpr

func (*File) StrconvItoaCall added in v0.16.0

func (file *File) StrconvItoaCall(expr ast.Expr) *ast.CallExpr

func (*File) StrconvParseBoolCall added in v0.16.0

func (file *File) StrconvParseBoolCall(expr ast.Expr) *ast.CallExpr

func (*File) StrconvParseFloatCall added in v0.16.0

func (file *File) StrconvParseFloatCall(expr ast.Expr, size int) *ast.CallExpr

func (*File) StrconvParseInt16Call added in v0.16.0

func (file *File) StrconvParseInt16Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseInt32Call added in v0.16.0

func (file *File) StrconvParseInt32Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseInt64Call added in v0.16.0

func (file *File) StrconvParseInt64Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseInt8Call added in v0.16.0

func (file *File) StrconvParseInt8Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseIntCall added in v0.16.0

func (file *File) StrconvParseIntCall(expr ast.Expr, base, size int) *ast.CallExpr

func (*File) StrconvParseUint0Call added in v0.16.0

func (file *File) StrconvParseUint0Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseUint16Call added in v0.16.0

func (file *File) StrconvParseUint16Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseUint32Call added in v0.16.0

func (file *File) StrconvParseUint32Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseUint64Call added in v0.16.0

func (file *File) StrconvParseUint64Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseUint8Call added in v0.16.0

func (file *File) StrconvParseUint8Call(in ast.Expr) *ast.CallExpr

func (*File) StrconvParseUintCall added in v0.16.0

func (file *File) StrconvParseUintCall(expr ast.Expr, base, size int) *ast.CallExpr

func (*File) StructField added in v0.16.0

func (file *File) StructField(pos token.Pos) (*ast.Field, error)

func (*File) SyntaxFile added in v0.16.0

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

func (*File) TimeParseCall added in v0.16.0

func (file *File) TimeParseCall(layout string, expr ast.Expr) *ast.CallExpr

func (*File) TypeASTExpression added in v0.16.0

func (file *File) TypeASTExpression(tp types.Type) (ast.Expr, error)

func (*File) Types added in v0.16.0

func (file *File) Types(pkgPath string) (*types.Package, bool)

type Functions added in v0.10.0

type Functions map[string]*types.Signature

func DefaultFunctions added in v0.10.0

func DefaultFunctions(pkg *types.Package) Functions

func Templates

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

func (Functions) FindFunction added in v0.10.0

func (functions Functions) FindFunction(name string) (*types.Signature, bool)

type MaxLengthValidation added in v0.13.1

type MaxLengthValidation struct {
	Name      string
	MaxLength int
}

func (MaxLengthValidation) GenerateValidation added in v0.13.1

func (val MaxLengthValidation) GenerateValidation(_ *File, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt

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(_ *File, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt

type MinLengthValidation added in v0.13.1

type MinLengthValidation struct {
	Name      string
	MinLength int
}

func (MinLengthValidation) GenerateValidation added in v0.13.1

func (val MinLengthValidation) GenerateValidation(_ *File, variable ast.Expr, handleError ValidationErrorBlock) 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(_ *File, variable ast.Expr, handleError ValidationErrorBlock) 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 *File, variable ast.Expr, handleError ValidationErrorBlock) ast.Stmt

type ValidationErrorBlock added in v0.16.0

type ValidationErrorBlock func(string) *ast.BlockStmt

type ValidationGenerator added in v0.8.4

type ValidationGenerator interface {
	GenerateValidation(imports *File, variable ast.Expr, handleError ValidationErrorBlock) 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