SQLForExpression generates a SQL expression for a query expression. pseudoHaving is true if the expression is allowed to reference measure expressions. visible is true if the expression is only allowed to reference dimensions and measures that are exposed by the security policy.
(e *Expression, n *SelectNode, pseudoHaving, visible bool)
| 13 | // pseudoHaving is true if the expression is allowed to reference measure expressions. |
| 14 | // visible is true if the expression is only allowed to reference dimensions and measures that are exposed by the security policy. |
| 15 | func (ast *AST) SQLForExpression(e *Expression, n *SelectNode, pseudoHaving, visible bool) (string, []any, error) { |
| 16 | b := &sqlExprBuilder{ |
| 17 | ast: ast, |
| 18 | node: n, |
| 19 | pseudoHaving: pseudoHaving, |
| 20 | visible: visible, |
| 21 | out: &strings.Builder{}, |
| 22 | } |
| 23 | |
| 24 | err := b.writeExpression(e) |
| 25 | if err != nil { |
| 26 | return "", nil, err |
| 27 | } |
| 28 | |
| 29 | return b.out.String(), b.args, nil |
| 30 | } |
| 31 | |
| 32 | type sqlExprBuilder struct { |
| 33 | ast *AST |