| 35 | var numericPlaceholderRe = regexp.MustCompile(`\$\d+\$`) |
| 36 | |
| 37 | func isNumeric(k reflect.Kind) bool { |
| 38 | switch k { |
| 39 | case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: |
| 40 | return true |
| 41 | case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: |
| 42 | return true |
| 43 | case reflect.Float32, reflect.Float64: |
| 44 | return true |
| 45 | default: |
| 46 | return false |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | // ExplainSQL generate SQL string with given parameters, the generated SQL is expected to be used in logger, execute it might introduce a SQL injection vulnerability |
| 51 | func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string { |