You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
336 B
20 lines
336 B
package data |
|
|
|
import ( |
|
"database/sql" |
|
|
|
log "github.com/sirupsen/logrus" |
|
) |
|
|
|
// mustExec will execute a SQL statement on a provided database instance. |
|
func mustExec(s string, db *sql.DB) { |
|
stmt, err := db.Prepare(s) |
|
if err != nil { |
|
log.Fatal(err) |
|
} |
|
defer stmt.Close() |
|
_, err = stmt.Exec() |
|
if err != nil { |
|
log.Warnln(err) |
|
} |
|
}
|
|
|