Documentation ¶
Index ¶
- func CompositeLitContainsAnyField(cl *ast.CompositeLit, fieldNames ...string) bool
- func CompositeLitField(cl *ast.CompositeLit, fieldName string) *ast.KeyValueExpr
- func CompositeLitFieldBoolValue(cl *ast.CompositeLit, fieldName string) *bool
- func CompositeLitFieldExprValue(cl *ast.CompositeLit, fieldName string) *ast.Expr
- func CompositeLitFieldIntValue(cl *ast.CompositeLit, fieldName string) *int
- func CompositeLitFields(cl *ast.CompositeLit) map[string]*ast.KeyValueExpr
- func ExprBoolValue(e ast.Expr) *bool
- func ExprIntValue(e ast.Expr) *int
- func ExprStringValue(e ast.Expr) *string
- func ExprValue(e ast.Expr) *ast.Expr
- func FieldListName(fieldList *ast.FieldList, fieldPosition int, namePosition int) *string
- func FieldListNames(fieldList *ast.FieldList, position int) []*ast.Ident
- func FieldListType(fieldList *ast.FieldList, position int) *ast.Expr
- func FuncTypeFromNode(node ast.Node) *ast.FuncType
- func HasFieldListLength(fieldList *ast.FieldList, expectedLength int) bool
- func IsExprTypeArrayError(e ast.Expr) bool
- func IsExprTypeArrayString(e ast.Expr) bool
- func IsExprTypeBool(e ast.Expr) bool
- func IsExprTypeError(e ast.Expr) bool
- func IsExprTypeInterface(e ast.Expr) bool
- func IsExprTypeMapStringInterface(e ast.Expr) bool
- func IsExprTypeString(e ast.Expr) bool
- func IsFieldListType(fieldList *ast.FieldList, position int, exprFunc func(ast.Expr) bool) bool
- func IsFieldListTypeModulePackageType(fieldList *ast.FieldList, position int, info *types.Info, module string, ...) bool
- func IsFieldListTypePackageType(fieldList *ast.FieldList, position int, info *types.Info, packageSuffix string, ...) bool
- func IsModulePackageFunc(e ast.Expr, info *types.Info, module string, packageSuffix string, ...) bool
- func IsModulePackageFunctionFieldListType(e ast.Expr, info *types.Info, module string, packageSuffix string, ...) bool
- func IsModulePackageNamedType(t *types.Named, module string, packageSuffix string, typeName string) bool
- func IsModulePackageReceiverMethod(e ast.Expr, info *types.Info, module string, packageSuffix string, ...) bool
- func IsModulePackageType(t types.Type, module string, packageSuffix string, typeName string) bool
- func IsPackageFunc(e ast.Expr, info *types.Info, packageSuffix string, funcName string) bool
- func IsPackageFunctionFieldListType(e ast.Expr, info *types.Info, packageSuffix string, typeName string) bool
- func IsPackageNamedType(t *types.Named, packageSuffix string, typeName string) bool
- func IsPackageReceiverMethod(e ast.Expr, info *types.Info, packageSuffix string, ...) bool
- func IsPackageType(t types.Type, packageSuffix string, typeName string) bool
- func IsStdlibPackageFunc(e ast.Expr, info *types.Info, packagePath string, funcName string) bool
- func IsStdlibPackageFunctionFieldListType(e ast.Expr, info *types.Info, packagePath string, typeName string) bool
- func IsStdlibPackageNamedType(t *types.Named, packagePath string, typeName string) bool
- func IsStdlibPackageReceiverMethod(e ast.Expr, info *types.Info, packagePath string, ...) bool
- func IsStdlibPackageType(t types.Type, packagePath string, typeName string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompositeLitContainsAnyField ¶
func CompositeLitContainsAnyField(cl *ast.CompositeLit, fieldNames ...string) bool
func CompositeLitField ¶
func CompositeLitField(cl *ast.CompositeLit, fieldName string) *ast.KeyValueExpr
func CompositeLitFieldBoolValue ¶
func CompositeLitFieldBoolValue(cl *ast.CompositeLit, fieldName string) *bool
func CompositeLitFieldExprValue ¶
func CompositeLitFieldExprValue(cl *ast.CompositeLit, fieldName string) *ast.Expr
func CompositeLitFieldIntValue ¶
func CompositeLitFieldIntValue(cl *ast.CompositeLit, fieldName string) *int
func CompositeLitFields ¶
func CompositeLitFields(cl *ast.CompositeLit) map[string]*ast.KeyValueExpr
func ExprBoolValue ¶
ExprBoolValue fetches a bool value from the Expr If the Expr cannot parse as a bool, returns nil.
func ExprIntValue ¶
ExprIntValue fetches an int value from the Expr If the Expr cannot parse as an int, returns nil.
func ExprStringValue ¶
ExprStringValue fetches a string value from the Expr If the Expr is not BasicLit, returns an empty string.
func FieldListName ¶
FieldListName returns field name at field position and name position if found
func FieldListNames ¶
FieldListNames returns field names at field position if found
func FieldListType ¶
FieldListType returns type at field position if found
func HasFieldListLength ¶ added in v0.13.0
HasFieldListLength returns true if the FieldList has the expected length If FieldList is nil, checks against expected length of 0.
func IsExprTypeArrayError ¶ added in v0.12.0
IsExprTypeArrayError returns true if the expression matches []error
func IsExprTypeArrayString ¶ added in v0.12.0
IsExprTypeArrayString returns true if the expression matches []string
func IsExprTypeBool ¶ added in v0.13.0
IsExprTypeString returns true if the expression matches bool
func IsExprTypeError ¶ added in v0.12.0
IsExprTypeError returns true if the expression matches string
func IsExprTypeInterface ¶ added in v0.12.0
IsExprTypeInterface returns true if the expression matches interface{}
func IsExprTypeMapStringInterface ¶ added in v0.13.0
IsExprTypeMapStringInterface returns true if the expression matches []string
func IsExprTypeString ¶ added in v0.12.0
IsExprTypeString returns true if the expression matches string
func IsFieldListType ¶
IsFieldListType returns true if the field at position is present and matches expected ast.Expr
func IsFieldListTypeModulePackageType ¶ added in v0.15.0
func IsFieldListTypeModulePackageType(fieldList *ast.FieldList, position int, info *types.Info, module string, packageSuffix string, typeName string) bool
IsFieldListTypeModulePackageType returns true if the field at position is present and matches expected module and package type
This function automatically handles Go module versioning in import paths. To explicitly check an import path, use IsFieldListTypePackageType instead.
func IsFieldListTypePackageType ¶
func IsFieldListTypePackageType(fieldList *ast.FieldList, position int, info *types.Info, packageSuffix string, typeName string) bool
IsFieldListTypePackageType returns true if the field at position is present and matches expected package type
This function checks an explicit import path. To allow any Go module version in the import path, use IsFieldListTypeModulePackageType instead.
func IsModulePackageFunc ¶ added in v0.15.0
func IsModulePackageFunc(e ast.Expr, info *types.Info, module string, packageSuffix string, funcName string) bool
IsModulePackageFunc returns true if the function package suffix (for vendoring) and name matches
This function automatically handles Go module versioning in import paths. To explicitly check an import path, use IsPackageFunc instead.
func IsModulePackageFunctionFieldListType ¶ added in v0.15.0
func IsModulePackageFunctionFieldListType(e ast.Expr, info *types.Info, module string, packageSuffix string, typeName string) bool
IsModulePackageFunctionFieldListType returns true if the function parameter package suffix (for vendoring) and name matches
This function automatically handles Go module versioning in import paths. To explicitly check an import path, use IsPackageFunctionFieldListType instead.
func IsModulePackageNamedType ¶ added in v0.15.0
func IsModulePackageNamedType(t *types.Named, module string, packageSuffix string, typeName string) bool
IsModulePackageNamedType returns if the type name matches and is from the package suffix
This function automatically handles Go module versioning in import paths. To explicitly check an import path, use IsPackageNamedType instead.
func IsModulePackageReceiverMethod ¶ added in v0.15.0
func IsModulePackageReceiverMethod(e ast.Expr, info *types.Info, module string, packageSuffix string, receiverName string, methodName string) bool
IsModulePackageReceiverMethod returns true if the module and package suffix (for vendoring), receiver name, and method name match
This function automatically handles Go module versioning in import paths. To explicitly check an import path, use IsPackageReceiverMethod instead.
func IsModulePackageType ¶ added in v0.15.0
IsModulePackageType returns true if the type name can be matched and is from the package suffix
This function automatically handles Go module versioning in import paths. To explicitly check an import path, use IsPackageType instead.
func IsPackageFunc ¶
IsPackageFunc returns true if the function package suffix (for vendoring) and name matches
This function checks an explicit import path. To allow any Go module version in the import path, use IsModulePackageFunc instead.
func IsPackageFunctionFieldListType ¶
func IsPackageFunctionFieldListType(e ast.Expr, info *types.Info, packageSuffix string, typeName string) bool
IsPackageFunctionFieldListType returns true if the function parameter package suffix (for vendoring) and name matches
This function checks an explicit import path. To allow any Go module version in the import path, use IsModuleFunctionFieldListType instead.
func IsPackageNamedType ¶
IsPackageNamedType returns if the type name matches and is from the package suffix
This function checks an explicit import path. To allow any Go module version in the import path, use IsModulePackageNamedType instead.
func IsPackageReceiverMethod ¶
func IsPackageReceiverMethod(e ast.Expr, info *types.Info, packageSuffix string, receiverName, methodName string) bool
IsPackageReceiverMethod returns true if the package suffix (for vendoring), receiver name, and method name match
This function checks an explicit import path. To allow any Go module version in the import path, use IsModulePackageReceiverMethod instead.
func IsPackageType ¶
IsPackageType returns true if the type name can be matched and is from the package suffix
This function checks an explicit import path. To allow any Go module version in the import path, use IsModulePackageType instead.
func IsStdlibPackageFunc ¶ added in v0.17.0
IsStdlibPackageFunc returns true if the function package suffix (for vendoring) and name matches
This function checks an explicit import path without vendoring. To allow vendored paths, use IsPackageFunc instead.
func IsStdlibPackageFunctionFieldListType ¶ added in v0.17.0
func IsStdlibPackageFunctionFieldListType(e ast.Expr, info *types.Info, packagePath string, typeName string) bool
IsStdlibPackageFunctionFieldListType returns true if the function parameter package suffix (for vendoring) and name matches
This function checks an explicit import path without vendoring. To allow vendored paths, use IsPackageFunctionFieldListType instead.
func IsStdlibPackageNamedType ¶ added in v0.17.0
IsStdlibPackageNamedType returns if the type name matches and is from the package suffix
This function checks an explicit import path without vendoring. To allow vendored paths, use IsPackageNamedType instead.
func IsStdlibPackageReceiverMethod ¶ added in v0.17.0
func IsStdlibPackageReceiverMethod(e ast.Expr, info *types.Info, packagePath string, receiverName, methodName string) bool
IsStdlibPackageReceiverMethod returns true if the package suffix (for vendoring), receiver name, and method name match
This function checks an explicit import path without vendoring. To allow vendored paths, use IsPackageReceiverMethod instead.
func IsStdlibPackageType ¶ added in v0.17.0
IsStdlibPackageType returns true if the type name can be matched and is from the package suffix
This function checks an explicit import path without vendoring. To allow vendored paths, use IsPackageType instead.
Types ¶
This section is empty.