Documentation ¶
Overview ¶
Package decorator provides functionality for parsing a decorater yaml and returns the result
Index ¶
- Variables
- func GetDecoratorFile(dir, file string) (*ast.File, error)
- func ParseFile(filePath string) (*ast.File, error)
- func ValidateParamVals(f *ast.File, funcName, paramName string, decoType ast.Expr) error
- func ValidateReceiverVals(f *ast.File, funcName string, decoType ast.Expr) error
- func ValidateRes(res *Deco, dir string) error
- type CustomVal
- type Deco
- func (d *Deco) GetReceiverVal(fileName, funcName string) []*CustomVal
- func (d *Deco) GetVal(fileName, funcName, paramName string) []*CustomVal
- func (d *Deco) HasReceiverVal(fileName, funcName string) bool
- func (d *Deco) HasVal(fileName, funcName, paramName string) bool
- func (d *Deco) ShouldIgnoreFile(fileName string) bool
- func (d *Deco) ShouldIgnoreFunc(fileName, funcName string) bool
- type File
- type FileSpec
- type Func
- type FuncSpec
- type Param
- type ParamSpec
- type Spec
Constants ¶
This section is empty.
Variables ¶
var ( ErrIncorrectDecoratorType error = fmt.Errorf("incorrect dececorator type") ErrParamNotFoundInFunc error = fmt.Errorf("param name not found") ErrReceiverNotFoundInFunc error = fmt.Errorf("receiver not found") ErrNoInputParamsExpected error = fmt.Errorf("expected no input parameters") ErrExpectedOneRetrunVal error = fmt.Errorf("expected only one return value") ErrDecoratorFuncNameNotFound error = fmt.Errorf("decorator func name not found") ErrMissingFileName error = fmt.Errorf("missing file name") )
error definitions
Functions ¶
func GetDecoratorFile ¶
GetDecoratorFile retrieve file with decorator spec
func ValidateParamVals ¶
ValidateParamVals validate file with given decorator type
func ValidateReceiverVals ¶
ValidateReceiverVals validates the type of a custom receiver value
func ValidateRes ¶
ValidateRes validate the resulting decorator for given dir
Types ¶
type CustomVal ¶
CustomVal value for a given parameter or receiver consists of a type and call expression
type Deco ¶
Deco result of a decorator file
func ConvertSpec ¶
ConvertSpec convert spec to decorator result
func GetDecorators ¶
GetDecorators retrieves decorators if specified in given file
func YamlToSpec ¶
YamlToSpec converts yaml file to result
func (*Deco) GetReceiverVal ¶
GetReceiverVal retrieves receiver values for given file and func
func (*Deco) HasReceiverVal ¶
HasReceiverVal checks if a receiver val is specified
func (*Deco) ShouldIgnoreFile ¶
ShouldIgnoreFile checks if a file should be ignored
func (*Deco) ShouldIgnoreFunc ¶
ShouldIgnoreFunc checks if a function should be ignored
type FileSpec ¶
type FileSpec struct { Name string `yaml:"name"` Ignore bool `yaml:"ignore"` Funcs []FuncSpec `yaml:"funcs"` }
FileSpec file spec of decorator file
type FuncSpec ¶
type FuncSpec struct { Name string `yaml:"name"` Ignore bool `yaml:"ignore"` ReceiverValues []string `yaml:"receiver_values"` Params []ParamSpec `yaml:"params"` }
FuncSpec function spec of decorator file