Documentation
¶
Index ¶
- func GetBooleanValueFromExpr(expr ast.Expr) bool
- func GetComposeLitInUnaryExpr(expr ast.Expr) *ast.CompositeLit
- func GetCompositeStmtInFunc(fn *ast.FuncDecl) *ast.CompositeLit
- func GetEltsInFunc(fn *ast.FuncDecl) []ast.Expr
- func GetExprToBasicLit(expr ast.Expr) *ast.BasicLit
- func GetExprToCompositeLit(expr ast.Expr) *ast.CompositeLit
- func GetExprToCompositeLitAllowUnaryExpr(expr ast.Expr) *ast.CompositeLit
- func GetExprToIdent(expr ast.Expr) *ast.Ident
- func GetExprToKeyValueExpr(expr ast.Expr) *ast.KeyValueExpr
- func GetExprToSelectorExpr(expr ast.Expr) *ast.SelectorExpr
- func GetExprToUnaryExpr(expr ast.Expr) *ast.UnaryExpr
- func GetLastExpr(exprs []ast.Expr) ast.Expr
- func GetLastReturnStmtExpr(fn *ast.FuncDecl) ast.Expr
- func GetLastStatement(stmts []ast.Stmt) ast.Stmt
- func GetStringList(result *Result) []string
- func GetStringListFromExpr(expr ast.Expr) []string
- func GetTypeNameFromExpr(expr ast.Expr) string
- func GetUnderylingStringFromLiteralExpr(expr ast.Expr) string
- func IsFalseBooleanResult(result *Result) bool
- func IsTrueBooleanResult(result *Result) bool
- type Format
- type Result
- type Results
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBooleanValueFromExpr ¶
func GetComposeLitInUnaryExpr ¶
func GetComposeLitInUnaryExpr(expr ast.Expr) *ast.CompositeLit
func GetCompositeStmtInFunc ¶
func GetCompositeStmtInFunc(fn *ast.FuncDecl) *ast.CompositeLit
func GetEltsInFunc ¶
given a function node, it gets the list of elts in the func works for both edges in GetEdges() func and list of privacy rules in Rules
func GetExprToCompositeLit ¶
func GetExprToCompositeLit(expr ast.Expr) *ast.CompositeLit
func GetExprToCompositeLitAllowUnaryExpr ¶
func GetExprToCompositeLitAllowUnaryExpr(expr ast.Expr) *ast.CompositeLit
func GetExprToKeyValueExpr ¶
func GetExprToKeyValueExpr(expr ast.Expr) *ast.KeyValueExpr
func GetExprToSelectorExpr ¶
func GetExprToSelectorExpr(expr ast.Expr) *ast.SelectorExpr
func GetStringList ¶
func GetStringListFromExpr ¶
func GetTypeNameFromExpr ¶
GetTypeNameFromExpr takes an ast Expr and returns the underlying type Given the following Expr:
(*ast.SelectorExpr)(0xc000256440)({
X: (*ast.Ident)(0xc000256400)(ent),
Sel: (*ast.Ident)(0xc000256420)(ActionConfig)
}),
function returns ent.ActionConfig
func GetUnderylingStringFromLiteralExpr ¶
Takes an Expr and converts it to the underlying string without quotes For example: in the GetEdges method below,
return ent.EdgeMap{
"User": ent.AssociationEdgeGroup{
GroupStatusName: "Rsvp",
...
}, }
Calling this with the "User" Expr returns `User` and calling it with the "Rsvp" Expr returns `Rsvp`
func IsFalseBooleanResult ¶
func IsTrueBooleanResult ¶
Types ¶
type Result ¶
type Result struct {
ContainsMap bool
Slice bool
PkgName string
IdentName string
Format Format
Literal string
LiteralKind token.Token
Pointer bool
Key string // key if Result is a Map
Value *Result // Value if Result is a Map
Elems Results // Sub-elements in a slice or map
Args Results // Arguments to a function
Attributes Results // Attributes/configurations on the object.
Expr ast.Expr
// contains filtered or unexported fields
}
Result is returned by Parse after parsing an AST. It encodes the tree in a more-friendly way It's not exhaustive and only supports what has currently been tested
func Parse ¶
Parse takes an element received from an AST tree and parses it into a more-friendly format
func ParseFieldType ¶
ParseFieldType is a helper function to parse the type of a field