Commit 7ba12b34 authored by Faizal Aziz's avatar Faizal Aziz

fixing query

parent b70fbfb9
...@@ -319,7 +319,7 @@ func NewPostgreSql(option *PostgreSqlOption) (ORM, error) { ...@@ -319,7 +319,7 @@ func NewPostgreSql(option *PostgreSqlOption) (ORM, error) {
func generateSQLFromStorage(tableName string, columnAndValues interface{}) string { func generateSQLFromStorage(tableName string, columnAndValues interface{}) string {
st := reflect.TypeOf(columnAndValues) st := reflect.TypeOf(columnAndValues)
var columnNames strings.Builder var columnNames string
for i := 0; i < st.NumField(); i++ { for i := 0; i < st.NumField(); i++ {
field := st.Field(i) field := st.Field(i)
...@@ -347,10 +347,10 @@ func generateSQLFromStorage(tableName string, columnAndValues interface{}) strin ...@@ -347,10 +347,10 @@ func generateSQLFromStorage(tableName string, columnAndValues interface{}) strin
} }
} }
columnNames.WriteString(fmt.Sprintf("%s %s %s %s ,", columnNames, typeName, argName, keysName)) columnNames += fmt.Sprintf("%s %s %s %s ,", columnNames, typeName, argName, keysName)
} }
columnNamesStr := strings.TrimRight(columnNames.String(), ",") columnNamesStr := strings.TrimRight(columnNames, ",")
return fmt.Sprintf("CREATE TABLE %s '(%s)'", tableName, columnNamesStr) return fmt.Sprintf("CREATE TABLE %s '(%s)'", tableName, columnNamesStr)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment