MCPcopy
hub / github.com/go-gorm/gorm / isNumeric

Function isNumeric

logger/sql.go:37–48  ·  view source on GitHub ↗
(k reflect.Kind)

Source from the content-addressed store, hash-verified

35var numericPlaceholderRe = regexp.MustCompile(`\$\d+\$`)
36
37func 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
51func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string {

Callers 1

ExplainSQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected