(_ js.Value, args []js.Value)
| 120 | } |
| 121 | |
| 122 | func validate(_ js.Value, args []js.Value) any { |
| 123 | if len(args) == 0 { |
| 124 | return jsonError("no SQL provided") |
| 125 | } |
| 126 | sql := args[0].String() |
| 127 | // dialect is accepted for API consistency |
| 128 | _ = getDialect(args) |
| 129 | |
| 130 | err := gosqlx.Validate(sql) |
| 131 | if err != nil { |
| 132 | return jsonResult(map[string]any{"valid": false, "error": err.Error()}) |
| 133 | } |
| 134 | return jsonResult(map[string]any{"valid": true}) |
| 135 | } |
| 136 | |
| 137 | func analyze(_ js.Value, args []js.Value) any { |
| 138 | if len(args) == 0 { |
nothing calls this directly
no test coverage detected