astutils

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MPL-2.0 Imports: 4 Imported by: 72

Documentation

Index

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

func ExprBoolValue(e ast.Expr) *bool

ExprBoolValue fetches a bool value from the Expr If the Expr cannot parse as a bool, returns nil.

func ExprIntValue

func ExprIntValue(e ast.Expr) *int

ExprIntValue fetches an int value from the Expr If the Expr cannot parse as an int, returns nil.

func ExprStringValue

func ExprStringValue(e ast.Expr) *string

ExprStringValue fetches a string value from the Expr If the Expr is not BasicLit, returns an empty string.

func ExprValue

func ExprValue(e ast.Expr) *ast.Expr

ExprValue fetches a pointer to the Expr If the Expr is nil, returns nil

func FieldListName

func FieldListName(fieldList *ast.FieldList, fieldPosition int, namePosition int) *string

FieldListName returns field name at field position and name position if found

func FieldListNames

func FieldListNames(fieldList *ast.FieldList, position int) []*ast.Ident

FieldListNames returns field names at field position if found

func FieldListType

func FieldListType(fieldList *ast.FieldList, position int) *ast.Expr

FieldListType returns type at field position if found

func FuncTypeFromNode

func FuncTypeFromNode(node ast.Node) *ast.FuncType

func IsExprTypeArrayError added in v0.12.0

func IsExprTypeArrayError(e ast.Expr) bool

IsExprTypeArrayError returns true if the expression matches []error

func IsExprTypeArrayString added in v0.12.0

func IsExprTypeArrayString(e ast.Expr) bool

IsExprTypeArrayString returns true if the expression matches []string

func IsExprTypeError added in v0.12.0

func IsExprTypeError(e ast.Expr) bool

IsExprTypeError returns true if the expression matches string

func IsExprTypeInterface added in v0.12.0

func IsExprTypeInterface(e ast.Expr) bool

IsExprTypeInterface returns true if the expression matches interface{}

func IsExprTypeString added in v0.12.0

func IsExprTypeString(e ast.Expr) bool

IsExprTypeString returns true if the expression matches string

func IsFieldListType

func IsFieldListType(fieldList *ast.FieldList, position int, exprFunc func(ast.Expr) bool) bool

IsFieldListType returns true if the field at position is present and matches expected ast.Expr

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

func IsPackageFunc

func IsPackageFunc(e ast.Expr, info *types.Info, packageSuffix string, funcName string) bool

IsPackageFunc returns true if the function package suffix (for vendoring) and name matches

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

func IsPackageNamedType

func IsPackageNamedType(t *types.Named, packageSuffix string, typeName string) bool

IsPackageNamedType returns if the type name matches and is from the package suffix

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

func IsPackageType

func IsPackageType(t types.Type, packageSuffix string, typeName string) bool

IsPackageType returns true if the type name can be matched and is from the package suffix

Types

This section is empty.

Jump to

Keyboard shortcuts

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