is.go 506 B

1234567891011121314151617181920212223
  1. package named
  2. import (
  3. "github.com/kyleconroy/sqlc/internal/sql/ast"
  4. "github.com/kyleconroy/sqlc/internal/sql/ast/pg"
  5. "github.com/kyleconroy/sqlc/internal/sql/astutils"
  6. )
  7. func IsParamFunc(node ast.Node) bool {
  8. call, ok := node.(*ast.FuncCall)
  9. if !ok {
  10. return false
  11. }
  12. if call.Func == nil {
  13. return false
  14. }
  15. return call.Func.Schema == "sqlc" && call.Func.Name == "arg"
  16. }
  17. func IsParamSign(node ast.Node) bool {
  18. expr, ok := node.(*pg.A_Expr)
  19. return ok && astutils.Join(expr.Name, ".") == "@"
  20. }