extractIntFromNode extracts an integer value from a LIMIT/OFFSET node.
(node ast.Node)
| 303 | |
| 304 | // extractIntFromNode extracts an integer value from a LIMIT/OFFSET node. |
| 305 | func extractIntFromNode(node ast.Node) int { |
| 306 | switch n := node.(type) { |
| 307 | case *ast.Integer: |
| 308 | return int(n.Ival) |
| 309 | case *ast.A_Const: |
| 310 | if iv, ok := n.Val.(*ast.Integer); ok { |
| 311 | return int(iv.Ival) |
| 312 | } |
| 313 | return 0 |
| 314 | default: |
| 315 | return 0 |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | // nodeLocOf returns the Loc of a node, handling common wrapper types. |
| 320 | func nodeLocOf(node ast.Node) ast.Loc { |
no outgoing calls
no test coverage detected