Add reserved words for MySQL.

This commit is contained in:
go-jet 2020-05-02 22:15:38 +02:00
parent 241ea0d6d6
commit 926b88ed40
12 changed files with 573 additions and 178 deletions

View file

@ -163,10 +163,17 @@ func argToString(value interface{}) string {
case time.Time:
return stringQuote(string(pq.FormatTimestamp(bindVal)))
default:
if strBindValue, ok := bindVal.(toStringInterface); ok {
return stringQuote(strBindValue.String())
}
panic(fmt.Sprintf("jet: %s type can not be used as SQL query parameter", reflect.TypeOf(value).String()))
}
}
type toStringInterface interface {
String() string
}
func integerTypesToString(value interface{}) string {
switch bindVal := value.(type) {
case int:

View file

@ -59,7 +59,7 @@ func SerializeColumnNames(columns []Column, out *SQLBuilder) {
panic("jet: nil column in columns list")
}
out.WriteString(col.Name())
out.WriteIdentifier(col.Name())
}
}