functions.go 506 B

1234567891011121314151617181920
  1. package mysql
  2. import (
  3. "fmt"
  4. )
  5. // converts MySQL function name to MySQL return type
  6. func functionReturnType(f string) string {
  7. switch f {
  8. case "avg", "count", "instr", "sum", "min", "max", "length", "char_length",
  9. "ceil", "floor", "mod":
  10. return "int"
  11. case "concat", "left", "replace", "substring", "trim", "find_in_set", "format", "group_concat":
  12. return "varchar"
  13. case "abs", "round", "truncate":
  14. return "decimal"
  15. default:
  16. panic(fmt.Sprintf("unknown mysql function type \"%v\"", f))
  17. }
  18. }