Describe the feature

Can we create a new method which can create a new table dynamically,just lick this code:

db, err := sql.Open("mysql", dsn) if err != nil { log.Fatal(err) } str := []string{"a", "b", "c"} defer db.Close() start_sql_ins := CREATE TABLE IF NOT EXISTS surveys ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NOT NULL for , v := range str { start_sql_ins = fmt.Sprintf(%v, %v VARCHAR(255) NOT NULL, start_sql_ins, v) } // SQL创建表的语句 sql_ins := fmt.Sprintf(%v );, start_sql_ins) fmt.Println(sql_ins) // 执行SQL创建表语句 , err = db.Exec(sql_ins) if err != nil { log.Fatal(err) }

fmt.Println("Table 'surveys' created successfully.")

which is using "go-sql-driver/mysql“ to do. When I try to use gorm to create table ,especially when I create a struct that I don't know how many variable does this struct have

Motivation

Related Issues

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days